Skip to content

XML import generated even if withXml option is set to false (jaxrs-cxf-cdi generator) #940

@acommuni

Description

@acommuni
Description

When using maven openapi generator with configuration : false

Model and API generated files contains the following import : import javax.xml.bind.annotation.*;

javax.xml.bind is depracted since Java 9

openapi-generator version

Version 3.2.2

OpenAPI declaration file content or url

Any

Command line used for generation

Here is the plugin configuration

<plugin>
				<groupId>org.openapitools</groupId>
				<artifactId>openapi-generator-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>server-generation</id>
						<goals>
							<goal>generate</goal>
						</goals>
						<configuration>
							<inputSpec>${project.basedir}/src/main/api/ebooks.yaml</inputSpec>
							<validateSpec>true</validateSpec>
							<generatorName>jaxrs-cxf-cdi</generatorName>
							<generateSupportingFiles>false</generateSupportingFiles>
							<generateApiDocumentation>true</generateApiDocumentation>
							<generateModelDocumentation>true</generateModelDocumentation>
							<withXml>false</withXml>
							<configOptions>
								<sourceFolder>src/main/java</sourceFolder>
								<java8>true</java8>
								<dateLibrary>java8</dateLibrary>
								<useBeanValidation>true</useBeanValidation>
								<returnResponse>true</returnResponse>
								<generatePom>true</generatePom>
								<modelPackage>ebooks.api.model</modelPackage>
								<apiPackage>ebooks.api</apiPackage>
								<invokerPackage>ebooks.api.invoker</invokerPackage>
							</configOptions>
						</configuration>
					</execution>
					<execution>
						<id>client-generation</id>
						<goals>
							<goal>generate</goal>
						</goals>
						<configuration>
							<inputSpec>${project.basedir}/src/main/api/ebooks.yaml</inputSpec>
							<validateSpec>true</validateSpec>
							<generatorName>jaxrs-cxf-client</generatorName>
							<generateSupportingFiles>false</generateSupportingFiles>
							<generateModels>false</generateModels>
							<withXml>false</withXml>
							<configOptions>
								<sourceFolder>src/main/java</sourceFolder>
								<java8>true</java8>
								<dateLibrary>java8</dateLibrary>
								<useBeanValidation>true</useBeanValidation>
								<useGenericResponse>true</useGenericResponse>
								<modelPackage>ebooks.api.model</modelPackage>
								<apiPackage>ebooks.api</apiPackage>
								<invokerPackage>ebooks.api.invoker</invokerPackage>
							</configOptions>
						</configuration>
					</execution>
				</executions>
			</plugin>
Steps to reproduce

Generate api with maven : mvn clean install

Suggest a fix/enhancement

The template for jaxrs-cxf-client / jaxrs-cxf-cdi should have a condition on imports

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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