Duplicate records if Class and Operation both has @Path param
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 25.9k
- Forks
- 2.4k
- Avg merge
- 13h 10m
- Merged PRs (30d)
- 4
Description
Hi,
I have an API where the class and operation both has @Path annotation ( @Path("/{id}") ) as shown in following interface example. @Path("/v1.0/private/communications") and @Path("/{id}")
Interface :
@Tag(name = "CommunicationsAPI")
@Path("/v1.0/private/communications")
public interface CommunicationsAPI extends CommonJsonAPI {
@GET
@Path("/{id}")
CommunicationDetails getCommunicationDetails(
@Parameter(name = "id", description = "Number which uniquely identifies the Communication.")
@PathParam("id") String communicationId
);
}
Implementation class :
@Path("/")
public class CommunicationsAPIImpl implements CommunicationsAPI {
public CommunicationDetails getCommunicationDetails( String communicationId ) {
}
}
When I generate the openapi.json / openapi.yaml using swagger-maven-plugin-jakarta plugin, the generated JSON / YAML has got two entries.
Open API JSON :
"/v1.0/private/communications/{id}" : {
"get" : {
"tags" : [ "CommunicationsAPI" ],
"summary" : "This API returns details of a communication by id.",
"/{id}" : {
"get" : {
"tags" : [ "CommunicationsAPI" ],
"summary" : "This API returns details of a communication by id.",
I think because of this it appears two times in API docs :
I need only "/v1.0/private/communications/{id}" , and "/{id}" should not be visible.
Wondering if there is a configuration to show only one with with full path ?
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 reproducing the supplied CommunicationsAPI example and inspect the generated OpenAPI document to confirm whether both paths are present before Redoc renders it. Then trace how Redoc handles these two path entries; done means determining whether Redoc can hide the shorter path or documenting that the duplicate must be corrected by the generator.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100