2014-09-19 63 views
0

我有請求主體爲JSON,其中有如何揚鞭編輯器使用JSON體指定POST

{ 
    "name": "5-Star", 
    "vendor": "Cadbury", 
    "description": "More almonds with chocolate", 
    "price": 5, 
    "primaryImage": "http://cdn.shopify.com/s/files/1/0219/2362/products/Front_a8743e5a-c6a3-4042-9cb2-834332af77d5_large.jpg?v=1377892407", 
    "variants": 
     [ 
      { "name" : "size", 
      "type" : null, 
      "defaultValue" : "8", 
      "values" :[ "8","8.5"] 
      }, 
      { "name" : "color", 
      "type" : "COLOR", 
      "values" :[ "Milky White","Chocolate"] 
      } 
     ], 
    "tags": 
     [ "Chocolate", "Cadbury" ] 
    } 

我需要知道如何設置參數POST方法REST API在上面的變種 json swagger 2.0編輯,也參考文檔和petstore來自swagger的示例,但我無法找到任何線索。

回答

2

也許這將讓你開始:

properties: 
... // other stuff 
    variants: 
    type: array 
    description: variants description 
    items: 
     properties: 
     name: 
      type: string 
      description: the name 
... // the rest