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
Support adding marker interface to oneOfs. #273
Conversation
25d8a7e
to
65495e2
Compare
@pschichtel I have started using the Possibly I should make it the default behaviour in a version soon. This PR extends support even more for a different use case I have. |
@param:JsonProperty("state") | ||
@get:JsonProperty("state") | ||
@get:Valid | ||
public val state: State? = null, |
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.
Here I am not sure whether to reference State when the Polymorphic annotations are missing, or whether I should have it set to Any to ensure deserialisation is not broken
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.
Nor I. Well, the model generated is correct but having a model that fails at deserialization defeats the purpose 🤔 I'd slightly lean for Any
, but I'm on the fence.
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.
OK, changed to Any. That at least preserves the existing behaviour better. If anyone comes looking for it, we can add a new configuration option to allow them to opt-in
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.
Gotcha! 👍
@param:JsonProperty("state") | ||
@get:JsonProperty("state") | ||
@get:Valid | ||
public val state: State? = null, |
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.
Nor I. Well, the model generated is correct but having a model that fails at deserialization defeats the purpose 🤔 I'd slightly lean for Any
, but I'm on the fence.
While the discriminator property is needed to enable full polymorphism with Jackson, it should not be a blocker to applying the sealed interface to classes that deserve it. This PR makes a first attempt at allowing the interface to be applied, without the Jackson polymorphism annotations
01b8b5f
to
54967df
Compare
While the discriminator property is needed to enable full polymorphism with Jackson, it should not be a blocker to applying the sealed interface to classes that deserve it.
This PR allows the interface to be applied, without the Jackson polymorphism annotations:
Jackson won't be able to figure out which object to deserialise to, but it is beneficial to have the marker interface in code