chore: update templates to improve oneOf support#22
Merged
Conversation
- Update the API template to support optional query parameters that alias one another. This will allow `start` and `end` to be split into two parameters, one for each type of value supported for the query parameters: a `int64` UNIX milliseconds timestamp and a `date-time` string.
- Update the `oneof_model` template to handle the case where a `oneOf` construct does not use a `discriminator`. This case occurs when a `oneOf` construct is used with a query parameter. The generated model is a wrapper around a generic Object value that can take on a type for each schema in the `oneOf`'s schemas.
There was a problem hiding this comment.
Pull request overview
Updates the custom OpenAPI Generator Jersey3 templates to improve oneOf support for query parameters (including non-discriminator oneOf) and to support aliased optional query parameters (e.g., splitting start/end into both unix-ms and RFC3339 variants while keeping backward compatibility).
Changes:
- Extend
api.mustacheoptional-parameter generation with alias-aware getters/setters and query key mapping. - Add a non-discriminator
oneOfwrapper class path tooneof_model.mustache(serializer/deserializer-based wrapper around a genericObject).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| template/libraries/jersey3/oneof_model.mustache | Adds generation for oneOf models without a discriminator via a wrapper + Jackson (de)serializer. |
| template/libraries/jersey3/api.mustache | Adds optional query param aliasing behavior and adjusts query param naming for aliased parameters. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add missing semicolons in nullable param branches - Fix infinite recursion in serialization - Add missing import
Contributor
pnpm exec changesetto create a changeset. |
Contributor
Author
|
NOTE: the functional test failures are due to a known, unrelated issue |
ilfa
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
startandendto be split into two parameters, one for each type of value supported for the query parameters: aint64UNIX milliseconds timestamp and adate-timestring.This update allows RFC3339 timestamps to be supported while maintaining backward-compatibility. When code is generated with the v4 normalized schema that splits
startandendinto multiple, aliased parameters, here's the diff for FingerprintApi.java:oneof_modeltemplate to handle the case where aoneOfconstruct does not use adiscriminator. This case occurs when aoneOfconstruct is used with a query parameter. The generated model is a wrapper around a generic Object value that can take on a type for each schema in theoneOf's schemas.This update lays the groundwork for consolidating
start/start_date_timeandend/end_date_timeback into a single parameter when the next major release occurs. Here's the diff for the new SearchEventsStartParameter model that would be generated when using the standard v4 schema: