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

Discriminator support in JSON samples #459

Open
ben-foster-cko opened this issue Apr 18, 2018 · 9 comments
Open

Discriminator support in JSON samples #459

ben-foster-cko opened this issue Apr 18, 2018 · 9 comments

Comments

@ben-foster-cko
Copy link

Are there plans, following the upgrade to 2.0 to support discriminated fields in JSON payloads? Currently these are not included in the examples.

@trip-somers
Copy link

I also have this question. This would be a great feature that would allow people to maintain their examples just by documenting/updating their requests and responses.

The current alternative/work-around is to explicitly define examples for each discriminator choice which is obviously cumbersome from a documentation maintenance perspective.

That said, I'm sure this isn't a small request. It would be nice to know if it's on the road map and/or when it might be prioritized. Given the current state of the examples in my documentation, I would likely be able to contribute to this on-the-clock. :-)

@trip-somers
Copy link

trip-somers commented Jul 13, 2018

Digging into this a bit, it looks like it works if you define the request body as a oneOf, but not if a sub-object has a discriminator.

UPDATE: Nope. That's not quite right either. I tried some things based on what the OP of this thread -- #524 -- was able to achieve, but I could not duplicate his results.

@jim5359
Copy link

jim5359 commented Aug 1, 2018

For me, the models work perfectly for discriminator. But the examples do not work if the sub-object has a discriminator. See example attached. The result is the same for both requests and responses.

redoc-product-api

@cmeeren
Copy link

cmeeren commented Aug 9, 2018

I too experience problems when using oneOf on a sub-object (with or without a discriminator doesn't matter).

@tjf
Copy link

tjf commented Feb 3, 2019

@RomanGotsiy Any thoughts or updates on this?

@sayanroy7
Copy link

Anyone has any update or example of how to achieve this?

@atte-backman
Copy link

Yes, this is a bit annoying. Any plans going on tackling this one?

@toby-knott-cko
Copy link

@RomanHotsiy Has there been any progress on this?

@epark-brex
Copy link

Bump!

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

9 participants