pydantic / pydantic-core

Core validation logic for pydantic written in rust
MIT License
1.4k stars 232 forks source link

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

Closed sydney-runkle closed 1 month ago

sydney-runkle commented 1 month ago

Fix https://github.com/pydantic/pydantic/issues/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:

codspeed-hq[bot] commented 1 month ago

CodSpeed Performance Report

Merging #1415 will not alter performance

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

Summary

✅ 155 untouched benchmarks

BoxyUwU commented 1 month ago

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