Skip to content

Conversation

@TheMrMilchmann
Copy link
Contributor

See #20938

This fixes the issue by checking if an explicit discriminator has been set already for a model name by checking for equality by model name instead of MappedModel (which included the mapping name).

@TheMrMilchmann TheMrMilchmann changed the title Discard mapped dmodels with matching explicit discriminator mappings Discard mapped models with matching explicit discriminator mappings Mar 21, 2025
@TheMrMilchmann
Copy link
Contributor Author

Is there anything missing for this to be considered?

return fmt.Errorf("failed to unmarshal Object as NestedObject2: %s", err.Error())
}
}

Copy link
Member

Choose a reason for hiding this comment

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

thanks for the pr

is that expected these code block removed after your fix?

cc @OpenAPITools/generator-core-team

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is expected. Both NestedObject1 and NestedObject2 have explicit discriminator mappings (ONE and TWO respectively), yet this is mistakenly generated in addition to the generators.

@wing328
Copy link
Member

wing328 commented Jul 8, 2025

thanks again for the pr

let's give it a try

appreciate the contribution

@wing328 wing328 merged commit 3ef45f1 into OpenAPITools:master Jul 8, 2025
4 checks passed
@wing328 wing328 added this to the 7.15.0 milestone Jul 8, 2025
@TheMrMilchmann TheMrMilchmann deleted the tmm/fix/multiple-discriminators branch July 8, 2025 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants