-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance pydantic model schema generation
- For pydantic based models, enhance the open api schema generation by differntiating between "validation" and "serialization" models. - The default mode used by the pydantic TypeAdapter when generating JSON schemas is a "validation" schema. - Add an additional option to the `model_schema` called `schema_mode` that will execute the TypeAdapter schema generation in the selected mode. - When generating Open API paths for response models, change the schema_mode to "serialization" instead of "validation". This allows us to use models that have custom fields (e.g. computed fields or custom serialization logic) to be correctly converted to an Open API schema.
- Loading branch information
Showing
2 changed files
with
8 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters