Search code examples
swagger-editor

Schema error at paths./crash/{crashId}/.post.parameters[0] is not exactly one from <#/definitions/parameter>,<#/definitions/jsonReference>


Im trying to create my API definition using the swagger editor. I've looked at the swagger specification and the pet store example, but I keep getting this error when Im creating one of my endpoints:

   Schema error at paths./crash/{crashId}/.post.parameters[0]
   is not exactly one from <#/definitions/parameter>,
   <#/definitions/jsonReference>
   Schema error at paths./crash/{crashId}/.post.parameters[1]
   is not exactly one from <#/definitions/parameter>,
   <#/definitions/jsonReference>

This the the yaml where the error origins:

  /crash/{crashId}/:
post:
  tags:
    - crash
  summary: Adds a feedback report
  description: Can add a feedback report with or without a crash
  consumes:
    - application/json
  produces:
    - application/json
  parameters:
    - name: crashId
      in: path
      description: the crash id parameter that this feedback report should 
  connect to
      required: false
      type: integer
      format: int32
    - name: feedbackreport
      in: body
      description: the feedbackreport
      require: true
      schema:
        $ref: '#/definitions/NewFeedbackReport'
  responses:
    '200':
      description: OK

The preview still works fine and when I put it inside my swagger UI it looks just like I want it.

What is wrong? Can I ignore this?


Solution

  • 1) Path parameters (in: path) must have required: true, because they are always required.

    2) In the body parameter, change require to required.