-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(java): improve oneOf
types DX
#1990
Conversation
✅ Deploy Preview for api-clients-automation ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✗ The generated branch has been deleted.If the PR has been merged, you can check the generated code on the |
oneOf
types DXoneOf
types DX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small review, I'm waiting for the code to generate, but it looks super cool !
markOneOfChildren(models, model); | ||
generateSealedChildren(models, modelPackage, model); | ||
model.vendorExtensions.put("x-is-one-of", true); | ||
model.vendorExtensions.put("x-one-of-explicit-name", Utils.shouldUseExplicitOneOfName(model.oneOf)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think you can move the function shouldUseExplicitOneOfName
to this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be used also inside Utils
In the legacy clients it was done like this too, we have a ticket to make sure that Maybe we can have a generic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nothing to add except for the generic SearchResult
!
@millotp we have exactly that! in fact, there is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh okay then it's perfect !
🧭 What and Why
Currently, all
oneOf
types are built using a wrapper, even if no wrapper is needed. Also, generics are added foroneOf
types too, although it doesn't make sense, especially if the underlying types are different (e.g., different records from each index).Changes included:
oneOf
types to become interfaces, with concrete implementation when theoneOf
type is a class or enum.@NotNull
to javax@Nonnull