swagger - Is it possible to define a parameter set and reference it? -
i have multiple parameters want reference, not want specify them 1 one.
this snippet not make parameters show up:
{ ... "paths": { "/stuff": { "get": { "description": "gets stuff", "operationid": "getstuff", "parameters": { "$ref": "#/definitions/set1" } } } }, "parameters": { "a": { "name": "a", "in": "query", "description": "param a", "required": false, "type": "string" }, "b": { "name": "b", "in": "query", "description": "param b", "required": false, "type": "string" } }, "definitions": { "set1": [ { "$ref": "#/parameters/a" }, { "$ref": "#/parameters/b" } ], "set2": ... } }
is possible or have specify each parameter set1
, each request?
indeed that's not valid definition , suggested, you'd have specify each parameter separately referencing global one. if parameters shared operations under specific path, can define @ path level , applied operations.
for individual operation, you'd define as:
"paths": { "/stuff": { "get": { "description": "gets stuff", "operationid": "getstuff", "parameters": [ { "$ref": "#/parameters/a" }, { "$ref": "#/parameters/b" } ] } } }
Comments
Post a Comment