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.
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
[core] [regression] set parentName when a single possible parent exists #3771
[core] [regression] set parentName when a single possible parent exists #3771
Changes from all commits
c8f9263
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Can we throw a warning about this behavior and advise the user to use "discriminator.propertyName" in OAS v3 instead to set a proper parent model as such behavior will be removed in the future?
Our goal is to move users to adopt OAS v3 instead of staying with OAS v2 (which is not the best specification to work with inheritance/composition)
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.
Sure, I'd still be interested in how you would recommend applying the discriminator approach to a collection of schema's like I describe in the MR description - the parent in this case should not have knowledge of its children, and also I don't particularly want to add an arbitrary field like
type: string
solely for code generation purposes.I'd be more than happy to refactor our definitions to do things the OAS v3 way over time - in general I've found v3 much better to work with than v2 ever was.
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.
we should raise an issue at the openapi 3.0 specification to allow this type of inheritance without discriminator
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.
Another way is to use vendor extension to describe this if the OAS 3.0 spec doesn't officially support it at the moment.
(nullable was not supported in OAS v2 and we'd to use x-nullable: true before OAS v3 officially supports 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.
this is a great idea, and probably the easiest way to support this behavior in the future.
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.
That sounds like a good plan. @macjohnny would you be comfortable raising such an issue? I don't really have the bandwidth to write a well thought proposal at this time.
Also I've added a warning, and fixed the commit author (thanks for pointing that out). Let me know if you're happy with the wording
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.
Btw, if this fallback is breaking some existing use cases (allOf with just one schema), we will need to add an option later to cater to both cases.
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.
@wing328 in regards to your #3771 (comment) and mine #3771 (comment) I assume that's what is happening in my case.