Skip to content

Duplicate records if Class and Operation both has @Path param #2730

@bharattomar

Description

@bharattomar

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions