Skip to content

INTER-2061: Update OpenAPI Generator from v7.16.0 to v7.24.0 - #37

Merged
kevinmia merged 6 commits into
mainfrom
chore/INTER-2061-bump-openapi-generator
Aug 3, 2026
Merged

INTER-2061: Update OpenAPI Generator from v7.16.0 to v7.24.0#37
kevinmia merged 6 commits into
mainfrom
chore/INTER-2061-bump-openapi-generator

Conversation

@kevinmia

@kevinmia kevinmia commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Bumps the openapi-generator Gradle 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:

  • Bump the generator version, along with a template fix to avoid a default-value regression it introduces
  • Adds 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" section

Validation:

  • Build + tests pass on Java 11/17/21/25
  • CI checks pass

@kevinmia

kevinmia commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

Upstream Java generator template diff: v7.16.0 to v7.24.0

Diffed 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 getErrorEntity(), which deserializes the error body into a typed model instead of leaving it as a raw JSON string. Had to port this by hand since our overrides don't pick up upstream template changes automatically. Also swapped upstream's raw GenericType for GenericType<?>, since our -Werror build doesn't allow raw types.

This seems worth doing as every error response in our spec maps to the same ErrorResponse model, which already exists, but ApiException never exposed it. Leading to customers needing to manually parse the JSON themselves. With this change, they can just call getErrorEntity() and get the parsed object directly.

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 $ref (as opposed to being declared inline). That hits Event.tags and Event.labels specifically. Both would go from an empty collection to null, which was causing our tests to fail after we bumped the generator version.

Everything else: checked, no action needed

  • modelEnum.mustache / modelInnerEnum.mustache: minor cleanup plus a new @Deprecated option upstream. Our override already diverges here and we don't have any deprecated enums yet, so it doesn't apply
  • RFC3339JavaTimeModule.mustache / JSON.mustache: all Jackson 3 support, behind a flag we don't set
  • oneof_model.mustache: same Jackson 3 stuff, plus one real fix (ctxt.readTree(jp) instead of jp.readValueAsTree()) that isn't gated by the flag. Doesn't matter for us though: our one oneOf (EventRuleAction) is discriminated, so it's generated by oneof_interface.mustache instead. Checked: nothing in sdk/src/main/java/com/fingerprint/v4/model/ uses the pattern this template produces

@mcnulty-fp mcnulty-fp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. :)

Comment thread .changeset/bump-openapi-generator.md Outdated
Comment thread template/libraries/jersey3/apiException.mustache Outdated
Comment thread template/libraries/jersey3/ApiClient.mustache Outdated
Comment thread template/libraries/jersey3/api.mustache Outdated
Comment thread template/README.mustache Outdated
@kevinmia
kevinmia requested a review from mcnulty-fp July 31, 2026 23:05
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Following releases will be created using changesets from this PR:

java-sdk@8.5.0

Minor Changes

  • events: Add active_call smart signal to Event (7db9079)
  • sdk: Add ApiException.getErrorEntity(), which automatically deserializes error response bodies into their typed model (e.g. ErrorResponse) when available. (1eea89d)
  • events: Add keyboard_layout_hash to RawDeviceAttributes (7db9079)
  • events: Add battery_charging field to RawDeviceAttributes (7db9079)

Patch Changes

  • dependencies: Bump Jersey, Jackson, and jakarta-annotation-api to their latest compatible versions (40f7ee3)

@mcnulty-fp mcnulty-fp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for making those changes!

@kevinmia
kevinmia merged commit e22fd0d into main Aug 3, 2026
22 of 24 checks passed
@kevinmia
kevinmia deleted the chore/INTER-2061-bump-openapi-generator branch August 3, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants