Skip to content

FastAPI (0.101.0) Broke OpenAPI naming #10019

Answered by tiangolo
syniex asked this question in Questions
Discussion options

You must be logged in to vote

Yep, so this is actually intentional. 😅

There was a lot of work from the Pydantic side and here to make it work this way... let me explain.

The idea is that an input model can have fields that are not required if they have default values.

But if you return that same model, because it will always have a value (if you don't provide one it will have the default value), then the clients could expect that it will always have a value. Nevertheless, this was not reflected in OpenAPI up to now. The way to do that is by saying that the response model with a field that has a default value is required.

This is in particular useful if you are autogenerating client code/SDKs, because now that code wil…

Replies: 7 comments 12 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@dmontagu
Comment options

@tiangolo
Comment options

Comment options

You must be logged in to vote
8 replies
@dmontagu
Comment options

@commonism
Comment options

@commonism
Comment options

@tiangolo
Comment options

@jcphlux
Comment options

Comment options

You must be logged in to vote
1 reply
@commonism
Comment options

Answer selected by syniex
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@fredrikaverpil
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
8 participants