pydantic-core
pydantic-core copied to clipboard
Replace `SchemaFilter` on `TypedDictSerializer`
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
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,
Feel free to submit that PR, if you still have it!