Open cteichFirma opened 1 month ago
After a quick look it seems to not be supported yet(might fix it myself if i get the time) , if you want to learn more about the jaxrs-cxf-client generator you can take a look here https://openapi-generator.tech/docs/generators/jaxrs-cxf-client.
If you are willing to tinker with the source code, you can modify the appropriate templates in the jaxrs folder and then generate the code you need using the CLI.
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 referencesjavax.ws.rs.HttpMethod
. How can i generate Code for Swagger 3openapi-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;
/**
*/ @Path("/pets") @Api(value = "/", description = "") public interface PetsApi { ...
which still contains imports to
io.swagger.jaxrs
and no imports toio.swagger.v3.oas
ororg.apache.cxf.jaxrs.ext