INTER-2061: Update OpenAPI Generator from v7.16.0 to v7.24.0 - #37
Conversation
Upstream Java generator template diff: v7.16.0 to v7.24.0Diffed all 15 templates we override against the ones bundled with openapi-generator at both versions. 9/15 changed upstream api.mustache, ApiClient.mustache, apiException.mustache: adopted private String responseBody = null;
+ private transient Object errorEntity = null;
+
+ public Object getErrorEntity() {
+ return errorEntity;
+ }7.24.0 added This seems worth doing as every error response in our spec maps to the same pojo.mustache: needed a fix- private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
+ private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{^defaultValue}}{{#isArray}} = new ArrayList<>(){{/isArray}}{{#isMap}} = new HashMap<>(){{/isMap}}{{/defaultValue}};7.24.0 stops setting a default value for optional container fields that come from a Everything else: checked, no action needed
|
mcnulty-fp
left a comment
There was a problem hiding this comment.
Thanks for working on this!
The errorEntity addition is useful but hopefully it's possible to improve on the templates to provide a better DX for it. :)
# Conflicts: # gradle/libs.versions.toml
🚀 Following releases will be created using changesets from this PR:java-sdk@8.5.0Minor Changes
Patch Changes
|
mcnulty-fp
left a comment
There was a problem hiding this comment.
Looks good, thanks for making those changes!
Bumps the
openapi-generatorGradle dependency from 7.16.0 to 7.24.0, as part of ecosystem recurrent care.This surfaced a regression in generated model defaults, with the appropriate fix made in this PR. It also surfaced an upstream feature for typed error responses, which is adopted here.
Changes:
ApiException.getErrorEntity(), which deserializes error responses into a typed model (e.g.ErrorResponse) instead of a raw JSON string. Purely additive, documented in a new README "Handling errors" sectionValidation: