Pode icon indicating copy to clipboard operation
Pode copied to clipboard

Open API documenting multiple parameter sets

Open robertfshort opened this issue 2 years ago • 3 comments

Question

So lets say I have a route that I want to use OpenAPI on. Now this route has a parameter set that gets passed to the route as part of the body of the request. To put this into powershell terms, the route has two 'parameter sets' where in set 1 certain parameters are required, but in set two there are different parameters required. The Open API can handle this with some JSON schema tricks. Is it possible to do this in Pode, and if so, how?

robertfshort avatar May 24 '22 15:05 robertfshort

Hi @robertfshort,

At the moment Pode just allows defining a single "parameter set". Have you got a link to what these schema tricks are in OpenAPI?

Badgerati avatar May 26 '22 20:05 Badgerati

This thread is from 2018: https://stackoverflow.com/questions/21134029/how-to-define-mutually-exclusive-query-parameters-in-swagger-openapi

and from the swagger documentation: https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/

On Thu, May 26, 2022 at 4:16 PM Matthew Kelly @.***> wrote:

Hi @robertfshort https://github.com/robertfshort,

At the moment Pode just allows defining a single "parameter set". Have you got a link to what these schema tricks are in OpenAPI?

— Reply to this email directly, view it on GitHub https://github.com/Badgerati/Pode/issues/967#issuecomment-1138977098, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSA2QYPTPJ6ZEGID5A3HVLVL7L3BANCNFSM5WZ5TS5Q . You are receiving this because you were mentioned.Message ID: @.***>

robertfshort avatar May 26 '22 23:05 robertfshort

This should be possible using the oneOf, allOf, and anyOf. I was thinking by "tricking" it required manipulating the json spec in some way 😂

Badgerati avatar Jun 08 '22 20:06 Badgerati