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", …]
}
1

1 Answer 1

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?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.