OpenAPI and API operations response with schema #29709
Unanswered
sombraglez
asked this question in
Q&A
Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have found an unexpected behavior using OpenAPI in combination with API operations which include a schema definition:
By the following POST operations, the resulting OpenAPI do not contain any schema into the generated post responses:
the corresponding generated OpenAPI definition does not include the defined response schema:
or with:
the generated response into the OpenAPI definition looks similar (without schema into the response):
But by adding a content type into the API operation definition (using for example
@Produces(MediaType.APPLICATION_JSON)
), the generated response contains the configured schema. For example:As I understand, the annotation
@Produces(MediaType.APPLICATION_JSON)
was not longer explicitly expected in the API operations definition.But in the case of an REST End-Point returning a generic
Response
and combined with a schema definition , what I understand for the generated OpenAPI above, we are forced to use the annotation@Produces(MediaType.APPLICATION_JSON)
Summing up: is this behavior from your point of view expected or there is an issue related to my use case?
Beta Was this translation helpful? Give feedback.
All reactions