swagger-api / swagger-api/swagger-core
[Feature/Bug] Forbid mutliple `@ApiResponse` annotations with the same response code
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 7.5k
- Forks
- 2.3k
- Avg merge
- 18h 1m
- Merged PRs (30d)
- 10
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating how repeated @ApiResponse annotations are processed and how response codes become the OpenAPI responses map. Determine the intended behavior for duplicate responseCode values, then verify that methods with duplicates are prevented or rejected consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100