swagger: '2.0'
info:
  title: Pet Testing
  version: 1.0.0
host: 'localhost:8080'
basePath: /v1
schemes:
  - http
consumes:
  - application/json
produces:
  - application/json
paths:
  /Pets:
    get:
      description: |
        Returns list of all pets.
      responses:
        '200':
          description: Array of pets
          schema:
            type: array
            items:
              $ref: '#/definitions/Pet'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    post:
      operationId: postPet
      description: |
        Adds a new pet.
      parameters:
        - name: pet
          in: body
          description: Pet to add.
          required: true
          schema:
            $ref: '#/definitions/Pet'
      responses:
        '200':
          description: Pet added
          schema:
            $ref: '#/definitions/Pet'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
definitions:
  Pet:
    type: object
    discriminator: petType
    properties:
      name:
        type: string
      petType:
        type: string
    required:
      - name
      - petType
  Cat:
    description: A representation of a cat
    allOf:
      - $ref: '#/definitions/Pet'
      - type: object
        properties:
          huntingSkill:
            type: string
            description: The measured skill for hunting
            default: lazy
            enum:
              - clueless
              - lazy
              - adventurous
              - aggressive
        required:
          - huntingSkill
  Goat:
    description: A representation of a goat
    allOf:
      - $ref: '#/definitions/Pet'
      - type: object
        properties:
          herdSize:
            type: integer
            format: int32
            description: the size of the herd the goat is from
            default: 0
            minimum: 0
        required:
          - herdSize
  Error:
    type: object
    properties:
      code:
        type: integer
        format: int32
      message:
        type: string
      fields:
        type: string
