-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Description
Description
When i try to generate JAVA17/jakarta compatible Code with the jaxrs-cxf-client generator i get jakarta imports due to the property <useJakartaEe>true</useJakartaEe>, but i still get imports for swagger2, e.g.
import io.swagger.jaxrs.PATCH; which references javax.ws.rs.HttpMethod.
How can i generate Code for Swagger 3
openapi-generator version
I use the openapi-generator version 7.9.0 with openapi-generator-maven-plugin to generate the client code
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>7.9.0</version>
<configuration>
<configOptions>
<oas3>true</oas3>
<useSpringController>true</useSpringController>
<useJakartaEe>true</useJakartaEe>
<useSpringBoot3>true</useSpringBoot3>
<sourceFolder>src/main/java</sourceFolder>
<annotationLibrary>none</annotationLibrary>
</configOptions>
</configuration>
<executions>
<execution>
<id>petstore</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/petstore.yaml</inputSpec>
<generatorName>jaxrs-cxf-client</generatorName>
<generateSupportingFiles>false</generateSupportingFiles>
</configuration>
</execution>
<executions>
OpenAPI declaration file content or url
I use the petstore example from OpenAPISpecification https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.0/petstore.yaml
This results in the following Code
package org.openapitools.api;
import org.openapitools.model.Error;
import org.openapitools.model.Pet;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
import jakarta.ws.rs.;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.MediaType;
import org.apache.cxf.jaxrs.ext.multipart.;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ApiResponse;
import io.swagger.jaxrs.PATCH;
/**
- Swagger Petstore
-
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*/
@path("/pets")
@Api(value = "/", description = "")
public interface PetsApi {
...
which still contains imports to io.swagger.jaxrs and no imports to io.swagger.v3.oas or org.apache.cxf.jaxrs.ext