-
Notifications
You must be signed in to change notification settings - Fork 43
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
Do not strip discriminator property in oneOf generation. #268
Conversation
@@ -462,22 +465,8 @@ class JacksonModelGenerator( | |||
extensions: Map<String, Any>, | |||
oneOfInterfaces: Set<SchemaInfo>, | |||
): TypeSpec { | |||
val filteredProperties = if (oneOfInterfaces.size == 1) { |
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.
This is the logic in question. I'm not sure of the intent here, but perhaps @pschichtel can weigh in before I revert it
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.
the logic is:
if:
- the super interface' model defines a discriminator field
- the discriminator mappings map to the current model exactly once
then:
- remove the discriminator field, since it must always be the same value given by the jackson type info field.
I personally think this is a mistake. |
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.
👍
As per title and Issue #258 it does not seem correct to be stripping a declared property from the data classes.
Instead, adopt the same approach as allOf polymorphism and default the discriminator to the correct value