-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
Hi,
I have an API where we specify Path param ( @path("/{id}") ) as shown in following example.
When I generate the openapi.json / openapi.yaml using swagger-maven-plugin-jakarta plugin, the generated JSON / YAML has got two entries which also appears in swagger UI.
I need only "/v1.0/private/communications/{id}" and "/{id}" should not be created. Wondering if this is a bug or I need to change something to achieve this ?
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 ) {
}
}
Open API JSON :
Should have only "/v1.0/private/communications/{id}" and not "/{id}"
"/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.",( POM ) :
<plugin>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-maven-plugin-jakarta</artifactId>
<version>2.2.30</version>
<dependencies>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2-jakarta</artifactId>
<version>2.2.28</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>resolve</goal>
</goals>
</execution>
</executions>
<configuration>
<outputFileName>openapi</outputFileName>
<outputFormat>JSONANDYAML</outputFormat>
<encoding>UTF-8</encoding>
<prettyPrint>true</prettyPrint>
<readAllResources>false</readAllResources>
<openapi31>false</openapi31>
<configurationFilePath>${project.basedir}/src/main/resources/openapi-configuration.json</configurationFilePath>
<outputPath>${project.build.outputDirectory}/static</outputPath>
<resourcePackages>
<package>com.xxx.xxx</package>
</resourcePackages>
<defaultResponseCode>true</defaultResponseCode>
<alwaysResolveAppPath>true</alwaysResolveAppPath>
</configuration>
</plugin>Metadata
Metadata
Assignees
Labels
No labels
