简体   繁体   中英

Swagger throws “Swagger Error Not a valid parameter definition” for body parameter

This is my input:

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

And it says this:

Details

 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

What am I doing wrong?

You need to remove the type: object from the body as per this issue .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM