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
  • Merge requests
  • !1179

[Spring] fix <async>false</async> in the Maven plugin

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/raghuraman1/openapi-generator_issues_1164_fix into master Oct 05, 2018
  • Overview 0
  • Commits 4
  • Pipelines 0
  • Changes 1

Created by: raghuraman1

Hi, I am using the openapi-generator-maven-plugin with these versions: 3.3.1-SNAPSHOT (thats master ). I came across this bug. Please see code snippet below of the pom.xml alongwith my suggestions for the fix..

I have also noted another smaller issue unrelated to this. Thanks. R Please note value of asynch: false.

            <plugin>
                          <groupId>org.openapitools</groupId>
			<artifactId>openapi-generator-maven-plugin</artifactId>
			<version>${openapi.codegen.version}</version>
			<executions>
				<execution>
					<id>common</id>
					<goals>
						<goal>generate</goal>
					</goals>
					<configuration>
                                              <inputSpec>${project.basedir}/src/main/resources/api.yaml</inputSpec>
						<modelPackage>com.example.api.models</modelPackage>
						<apiPackage>com.example.api</apiPackage>
						<output>${project.basedir}</output>					
						<language>spring</language>
						<invokerPackage>com.example.api</invokerPackage>
						<basePackage>com.example.api</basePackage>
						<withXml>true</withXml>
						<configOptions>
						
							<artifactId>foo</artifactId>
							<artifactDescription>Test API</artifactDescription>
							<title>Test API</title>
							<artifactUrl>https://api.example.com</artifactUrl>
							<groupId>com.example.api</groupId>
							<artifactVersion>1</artifactVersion>								
							<sourceFolder>src/gen/java/main</sourceFolder>
							<serializableModel>true</serializableModel>
							<dateLibrary>java8</dateLibrary>
							<java8>true</java8>
							<async>false</async>
							<library>spring-boot</library>		
							<delegatePattern>true</delegatePattern>
							<useBeanValidation>true</useBeanValidation>
							<useOptional>true</useOptional>	
							<hideGenerationTimestamp>true</hideGenerationTimestamp>								
						</configOptions>							
					</configuration>
				</execution>
			</executions>
		</plugin>

`

For the above configuration in openapi-generator\modules\openapi-generator\src\main\resources\JavaSpring\methodBody.mustache an expression of {{#async}}CompletableFuture.completedFuture({{/async}} should resolve to empty. Unfortunately : In openapi-generator\modules\openapi-generator\src\main\java\org\openapitools\codegen\DefaultGenerator.java the value of async in this.config.additionalProperties() is a string and not a boolean.

This causes wrong code generation.

I am providing a immediate fix for this: Please see the code difference in openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/raghuraman1/openapi-generator_issues_1164_fix