Swagger 中 API 查询参数的可能值列表
List of possible values for API query parameter in Swagger
记录 API 时,有没有办法提供可能值的列表?像这样:
{
"name": "propertyType",
"in": "query",
"description": "Type of home",
"required": false,
"type": "list",
"listValues": ["singleFamilyHome", "condo", "farm", …]
}
在 swagger 2.0 中你可以使用枚举:
{
"name": "propertyType",
"in": "query",
"description": "Type of home",
"required": false,
"type": "list",
"enum": ["singleFamilyHome", "condo", "farm"]
}
您可以在此处找到更多信息:How to define enum in swagger.io?
记录 API 时,有没有办法提供可能值的列表?像这样:
{
"name": "propertyType",
"in": "query",
"description": "Type of home",
"required": false,
"type": "list",
"listValues": ["singleFamilyHome", "condo", "farm", …]
}
在 swagger 2.0 中你可以使用枚举:
{
"name": "propertyType",
"in": "query",
"description": "Type of home",
"required": false,
"type": "list",
"enum": ["singleFamilyHome", "condo", "farm"]
}
您可以在此处找到更多信息:How to define enum in swagger.io?