Fix #6157: Updated native template to fix null async return (#6168)

* Fix #6157: Updated native template to fix null async return

Should fix issue: https://github.com/OpenAPITools/openapi-generator/issues/6157

* fixed uncaught json exception in java native api gen

* cleaning up

Co-authored-by: Luis Ballabeni <luis.ballabeni@lexisnexis.com>
This commit is contained in:
Luis Ballabeni 2020-05-05 01:40:22 -04:00 committed by GitHub
parent 90ff4926b9
commit 30ee3f343e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -180,14 +180,18 @@ public class {{classname}} {
localVarResponse.body()) localVarResponse.body())
); );
} else { } else {
try {
return CompletableFuture.completedFuture( return CompletableFuture.completedFuture(
{{#returnValue}} {{#returnType}}
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {}) memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {})
{{/returnValue}} {{/returnType}}
{{^returnValue}} {{^returnType}}
null null
{{/returnValue}} {{/returnType}}
); );
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
} }
}); });
{{/asyncNative}} {{/asyncNative}}