How to specify examples for GET parameters in Swagger?

Viewed 23129

I'm using the online Swagger Editor to create a Swagger spec for my API.

My API has a single GET request endpoint, and I'm using the following YAML code to describe the input parameters:

paths:
  /fooBar:
    get:
      tags:
        - foobar
      summary: ''
      description: ''
      operationId: foobar
      consumes:
        - application/x-www-form-urlencoded
      produces:
        - application/json
      parameters:
        - name: address
          in: query
          description: Address to be foobared
          required: true
          type: string
          example: 123, FakeStreet
        - name: city
          in: query
          description: City of the Address
          required: true
          type: string
          example: New York

If I put in the example tag, I get an error saying:

is not exactly one from <#/definitions/parameter>,<#/definitions/jsonReference>

How do I set an example when writing GET parameters in Swagger?

1 Answers
Related