pydantic-core icon indicating copy to clipboard operation
pydantic-core copied to clipboard

Validate bytes based on ser_json_bytes

Open josh-newman opened this issue 1 year ago • 12 comments

Change Summary

ser_json_bytes transforms values (with base64 encoding) during serialization. But validation doesn't do a complementary base64 decode, so a serialization round-trip into the same model type yields an unequal object.

Related issue number

None for this directly. Other users have mentioned base64 decoding, though: https://github.com/pydantic/pydantic/issues/7000#issuecomment-1669967897

Checklist

  • [X] Unit tests for the changes exist
  • [ ] Documentation reflects the changes where applicable
  • [ ] Pydantic tests pass with this pydantic-core (except for expected changes)
  • [X] My PR is ready to review

Selected Reviewer: @davidhewitt

josh-newman avatar May 31 '24 23:05 josh-newman