Skip to content

[BUG][jaxrs-cxf] Wrong imports (io.swagger.annotations) #3668

@davidkarlsen

Description

@davidkarlsen

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [] [Optional] Bounty to sponsor the fix (example)
Description

Generating code with <generatorName>jaxrs-cxf-extended</generatorName> or <generatorName>jaxrs-cxf</generatorName> create invalid imports: io.swagger.annotations, as the speclevel of my api is 3.0.0 it should use io.swagger.v3.oas.annotations

openapi-generator version

4.1.0

OpenAPI declaration file content or url

Cannot disclose

Command line used for generation
 <plugin>
        <groupId>org.openapitools</groupId>
        <artifactId>openapi-generator-maven-plugin</artifactId>
        <version>${openapi-generator-version}</version>
        <executions>
          <execution>
            <id>generate</id>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <inputSpec>${project.basedir}/src/main/resources/META-INF/resources/api-v1.yaml</inputSpec>
              <strictSpec>true</strictSpec>
              <generatorName>jaxrs-cxf-extended</generatorName>
              <generateSupportingFiles>false</generateSupportingFiles>
              <generateApiTests>false</generateApiTests>
              <generateModelDocumentation>false</generateModelDocumentation>
              <withXml>true</withXml>
              <!-- https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/jaxrs-cxf.md -->
              <configOptions>
                <!-- important to add this or else codegen is malfunctioning: -->
                <sourceFolder>src/gen/java/main</sourceFolder>
                <interfaceOnly>true</interfaceOnly>
                <useJackson>true</useJackson>
                <dateLibrary>java8</dateLibrary>
                <serializableModel>true</serializableModel>
                <java8>true</java8>
                <booleanGetterPrefix>is</booleanGetterPrefix>
                <useBeanValidation>true</useBeanValidation>
              </configOptions>
              <modelPackage>com.evry.fs.arch.icpautomate.api.v1.model</modelPackage>
              <apiPackage>com.evry.fs.arch.icpautomate.api.v1.api</apiPackage>
            </configuration>
          </execution>
        </executions>
      </plugin>
Steps to reproduce

Configure plugin as described, feeding it a speclevel 3 api description

Related issues/PRs
Suggest a fix

use the updated package path in the templates

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions