swagger: '2.0'
info:
  version: 1.0.0
  title: Swagger Petstore
  license:
    name: MIT
host: petstore.swagger.io
basePath: "/v1"
schemes:
- http
consumes:
- application/json
produces:
- application/json
x-controller: pets              # All paths will use pets.js controller
paths:
  "/pets":
    get:
      summary: List all pets
      operationId: listPets     # Implementation looked for in exports.listPets in pets.js file
      tags:
      - pets
      parameters:
      - "$ref": "#/parameters/mock"
      - name: tag
        in: query
        description: Specify the tag to filter pets by.
        required: false
        type: string
      responses:
        '200':
          description: An array of pets
          examples:
            application/json:     # Mocks will be produced from examples
            - id: 123
              name: Sparky
              tag: Dog
            - id: 45.6
              name: Ghost
              tag: Cat
            - id: 78.9
              name: Goldy
              tag: Fish
          schema:
            "$ref": "#/definitions/Pets"
        default:
          description: unexpected error
          schema:
            "$ref": "#/definitions/Error"
    post:
      summary: Create a pet
      operationId: createPets
      tags:
      - pets
      parameters:
      - "$ref": "#/parameters/mock"
      - name: body
        in: body
        required: true
        schema:
          "$ref": "#/definitions/Pet"
      responses:
        '201':
          description: Null response
          schema:
            type: string
          examples:
            application/json: ''
        '401':
          description: Not authorized to POST data
          schema:
            "$ref": "#/definitions/Error"
          examples:
            application/json:
              code: 401
              message: Unauthorized. You must authenticate before posting.
        '403':
          description: Forbidden to POST data
          schema:
            "$ref": "#/definitions/Error"
        default:
          description: unexpected error
          schema:
            "$ref": "#/definitions/Error"
  "/pets/{petId}":
    get:
      summary: Info for a specific pet
      operationId: showPetById
      tags:
      - pets
      parameters:
      - "$ref": "#/parameters/mock"
      - name: invalidBody
        in: query
        description: Whether to return an invalid body
        type: boolean
      - name: petId
        in: path
        required: true
        description: The id of the pet to retrieve
        type: integer
      responses:
        '200':
          description: Expected response to a valid request
          schema:
            "$ref": "#/definitions/Pet"
          examples:
            application/json:
              id: 123
              name: Sparky
              tag: Dog
        '404':
          description: Requested pet not found.
          schema:
            type: string
          examples:
            application/json: Pet not found
        default:
          description: unexpected error
          schema:
            "$ref": "#/definitions/Error"
  "/pet-name/{petId}":
    get:
      summary: Get the name of the pet with the specified pet ID.
      operationId: getPetNameById
      parameters:
      - "$ref": "#/parameters/mock"
      - name: petId
        in: path
        required: true
        description: The id of the pet to retrieve
        type: integer
      responses:
        '200':
          description: Expected response to a valid request
          schema:
            type: string
          examples:
            text/plain: 123
parameters:
  mock:
    name: mock
    in: query
    description: Produces a mocked response.
    required: false
    type: string
definitions:
  Pet:
    required:
    - id
    - name
    properties:
      id:
        type: integer
        format: int64
      name:
        type: string
      tag:
        type: string
  Pets:
    type: array
    items:
      "$ref": "#/definitions/Pet"
  Error:
    required:
    - code
    - message
    properties:
      code:
        type: integer
        format: int32
      message:
        type: string