Swagger - Springfox always generates some response messages (401,403...) by default. How can I remove them?
You should be able to set up the plugin to not use the default response messages. Follow below instructions for different versions.
For 1.0.2 or prior
new SwaggerSpringMvcPlugin(...)
//More config
.useDefaultResponseMessages(false) //<-- this should be false
...;
For 2.x
new Docket()
//More config
.useDefaultResponseMessages(false) //<-- this should be false
...;
In addition to using
new Docket().useDefaultResponseMessages(false)
you may also need to use this annotation depending on the status code you want to return:
@ResponseStatus(HttpStatus.CREATED)
⚠️ Don't use ResponseEntity
with WebFlux as that will always add the 200 code. See this github issue.