You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using openapi 3, the schema inside the responses should be inside a content, then application/json block (or other media type if not application/json).
Openapi response object documentation is here.
☝🏻 If I've missed some configuration that allows to do this, my apologies!
Code to reproduce the issue
We define a route to list pets.
We configure the app to use openapi 3.
Summary
When using openapi 3, the
schema
inside theresponses
should be inside acontent
, thenapplication/json
block (or other media type if notapplication/json
).Openapi response object documentation is here.
☝🏻 If I've missed some configuration that allows to do this, my apologies!
Code to reproduce the issue
We define a route to list pets.
We configure the app to use openapi 3.
petsbp.py
:server.py
:Results
Expected behavior
Generated schema:
Zoom in on the 200 response only:
Note that the
schema
appears inside a blockapplication/json
, which is insidecontent
, which is inside200
.Swagger ui:
Note that we have an example value and schema.
Actual behavior:
Generated schema:
Zoom in on the 200 response only:
Note that the
schema
is a direct child of200
.Swagger UI:
Note there's no example value or schema.
Possible workarounds
Workaround 1 - specify the schema in
@doc
, don't use@use_marshal
.Use
@doc
to specify the response. Don't use@use_marshal
:Workaround 2 - use a custom converter
server.py
:The text was updated successfully, but these errors were encountered: