Skip to content
Discussion options

You must be logged in to vote

Yes, this is expected behavior.

Examples that you see in Swagger UI are the examples of request body object.

When you don't specify embed=True and this model is only one body parameter you are using, then the whole request body equals to this model. So, FastAPI can use examples of this model for this request body object.

But when you specify embed=True or you are using other body parameters along with this model, the whole request body is not equal to your model. It should be a combination of all models and single parameters. FastAPI can't just use examples of one model as examples of whole request body.

Every example should be now:

"item": {
    "name": "Foo",
    "description": "A very …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
2 participants