2015-09-30 26 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?

相關問題