Swagger编辑器参数错误

时间:2017-06-07 15:45:13

标签: swagger-ui swagger-2.0 swagger-editor

我试图在Swagger中起草一个API,以便通过SwaggerUI轻松查看,但我遇到了一些我不太了解的错误。据我所知,我遵守规范。

/history/tags/{tag_id}:
  get:
    summary: "Gets the history of this tag."
    description: "Warning: not using both the start and end date fields may result in excessively long responses."
    operationId: "get_tag_history"
    produces:
    - "application/json"
    parameters:
    - name: "tag_id"
      in: "path"
      description: "UUID for this tag."
      type: "string"
      required: true
    - name: "start_date"
      in: "query"
      description: "Start date for history"
      type: "String"
      foramt: "date"
      required: false
    - name: "end_date"
      in: "query"
      description: "End date for history"
      type: "String"
      foramt: "date"
      required: false
    responses:
      200:
        description: "Operation success"
        schema: 
          $ref: "#/definitions/Tag_history"
      400:
        description: "Invalid request"

第二个和第三个参数正在抛出Schema error at paths./history/tags/{tag_id}.get.parameters[1] is not exactly one from <#/definitions/parameter>,<#/definitions/jsonReference>(或parameters[2],具体取决于哪个参数。)

我见过的大多数其他问题只是人们忘记使用schema:,但这并不是查询参数的结构。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

更改

type: "String"
foramt: "date"

type: "string"
format: "date"

type区分大小写,format拼写错误。