2015-09-30 23 views
2

当记录API时,有没有办法提供可能的值列表?事情是这样的:Swagger中API查询参数的可能值列表

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

的[如何在swagger.io定义枚举可能的复制? ](http://stackoverflow.com/questions/27603871/how-to-define-enum-in-swagger-io) – Helen

回答

4

在招摇2.0你可以使用枚举:

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

您CA在这里找到更多的信息:How to define enum in swagger.io?

相关问题