swagger-api / swagger-api/swagger-codegen
[JAVA] Maven codegen plugin fails under JDK17 in jknack handlebars library on reflection operation
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I'm building an application that needs to call rest services that are documented with an openapi.yaml file, and I need the API generated by Maven with the swagger-codegen-maven-plugin to be able to easily call and maintain the interface (which is still changing a little on the remote side).
Swagger-codegen version
3.0.29
Swagger declaration file content or url
<plugin>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.29</version>
<configuration>
<inputSpec>${hif.deploy.url}/swagger-ui/openapi.v2.0.yaml</inputSpec>
<configOptions>
<sourceFolder>/</sourceFolder>
</configOptions>
<output>${project.build.directory}/generated-sources/rest-generated/</output>
<language>java</language>
</configuration>
<executions>
<execution>
<id>generate-rest-v2-client</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<language>java</language>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<modelPackage>com.hansencx.hif.rest.v2.swagger.model</modelPackage>
<apiPackage>com.hansencx.hif.rest.v2.swagger.api</apiPackage>
<invokerPackage>com.hansencx.hif.rest.v2.swagger.invoker</invokerPackage>
<inputSpec>${hif.deploy.url}/swagger-ui/openapi.v2.0.yaml</inputSpec>
</configuration>
</execution>
</executions>
</plugin>
Command line used for generation
open JDK 17
Maven 3.6.3
maven clean install
Steps to reproduce
- select any valid openapi 3.0.1 yaml flie
- create a new maven project with a compiler source and target value of 17 and the following dependencies needed for the generated code:
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.6.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.threeten/threetenbp -->
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>okhttp</artifactId>
<version>2.7.5</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>logging-interceptor</artifactId>
<version>2.7.5</version>
</dependency>
<dependency>
<groupId>io.gsonfire</groupId>
<artifactId>gson-fire</artifactId>
<version>1.8.3</version>
</dependency>
- Add the above plugin to the build system, and replace ${hif.deploy.url}/swagger-ui/openapi.v2.0.yaml with the URL of your selected
- run maven clean install
Related issues/PRs
https://github.com/jknack/handlebars.java/pull/893
Suggest a fix/enhancement
Update handlebars-version in the parent pom.xml file from 4.1.2 to 4.3.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the handlebars-version entry in the parent pom.xml and review the related handlebars.java pull request. Run the Maven clean install reproduction on JDK 17; done means the swagger-codegen-maven-plugin completes generation without the reflection failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- handlebars, java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100