小编tom*_*hre的帖子

Swagger嵌套对象数组

我被要求使用摇摇欲坠来描述API,而我努力使更复杂的情况起作用。假设您要发布包含多个订单项的订单

<upload_order>
<token>d6a91238b0f17b49d49fbdcbba773d71</token>
<order>
    <order_id>10006</order_id>
    <item_value>48.50</item_value>
    <postage_value>5.00</postage_value>
    <gross_value>A43.50</gross_value>
    <discount_value>10.00</discount_value>
    <delivery_date>2016-10-32</delivery_date>
    <customer_name>Tom H</customer_name>
    <business_name>Toysorry</business_name>
    <address_line_1>Adderss Line 1</address_line_1>
    <address_line_2>Adderss Line 1</address_line_2>
    <town>Town</town>
    <county>County</county>
    <postcode>PO123ST</postcode>
    <email>email@email.com</email>
    <telephone>0787878787878</telephone>
    <delivery_instructions>Garage</delivery_instructions>
    <delivery_method>PRE12</delivery_method>
    <items>
        <item>
            <id>1</id>
            <sku>BLABLA</sku>
            <qty>A</qty>
            <product_name>A Product</product_name>
            <unit_price>1.50</unit_price>
        </item>
        <item>
            <id>2</id>
            <sku>HAHAHA</sku>
            <qty>2</qty>
            <product_name>WINTER BUNDLE</product_name>
            <unit_price>22.00</unit_price>
        </item>
    </items>
</order>
Run Code Online (Sandbox Code Playgroud)

我怎么用招摇来形容它,因为以这种方式使用数组似乎没有发挥作用

/upload_order:
post:
  description: create order
  operationId: upload_order
  produces:
    - application/xml
  parameters:
    - name: upload_order
      in: body
      description: upload order
      required: true
      schema:
        $ref: '#/definitions/newOrder'
  responses:
    '200':
      description: response
      schema:
        $ref: '#/definitions/token_response'
    default:
      description: unexpected …
Run Code Online (Sandbox Code Playgroud)

arrays nested object swagger

4
推荐指数
1
解决办法
7766
查看次数

标签 统计

arrays ×1

nested ×1

object ×1

swagger ×1