-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
When a method has one or more @ApiResponse the response schema definition is not generated #3870
Comments
Here is a reproducer project |
I've implemented a workaround using instead of Void.class as an empty response marker, an Empty.class created in the annotations module. |
A PR has been submitted with a feasible implementation (#3872). For a given Resource like this:
this is the result:
In this example you can see how by default the same thing is done as when the default response is generated (generating the definition of the response based on its type). This adopted solution avoids to change annotations and add attributes to them but another alternatives can be adopted like add a new attribute to @content annotation that indicate that the schema is not wanted to be included or should be be calculated from return type. Whatever the case, I guess some of the uploaded code can serve as a guide at least or for testing purposes. |
Did you try using @ApiResponses (mind the S, this is plural!)? See #3851 |
Hi @judos, I think so because this is just an example and I usually put multiple apiResponses for every method. But this issue is a bit old, I don't remember. I think that this kind of issue is not a priority for the team or maybe the project are surviving. |
@arielcarrera thanks for reporting this and for your effort in this area. #4129 addresses this by introducing field I will be closing therefore #3872, as possibly the addition of the field above has less impact on existing behavior. |
In a Jax-rs project with Swagger, when a method has one or more @ApiResponse no schema definition is generated.
When there is no @ApiResponse, a default response is generated.
It is desirable to provide a way to generate the schema automatically even if there are defined responses (if the return type is a generic type, it is currently difficult to calculate / define it).
Related issues #3851 and #3723.
Expected behavior:
Given a resource class like this:
And a maven file (pom.xml) with a plugin like this:
Expected result:
Current result:
The text was updated successfully, but these errors were encountered: