Open ben-foster-cko opened 6 years ago
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. :-)
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 -- https://github.com/Rebilly/ReDoc/issues/524 -- was able to achieve, but I could not duplicate his results.
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.
I too experience problems when using oneOf
on a sub-object (with or without a discriminator doesn't matter).
@RomanGotsiy Any thoughts or updates on this?
Anyone has any update or example of how to achieve this?
Yes, this is a bit annoying. Any plans going on tackling this one?
@RomanHotsiy Has there been any progress on this?
Bump!
Are there plans, following the upgrade to 2.0 to support discriminated fields in JSON payloads? Currently these are not included in the examples.