Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use more explicit warning regarding serialization warning for missing fields #1415

Merged
merged 11 commits into from
Aug 22, 2024

Conversation

sydney-runkle
Copy link
Member

Fix pydantic/pydantic#10192

Now:

pydantic_core._pydantic_core.PydanticSerializationUnexpectedValue: Expected 3 fields but got 2 for field Pipeline of type `Side_with_init` with value `Side_with_init(Name='Remove', With_init='TestRemoveOptional')` - serialized value may not be as expected.

Before:

pydantic_core._pydantic_core.PydanticSerializationUnexpectedValue: Unexpected Value

Also:

  • Fixed bug where field_namewas nullified in extra for model serializers
  • Standardized truncating string logic via tools function

Copy link
Contributor

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially can benefit from a test?

src/errors/mod.rs Outdated Show resolved Hide resolved
Copy link

codspeed-hq bot commented Aug 21, 2024

CodSpeed Performance Report

Merging #1415 will not alter performance

Comparing better-warning-for-missing-field (63f108d) with main (4113638)

Summary

✅ 155 untouched benchmarks

src/errors/mod.rs Outdated Show resolved Hide resolved
src/tools.rs Show resolved Hide resolved
src/errors/mod.rs Outdated Show resolved Hide resolved
@BoxyUwU
Copy link
Contributor

BoxyUwU commented Aug 21, 2024

+1 to a test being nice, its hard to see what the change in output actually looks like in practice

tests/serializers/test_model.py Show resolved Hide resolved
src/serializers/fields.rs Outdated Show resolved Hide resolved
src/serializers/fields.rs Outdated Show resolved Hide resolved
@sydney-runkle sydney-runkle merged commit f4a0675 into main Aug 22, 2024
29 checks passed
@sydney-runkle sydney-runkle deleted the better-warning-for-missing-field branch August 22, 2024 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected serializer warning for Union with discriminator
3 participants