Skip to content
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

Support for discriminator objects inside schemas #170

Closed
sm-Fifteen opened this issue Apr 1, 2020 · 4 comments
Closed

Support for discriminator objects inside schemas #170

sm-Fifteen opened this issue Apr 1, 2020 · 4 comments

Comments

@sm-Fifteen
Copy link

https://github.com/mrin9/RapiDoc/blob/9c5401f06f3f1fe162b1a80a540b45da26ae74db/docs/specs/petstore_extended.yaml#L781-L786

In the extended petstore OpenAPI example, the Pet schema has a petType tag that is used as a discriminator to determine which of the 3 variants of pet is actually used. Redoc supports it (see the POST /pet route) and adjusts the properties presented in the UI based on the value of the discriminator property. RapiDoc does not currently appear to support this, at least not in the way the above example does it. For the record, Swagger UI doesn't support it either, despite this being a standard OpenAPI property).

There was recently a discussion from the OpenAPI team to deprecate discriminator (see OAI/OpenAPI-Specification#2143), but the consensus now seems to be that it does have a clear purpose (namely: identify tagged unions) and should be kept.

@mrin9
Copy link
Collaborator

mrin9 commented Apr 1, 2020

Well, at RapiDoc, we wont be supporting discriminator at least for the foreseeable future.
It is an extremely complex feature to implement in the context of RapiDoc with a very little return.

We did try to implement it in the past, but were not able to cleanly address certain complex cases involving other schema composition rules such as all-off, any-of, one-of

Redoc do supports discriminator but their implementation is buggy too.

@sm-Fifteen
Copy link
Author

Do you happen to have any examples regarding those complex composition use cases, or in what ways Redoc's implementation turns out to be buggy? I understand your point on how this is a somewhat niche feature (as far as OpenAPI goes, anyway) and that the returns on user experience wouldn't be all that significant, but I'm curious to know about the implementation issues and pitfalls.

@mrin9
Copy link
Collaborator

mrin9 commented Apr 1, 2020

a quick search of discriminatior issues in redoc's source has given me some

Redocly/redoc#1088
Redocly/redoc#1076
Redocly/redoc#1031
Redocly/redoc#862

there are more, I am just listed few of them

@mrin9 mrin9 closed this as completed Apr 5, 2020
@pschichtel
Copy link

Would a pull request be welcome for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants