Bug Report Checklist
Description
Hi!
While testing the generated client code for the petstore.yaml example, the ApiClient.java code is returning NPEs the first time it tries to create a WebClient reference. More specifically here: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache#L124-L132
Is there a reason to not use this.vertx.getOrCreateContext() instead? The vertx attribute is final. I can send a small PR to fix this, but I'd like to hear from the contributors first.
openapi-generator version
5.0.0
OpenAPI declaration file content or URL
Tested with petstore.yaml simple example.
Generation Details
Here's my plugin configuration:
<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${version.openapi.generator}</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/petstore.yaml</inputSpec>
<generatorName>java</generatorName>
<library>vertx</library>
<configOptions>
<dateLibrary>java8</dateLibrary>
</configOptions>
<apiPackage>${project.groupId}.client</apiPackage>
<modelPackage>${project.groupId}.client</modelPackage>
<invokerPackage>${project.groupId}.client</invokerPackage>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<generateModelDocumentation>false</generateModelDocumentation>
<generateApiDocumentation>false</generateApiDocumentation>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Steps to reproduce
- Generate the Code
- Run the tests with Junit5 and Vertx 3.9.5 (https://vertx.io/docs/3.9.5/vertx-junit5/java/)
Related issues/PRs
There's none
Suggest a fix
Replace Vertx.currentContext with this.vertx.getOrCreateContext()
By the way, I see that the server-side was upgraded to Vertx 4 (#7352). Don't we need to upgrade the client code as well? I can also send a PR for this purpose.
Bug Report Checklist
Description
Hi!
While testing the generated client code for the
petstore.yamlexample, theApiClient.javacode is returning NPEs the first time it tries to create aWebClientreference. More specifically here: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache#L124-L132Is there a reason to not use
this.vertx.getOrCreateContext()instead? Thevertxattribute is final. I can send a small PR to fix this, but I'd like to hear from the contributors first.openapi-generator version
5.0.0
OpenAPI declaration file content or URL
Tested with
petstore.yamlsimple example.Generation Details
Here's my plugin configuration:
Steps to reproduce
Related issues/PRs
There's none
Suggest a fix
Replace
Vertx.currentContextwiththis.vertx.getOrCreateContext()By the way, I see that the server-side was upgraded to Vertx 4 (#7352). Don't we need to upgrade the client code as well? I can also send a PR for this purpose.