Search code examples
swagger-uiswagger-2.0swagger-editor

Swagger Editor Parameter Errors


I'm trying to draft up an API in Swagger for easy viewing through SwaggerUI, but I'm encountering errors I don't quite understand. As far as I can tell, I'm adhering to the specification.

/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"

The second and third parameters are throwing Schema error at paths./history/tags/{tag_id}.get.parameters[1] is not exactly one from <#/definitions/parameter>,<#/definitions/jsonReference> (or parameters[2], depending on which parameter).

Most other problems I've seen are simply people forgetting to use schema:, but that isn't how query parameters are structured. Any ideas?


Solution

  • Change

    type: "String"
    foramt: "date"
    

    to

    type: "string"
    format: "date"
    

    type is case-sensitive, and format was misspelled.