-
Notifications
You must be signed in to change notification settings - Fork 42
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
Allow anyOf
with polymorphism
#191
Comments
Hi @atollk I am still unsure what to do with this issue and your related pull request. I personally have always struggled with the intention of I have recently improved the documentation around polymorphism in fabrikt. I would appreciate if you give it a read and let me know if this is still an issue we need to pursue. |
I'd say For all practical purposes that I have seen, In my experience, OpenAPI generators tend to support Anyway, the point of this PR isn't |
Currently, the way to use discriminator-based polymorphism with Fabrikt is:
However, from all sources I could find, this isn't actually correct.
https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/
You actually need to specify the possible "subschemas" with
anyOf
oroneOf
. That is:This is also highlighted by the fact that many other OAS generators do not properly process the first variant. For example, https://editor.swagger.io/ renders it as an object with only a single property:
At the moment, the second variant causes a StackOverflowError in Fabrikt.
The text was updated successfully, but these errors were encountered: