Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2901
Closed
Open
Issue created May 15, 2019 by Administrator@rootContributor

remove unused import org.openapitools.jackson.nullable.JsonNullable from generated model

Created by: pellyadolfo

Bug Report Checklist

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

When I generate the model there is an unused import org.openapitools.jackson.nullable.JsonNullable; in every single DTO. It forces me to add a dependency.

	<dependency>
	    <groupId>org.openapitools</groupId>
	    <artifactId>jackson-databind-nullable</artifactId>
	    <version>0.1.0</version>
	</dependency>

Unfortunately this dependency must be approved in the company so the model is unusable.

Is there any way to get rid of this unused import? Configuration is below:

		<plugin>
		    <groupId>org.openapitools</groupId>
		    <artifactId>openapi-generator-maven-plugin</artifactId>
		    <version>4.0.0</version>
		    <executions>
		        <execution>
		            <goals>
    			        <goal>generate</goal>
    			    </goals>
        			<configuration>
				<inputSpec>${maven.multiModuleProjectDirectory}/api/target/generated/swagger-api-spec/swagger.json</inputSpec>	
					<language>spring</language>
					<library>spring-boot</library>
					<model-name-prefix>Cqrs</model-name-prefix>
					<modelPackage>com.anthem.specialty.provider.springapi.model</modelPackage>
					<apiPackage>com.anthem.specialty.provider.springapi.api</apiPackage>
					<invokerPackage>com.anthem.specialty.provider.springapi.invoker</invokerPackage>
        			    <skipValidateSpec>true</skipValidateSpec>
					<generateSupportingFiles>true</generateSupportingFiles>
					<supportingFilesToGenerate>
						ApiApi.java,ApiApiControler.java,ApiUtil.java
					</supportingFilesToGenerate>
        			    <configOptions>
					<sourceFolder>src/gen/java/main</sourceFolder>
					<java8>false</java8>
					<dateLibrary>java8</dateLibrary>
					<interfaceOnly>false</interfaceOnly>
					<groupId>com.company</groupId>
					<artifactId>${project.artifactId}</artifactId>
					<artifactVersion>${project.version}</artifactVersion>
        		    		</configOptions>
        			</configuration>
	        	</execution>
		    </executions>
		</plugin>	
openapi-generator version
		    <groupId>org.openapitools</groupId>
		    <artifactId>openapi-generator-maven-plugin</artifactId>
		    <version>4.0.0</version>
OpenAPI declaration file content or url

probably convenient enhancement

Command line used for generation

maven plugin

Steps to reproduce

run the maven clean install

Related issues/PRs

a few similar issues

Suggest a fix

provide a mechanism to remove unused imports

Assignee
Assign to
Time tracking