Skip to content

[Pydantic 2 only] Serialize query lookups with pydantic_core based on the provided schema #43

@surenkov

Description

@surenkov

Since Pydantic v2, it looks feasible to walk through the what-is-called CoreSchema, which is used by pydantic_core to perform the data validation/serialization.

This opens up the door to get rid of DjangoJSONEncoder, which the only responsibility left in 0.3.* is to serialize lookup parameters. It's still not possible to perform a partial model serialzation right out of the box (especially if we're talking about nested schemas), but at least now we could traverse inner structure through the model's core schema, extract particular schema definition for the lookup and perform a serialization with it.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions