Skip to content

Instantly share code, notes, and snippets.

@MrTrick
Created February 3, 2016 05:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrTrick/6ed4dc6694ff0864dffc to your computer and use it in GitHub Desktop.
Save MrTrick/6ed4dc6694ff0864dffc to your computer and use it in GitHub Desktop.
Making a general swagger parameter definition more specific, by adding json-schema information.
...
"definitions": {
"special_id_csv": {
"description": "One or more of a particular kind of id separated by comma \",\"",
"type": "string",
"pattern": "^...regrexregexregexregexregex...$"
},
}
...
"parameters": {
...
"filter[id]": {
"name": "filter[id]",
"description": "If specified, return only records matching that id or ids. May be one or more valid ids, separated by comma \",\".",
"in": "query",
"type": "string"
},
...
}
...inside a partcular path/operation/parameters: [
...
{ "allOf": [
{"$ref": "#/parameters/filter[id]"},
{"$ref": "otherfile.json#/definitions/special_id_csv"}
] },
...
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment