这是我的输入:

  parameters:
    - name: body
      in:  body
      required: true
      type: object
      description: |
        The body.
      schema:
        $ref: '#/definitions/CsrRequest'

它说:

细节
 Object
code:  "ONE_OF_MISSING"
message:  "Not a valid parameter definition"
 path: Array [5]
 inner: Array [2]
level: 900
type:  "Swagger Error"
description:  "Not a valid parameter definition"
lineNumber: 24

我究竟做错了什么?

最佳答案

您需要根据 this issue 从正文中删除 type: object

parameters:
  - name: body
    in:  body
    required: true
    description: |
      The body.
    schema:
      $ref: '#/definitions/CsrRequest'

关于Swagger 为 body 参数抛出 "Swagger Error Not a valid parameter definition",我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36738211/

10-15 14:35