-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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 parameter to be a discriminator #1998
Comments
This would be great to have as some could have lots of nested endpoints |
That would be great. The discriminatorObject could be enhanced with a "location" (where the default value is still "property", to stay downwards compatbile): discriminator:
in: property
parameterName: pet_type This way discriminators could come from different sources, like the requested discriminator:
in: path
parameterName: pet_type That might also allow things like having the discriminator being set by a header discriminator:
in: header
parameterName: x-pet-type or cookie: discriminator:
in: cookie
parameterName: pet-filter |
I also need a |
What's the point of having a bunch of identical types? |
The enhancement @wuuti proposes would be amazing. I have different use cases for discrimination for both a query parameter and a path parameter |
+1 It would also be great to define the discriminator to be anything from the input: any path param, query param, and any nested field in the body. |
@handrews Is this kind of enhancement going to be on the roadmap for any 3.X release? I've seen #2143 regarding deprecation Not sure if #3601, using $dynamicRef, can help accomplish the same thing. I know Moonwalk will address request/response correlation, but will there be anything in a 3.X that allows specifying a different response schema based on a path parameter? |
@Yugi-2 I doubt this will be done in 3.x as extending I'm going to mark this as "Moved to Moonwalk" – all new request/response correlation work is happening there, and we already decided that anything that can be backported to 3.x with a reasonable amount of effort will be. So there's no need to track this specifically. I'm not going to literally move this issue to the moonwalk repo because the "signatures" idea definitely includes this sort of thing already. |
Can we allow the path parameter to become a discriminator?
When a path parameter is an enum, I would like to map the path parameter value to a specific response:
Currently the discriminator must be a propertyName. I am wondering if there are plans to add this in the future or if there is a way to do this that I am missing.
Full example below:
The text was updated successfully, but these errors were encountered: