5

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", …]
}
Brad
  • 159,648
  • 54
  • 349
  • 530
  • Possible duplicate of [How to define enum in swagger.io?](http://stackoverflow.com/questions/27603871/how-to-define-enum-in-swagger-io) – Helen May 25 '16 at 11:36

1 Answers1

8

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?

Community
  • 1
  • 1
David Lopez
  • 2,127
  • 1
  • 10
  • 7