swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

Forbid mutliple `@ApiResponse` annotations with the same response code

Open jochenberger opened this issue 9 months ago • 1 comments

The response code it the key in a map, e.g.

{
	"responses": {
		"200": {
			"description": "Person loaded",
			"content": ...
		},
		"404": {
			"description": "Person not found",
			"content": ...
		}
	}
}

See also https://swagger.io/docs/specification/v3_0/describing-responses/

So, if a method is annotated with multiple @ApiResponse annotations that define the same responseCode, it is not clear what should happen. It would be nice if that was prevented by the library.

jochenberger avatar Jan 30 '25 09:01 jochenberger