Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of possible values for API query parameter in Swagger

When documenting an API, is there a way to provide a list of possible values? Something like this:

{
  "name": "propertyType",
  "in": "query",
  "description": "Type of home",
  "required": false,
  "type": "list",
  "listValues": ["singleFamilyHome", "condo", "farm", …]
}
like image 262
Brad Avatar asked Sep 30 '15 15:09

Brad


1 Answers

In swagger 2.0 you can use enum:

{
  "name": "propertyType",
  "in": "query",
  "description": "Type of home",
  "required": false,
  "type": "list",
  "enum": ["singleFamilyHome", "condo", "farm"]
}

You ca find more info here: How to define enum in swagger.io?

like image 84
David Lopez Avatar answered Sep 19 '22 02:09

David Lopez