Redocly / Redocly/redoc

Duplicate records if Class and Operation both has @Path param

Open
#2,730 1 comment 0 reactions 0 assignees View on GitHub

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 :

Image Image Image

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 ?

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.