Swagger为body参数抛出“Swagger Error Not a valid parameter definition”

时间:2016-04-20 08:36:57

标签: swagger swagger-editor

这是我的意见:

  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

我做错了什么?

1 个答案:

答案 0 :(得分:4)

您需要根据here从正文中移除type: object

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