大摇大摆-如何在请求详细信息中添加自定义标头参数

时间:2018-09-27 09:26:11

标签: swagger swagger-editor

 parameters:
  - in: "body"
    name: "body"
    description: "Pet object that needs to be added to the store"
    required: true
    schema:
      $ref: "#/definitions/Pet"
  - in: "header"
    name: "user"
    description: "username in header paramter"
    required: false

在示例的POST请求中添加以上代码行
https://editor.swagger.io/

这给我一个错误

1 个答案:

答案 0 :(得分:0)

您的标头参数需要一个type

  - in: "header"
    name: "user"
    description: "username in header paramter"
    required: false
    type: string    # <-----------