paths./crash/{crashId}/.post.parameters [0]中的模式错误不是<#/ definitions / parameter>,<#/ definitions / jsonReference>中的模式错误。

时间:2017-05-18 13:54:29

标签: swagger-editor

我正在尝试使用swagger编辑器创建我的API定义。 我已经看过swagger规范和宠物商店示例,但是当我创建一个端点时,我一直收到这个错误:

   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>

这是错误起源的yaml:

  /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

预览仍然可以正常工作,当我把它放在我的招摇UI中时,它看起来就像我想要的那样。

有什么问题?我可以忽略这个吗?

1 个答案:

答案 0 :(得分:1)

1)路径参数(in: path)必须为required: true,因为它们始终是必需的。

2)在body参数中,将require更改为required