Swagger throws "Swagger Error Not a valid parameter definition" for body parameter

EpicPandaForce picture EpicPandaForce · Apr 20, 2016 · Viewed 8.8k times · Source

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?

Answer

EpicPandaForce picture EpicPandaForce · Apr 20, 2016

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'