Bug Report Checklist
Description
Failed to build the client generated on Java11 with null async return via mvn. Please see below for detail.
openapi-generator version
Tried the both openapi-generator 4.3.0 and 5.0.0
OpenAPI declaration file content or url
I am able to reproduce the issue with petstore.yaml provided by openapi-generator
Command line used for generation
openapi-generator generate -g java --library native -p asyncNative=true
Steps to reproduce
git clone to get the latest source of openapi-generator (5.0.0);
mvn clean installto build the modules of openapi-generator;
- launch the command to generate the client of petstore
templateDir=<openapi-generator folder>/modules/open-apigenerator/src/main/resources/Java/libraries/native
apiSpecFile=/<openapi-generator folder>/modules/openapi-generator/src/test/resources/3_0/petstore.yaml
openapi-generator generate -g java --library native -p asyncNative=true -t $templateDir $apiSpecFile -o myclient
- check
myclientgenerated, failed to compile with mvn clclean install, got errors:
[ERROR] myclient/src/main/java/org/openapitools/client/api/PetApi.java:[164,17] exception java.io.IOException is never thrown in body of corresponding try statement
[ERROR] myclient/src/main/java/org/openapitools/client/api/PetApi.java:[433,17] exception java.io.IOException is never thrown in body of corresponding try statement
Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/pull/6168/files#diff-d348a3a8a0ce0b350a361a7d81856de3R192-R194
Suggest a fix
{{#returnType}}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
{{/returnType}}{{^returnType}}
return CompletableFuture.completedFuture(null);
{{/returnType}}
Bug Report Checklist
Description
Failed to build the client generated on Java11 with null async return via
mvn. Please see below for detail.openapi-generator version
Tried the both openapi-generator 4.3.0 and 5.0.0
OpenAPI declaration file content or url
I am able to reproduce the issue with
petstore.yamlprovided by openapi-generatorCommand line used for generation
openapi-generator generate -g java --library native -p asyncNative=true
Steps to reproduce
git cloneto get the latest source of openapi-generator (5.0.0);mvn clean installto build the modules of openapi-generator;myclientgenerated, failed to compile withmvn clclean install, got errors:Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/pull/6168/files#diff-d348a3a8a0ce0b350a361a7d81856de3R192-R194
Suggest a fix