Is there a way to specify an entirely different response object for a RESTAPI (in Swagger) for a different specification of a query param?
e.g.
URL : /A/B/C query param format=short response ...
query param format=long response ...
NOTES:
Found this stack overflow thread: https://stackoverflow.com/questions/40495880/having-different-query-parameters-on-same-path-in-yaml
So aparently it's not supported in swagger 2.0 spec.
The original poster proposes a workaround, which is to define two different endpoints with the query params of significance shown with the URL:
<baseURL>/path?filter1={value}&filter2={value}.....&filterN={value}
Would this be a good practice or is there some other workaround that would be preferred?
Thanks
Is there a way to specify an entirely different response object for a RESTAPI (in Swagger) for a different specification of a query param?
<baseURL>/path?filter1={value}&filter2={value}.....&filterN={value}
Would this be a good practice or is there some other workaround that would be preferred?
Semantic error at paths./stats/v1/bandwidth?format=timeseries
Can I have different responses based on a request parameter? Such as:
GET /something -> {200, schema_1}
GET /something?foo=bar -> {200, schema_2}
No, this is not supported.
There’s no way of doing it. A unique identifier for an operation is a combination of the verb and the path. Query parameters cannot be used to differentiate operations.
--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.