Skip to content
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

@ApiResponses tag does not override default responses #1887

Closed
muff1nman opened this issue Jun 25, 2017 · 5 comments
Closed

@ApiResponses tag does not override default responses #1887

muff1nman opened this issue Jun 25, 2017 · 5 comments

Comments

@muff1nman
Copy link

Reading #632 seems to imply that the @ApiResponses annotation, if present should override the default response messages . However it looks like that is not the behavior and reading the code /home/ademaria/.m2/repository/io/springfox/springfox-core/2.7.0/springfox-core-2.7.0-sources.jar!/springfox/documentation/builders/OperationBuilder.java:205 it looks like you only ever merge the response messages. Can you please clarify on desired behavior here? I for one, would like to see @ApiResponses be an override rather than a merge.

@dilipkrish
Copy link
Member

dilipkrish commented Jul 4, 2017

You could use the Docket#useDefaultResponseMessages(false)

@muff1nman
Copy link
Author

Yes, but I was hoping to use that as a last resort since it would require more annotations.

@dilipkrish
Copy link
Member

Could you clarify with an example or may be create a breaking test with how you intend it to work vs. how its working now. Happy to consider a contribution if you think its a feature gap.

@muff1nman
Copy link
Author

Will do.

@lanwen
Copy link

lanwen commented Aug 9, 2017

Example:

@PostMapping(value = "/lists/{env}/{list-id}/emails", produces = APPLICATION_JSON_UTF8_VALUE, consumes = APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "Add new emails to list", response = MailListEntry.class)
public CompletableFuture<Map<String, List<MailListEntry>>> addEmailsToList(@PathVariable String env, @PathVariable("list-id") String listId, @RequestBody List<String> emails) {

But it generates definition:

"Map«string,List«MailListEntry»»": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/List"
}
},

problem is definitions/List which have no real definition. For example it breaks https://github.com/Rebilly/ReDoc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants