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

Replace `SchemaFilter` on `TypedDictSerializer`

Open samuelcolvin opened this issue 2 years ago • 2 comments

We currently store a SchemaFilter on TypedDictSerializer and use that to exclude fields, we should instead use an exclude bool on TypedDictField to avoid unnecessary hashing.

https://github.com/pydantic/pydantic-core/blob/cd5cd657cc8a57f6310b3fbb19d9657136087eec/src/serializers/type_serializers/typed_dict.rs#L70

samuelcolvin avatar Apr 02 '23 18:04 samuelcolvin

I've looked into this a bit, as a side-effect of this change the SchemaFilter::filter method should be (almost) duplicated in TypedDictSerializer to filter include and exclude. If that is acceptable I will submit the PR.

aminalaee avatar Apr 06 '23 11:04 aminalaee

@aminalaee,

Feel free to submit that PR, if you still have it!

sydney-runkle avatar Aug 16 '24 18:08 sydney-runkle