0

i have a POST method REST API with request body as json, which has

{
    "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"  ]
    }

I need to know how to set parameter for variants in the above json in swagger 2.0 editor, also referenced documentation and petstore sample from swagger but i cant find any clue.

4

1 回答 1

2

也许这会让你开始:

properties:
 ... // other stuff
  variants:
    type: array
    description: variants description
    items:
      properties:
        name:
          type: string
          description: the name
 ... // the rest
于 2014-09-26T19:46:24.773 回答