Hi there,
I was wondering if it is possible to reuse a definition/schema as query parameters?
I do have a number of routes with the same query parameters and it would be handy to use a shared definition for that...
Ta, mano
Yes, you can, by using ref, define the parameter:
/**
* @SWG\Parameter(parameter="id_in_path", name="id", type="integer", in="path")
*/
and (re)use the parameter:
/**
* @SWG\Get(
* path="users/:id",
* @SWG\Parameter(ref="#/parameters/id_in_path"),
* @SWG\Response(response="200",description="A user object")
* )
*/
Hmm. Looks ok, but does that work with groups as well or just one-on-one?
Ideally I'd like to be able to define a group of parameters and use a single referene, or even have multiple groups of parameters and 'bundle' them with allOf or similar
Finally got around to trying this and it seems this only works for a single parameter. If I ref' more than, then only the first one shows up in swagger-ui
Most helpful comment
Yes, you can, by using ref, define the parameter:
and (re)use the parameter: