-
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
Support of multiple @ApiResponse with the same HTTP code #3379
Comments
In you case @ApiResponse(code = 400, message = "Login fail by wrong ID"), @ApiOperation(value = "Process request for login by user", response = Iterable.class) This will display all the three messages under 400 |
@pavan-eidiko If it is impossible to adapt the modification, the duplicated usage of @ApiResponse which I suggest, then your recommendation would be the best. I appreciate it! I will follow your suggestion right away. However, I will not close this issue on my own. I still want to check the modification does make sense to the contributers. I will still make it open so I can hear any news in the future. |
@Garamda I'm afraid the OpenAPI specification does not allow you to specify the same HTTP Code multiple times with different messages. You can technically support different response types for a single code, but not multiple descriptions. This is a spec restriction and there's no real way for us to overcome it. I think that if we appended the strings ourselves, it would end up giving a surprising result to the users, making them think there's a bug here. |
@webron Now I fully understand. I didn't know that Swagger is based on OpenAPI spec. I appreciate your kind explanation. Since the member of Swagger project fully explained why the suggestion can't be accepted, I'll close this issue. I appreciate it again. |
I want to make API spec doc which can have multiple @ApiResponse with the same HTTP code, like below.
This would be useful as many users want (you can check here, kongchen/swagger-maven-plugin#199)
If this feature becomes available in swagger-core, it would be applied to any plugins.
If it seems that it does not many sense, please give a comment.
I appreciate it in advance.
The text was updated successfully, but these errors were encountered: