swagger: "2.0"
info:
  version: "1.0.0"
  title: "OpenAPI petstore"
  description: "A sample API"
consumes:
  - "application/json"
produces:
  - "application/json"
definitions:
  pet:
    required:
      - "name"
      - "type"
    properties:
      name:
        type: "string"
        minLength: 4
        pattern: "^[a-zA-Z0-9- ]+$"
      age:
        type: "integer"
      dob:
        type: "string"
        format: "date"
      type:
        type: "string"
        enum:
          - "cat"
          - "dog"
          - "bird"
      address:
        $ref: "#/definitions/address"
      vet:
        $ref: "#/definitions/veterinarian"
      tags:
        type: "array"
        uniqueItems: true
        items:
          type: "string"
          minLength: 1
  veterinarian:
    required:
      - "name"
    properties:
      name:
        type: "string"
        minLength: 1
      address:
        $ref: "#/definitions/address"
  address:
    properties:
      street:
        type: "string"
        minLength: 1
      city:
        type: "string"
        minLength: 1
      state:
        type: "string"
        minLength: 2
        maxLength: 2
        pattern: "^[A-Z]+$"
      zipcode:
        type: "integer"
        minimum: 10000
        maximum: 99999
parameters:
  tags:
    name: "tags"
    in: "query"
    description: "Filters pets by one or more tags"
    required: false
    type: "array"
    items:
      type: "string"
    uniqueItems: true
    collectionFormat: "csv"
  type:
    name: "type"
    in: "query"
    description: "Filters pets by type (dog, cat, or bird)"
    required: true
    type: "string"
    enum:
      - "cat"
      - "dog"
      - "bird"
  age:
    name: "age"
    in: "query"
    description: "Filters pets by age"
    required: false
    type: "integer"
  petName:
    name: "petName"
    in: "path"
    description: "Name of the pet"
    required: true
    type: "string"
paths:
  /pets:
    get:
      description: "Returns all pets, optionally filtered by one or more criteria"
      operationId: "findPets"
      parameters:
        - $ref: "#/parameters/tags"
        - $ref: "#/parameters/type"
        - $ref: "#/parameters/age"
      responses:
        default:
          description: "Returns the matching pets"
          schema:
            type: "array"
            items:
              $ref: "#/definitions/pet"
          headers:
            last-modified:
              type: "string"
              description: "The date/time that a pet was last modified"
    delete:
      description: "Deletes all pets, optionally filtered by one or more criteria"
      operationId: "deletePets"
      parameters:
        - $ref: "#/parameters/tags"
        - $ref: "#/parameters/type"
        - $ref: "#/parameters/age"
      responses:
        default:
          description: "Returns the pets that were deleted"
          schema:
            type: "array"
            items:
              $ref: "#/definitions/pet"
    post:
      description: "Creates a new pet in the store"
      operationId: "addPet"
      parameters:
        - name: "pet"
          in: "body"
          description: "The pet to add to the store"
          required: true
          schema:
            $ref: "#/definitions/pet"
      responses:
        201:
          description: "Returns the newly-added pet"
          schema:
            $ref: "#/definitions/pet"
          headers:
            Location:
              type: "string"
              description: "The URL of the newly-added pet"
  /pets/{petName}:
    parameters:
      - $ref: "#/parameters/petName"
    get:
      description: "Returns a pet by name"
      operationId: "findPetByName"
      responses:
        default:
          description: "Returns the pet data"
          schema:
            $ref: "#/definitions/pet"
          headers:
            last-modified:
              type: "string"
              description: "The date/time that the pet was last modified"
    delete:
      description: "Deletes a single pet based on the name supplied"
      operationId: "deletePet"
      responses:
        default:
          description: "Returns the pet that was deleted"
          schema:
            $ref: "#/definitions/pet"
    patch:
      description: "Updates a pet by name"
      parameters:
        - name: "pet"
          in: "body"
          description: "The updated pet info"
          required: true
          schema:
            $ref: "#/definitions/pet"
      responses:
        default:
          description: "Returns the updated pet data"
          schema:
            $ref: "#/definitions/pet"
  /pets/{petName}/photos:
    parameters:
      - $ref: "#/parameters/petName"
    post:
      description: "Upload a new pet photo"
      operationId: "addPetPhoto"
      consumes:
        - "multipart/form-data"
      parameters:
        - name: "id"
          in: "formData"
          description: "The photo ID (generated automatically)"
          type: "integer"
          format: "int32"
          minimum: 1
        - name: "label"
          in: "formData"
          description: "A label for the photo"
          required: true
          type: "string"
          minLength: 1
        - name: "description"
          in: "formData"
          description: "An optional description of the photo"
          type: "string"
        - name: "photo"
          in: "formData"
          description: "The pet photo"
          required: true
          type: "file"
          minLength: 1
          maxLength: 5000000
      responses:
        default:
          description: "Returns the photo information"
          schema:
            properties:
              id:
                type: "integer"
                format: "int32"
                description: "The auto-generated photo ID"
              label:
                type: "string"
              description:
                type: "string"
              photo:
                type: "object"
                description: "Information about the photo (size, file name, etc.)"
          headers:
            Location:
              type: "string"
              description: "The URL of the newly-added photo"
    get:
      description: "Get a list of the photos for a pet"
      responses:
        200:
          description: "Returns the list of photos"
          schema:
            type: "array"
            items:
              properties:
                id:
                  type: "integer"
                  format: "int32"
                  description: "The auto-generated photo ID"
                label:
                  type: "string"
                description:
                  type: "string"
                photo:
                  type: "object"
                  description: "Information about the photo (size, file name, etc.)"
  /pets/{petName}/photos/{id}:
    parameters:
      - $ref: "#/parameters/petName"
      - name: "id"
        in: "path"
        description: "The ID of the photo"
        required: true
        type: "integer"
        format: "int32"
    get:
      description: "Gets a pet photo"
      operationId: "getPetPhoto"
      produces:
        - "image/jpeg"
        - "image/gif"
        - "image/png"
        - "image/bmp"
      responses:
        default:
          description: "Returns the pet photo"
          schema:
            type: "file"
    delete:
      description: "Deletes a pet photo"
      operationId: "deletePetPhoto"
      responses:
        default:
          description: "The photo was deleted successfully"
  /authorizationserver/oauth/token:
    post:
      summary: "Get OAuth2 access token"
      description: "Returns the acess token for Kyma"
      consumes:
        - "application/x-www-form-urlencoded"
      produces:
        - "application/xml"
        - "application/json"
      parameters:
        - in: "body"
          name: "parameters"
          description: "List of Component identifiers"
          required: true
          schema:
            type: "object"
            properties:
              client_id:
                type: "string"
              client_secret:
                type: "string"
              grant_type:
                type: "string"
      responses:
        200:
          description: "OK"
          schema:
            type: "object"
            properties:
              access_token_url:
                type: "string"
            default:
              token: "3333"
        404:
          description: "Not Found"

