AllOf : Only stop when merging schemas with multiple discriminators#667
Merged
mromaszewicz merged 3 commits intoMar 4, 2026
Merged
Conversation
|
What happened to this pr? |
Contributor
Author
|
Well I did this PR because I was working on a projet that required it. Now I'm doing other stuff. I'm leaving it open because it might be useful but the maintainers didn't seem to notice it. |
|
@jamietanna would it be possible to get this one merged? It seems like it would be more permissive, rather than restrictive, so it shouldn't negatively affect existing users. |
Combines upstream's allOf guard with PR oapi-codegen#667's discriminator propagation: - Non-allOf merges reject any discriminator (upstream behavior) - AllOf merges reject only when both schemas have discriminators (PR oapi-codegen#667) - Single discriminator is propagated to the merged result (PR oapi-codegen#667) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Covers all discriminator merge scenarios: - allOf: single discriminator propagated from either schema - allOf: both schemas having discriminators errors - allOf: no discriminators succeeds - non-allOf: any discriminator errors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mromaszewicz
approved these changes
Mar 4, 2026
This was referenced May 1, 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.
This is a fix for #666.
It seems to work fine, based on OAI/OpenAPI-Specification#2165 discriminators should be inherited with AllOf, and it can safely be done when only one parent has one.