Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use serialization aliases for responses in OpenAPI schema #1162

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

camuthig
Copy link

When generating JSON schemas from the Pydantic types, the mode must be set in order for the correct aliases to be used. The default is to generate the schema for validation mode, which means that for building response schemas, the mode needs to be explicitly set to serialization.

This fixes issues I brought up in discussion #1132

When generating JSON schemas from the Pydantic types, the `mode` must be
set in order for the corret aliases to be used. The default is to
generate the schema for validation mode, which means that for building
response schemas, the mode needs to be explicitly set to serialization.
@pmdevita
Copy link

This might be the same thing as #1139

@camuthig
Copy link
Author

@pmdevita thanks for calling that out. There is some duplication here in that both pulls depend on leveraging the mode argument in model_json_schema. However, the other issue/pull request are also tackling a more nuanced issue around definition of "required" field.

I'm open to closing the pull request, but considering the other one is also facing some open questions of backwards compatibility, I don't want to slow down this fix because of those unrelated topics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants