如何在单个API调用中以swagger定义查询和正文参数

时间:2017-09-26 14:34:57

标签: json node.js yaml swagger

API在正文和查询中都有参数,我需要像下面那样在招摇中定义:

parameters: [
  {
    "name": "businessCode",
    "in": "query",
    "required": true,
    "type": "string",
  },
  {
    "name":"clientCode",
    "in":"query",
    "required":true,
    "type":"string",
  },
  {
    "name":"client",
    "in":"body",
    "required":true,
  }
]

1 个答案:

答案 0 :(得分:0)

我认为这很简单,你已经举了一个例子。这是另一个恰当的例子。

parameters: [{
      name: "id",
      description: "id of something",
      required: true,
      type: "Id",
      paramType: "query"
    },
    {
      name: "Body",
      description: "any data",
      required: true,
      type: "User", //define this model in model file
      paramType: "body"
    }]