openapi: 3.1.0
info:
  title: Sample Pet Store App
  summary: A pet store manager.
  description: This is a sample server for a pet store.
  termsOfService: https://example.com/terms/
  contact:
    name: API Support
    url: https://www.example.com/support
    email: support@example.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.1
paths:
  /pet/findByTags:
    get:
      summary: Finds Pets by tags
      description: >-
        Muliple tags can be provided with comma seperated strings. Use tag1,
        tag2, tag3 for testing.
      operationId: findPetsByTags
      deprecated: true
      parameters:
        - name: tags
          in: query
          description: Tags to filter by
          required: true
          style: form
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          description: successful operation
      security:
        - petstore_auth:
            - 'write:pets'
            - 'read:pets'
  /store/inventory:
    get:
      summary: Returns pet inventories by status
      description: Returns a map of status codes to quantities
      operationId: getInventory
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: integer
                  format: int32
      security:
        - api_key: []  
webhooks:
  newPet:
    post:
      requestBody:
        description: Information about a new pet in the system
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Pet"
      responses:
        "200":
          description: Return a 200 status to indicate that the data was received successfully
    put:
      requestBody:
        description: Information about a new pet in the system
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Pet"
      responses:
        "200":
          description: Return a 200 status to indicate that the data was received successfully
  systemCleanup:
    post:
      requestBody:
        description: Information about a new pet in the system
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Pet"
      responses:
        "200":
          description: Return a 200 status to indicate that the data was received successfully
    put:
      requestBody:
        description: Information about a new pet in the system
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Pet"
      responses:
        "200":
          description: Return a 200 status to indicate that the data was received successfully
components:
  schemas:
    ApiResponse:
      type: object
      properties:
        code:
          type: integer
          format: int32
        type:
          type: string
        message:
          type: string
    Cat:
      description: A representation of a cat
      allOf:
        - $ref: '#/components/schemas/Pet'
        - type: object
          properties:
            huntingSkill:
              type: string
              description: The measured skill for hunting
              default: lazy
              enum:
                - clueless
                - lazy
                - adventurous
                - aggressive
          required:
            - huntingSkill
    Category:
      type: object
      properties:
        id:
          description: Category ID
          allOf:
            - $ref: '#/components/schemas/Id'
        name:
          description: Category name
          type: string
          minLength: 1
        sub:
          description: Test Sub Category
          type: object
          properties:
            prop1:
              type: string
              description: Dumb Property
      xml:
        name: Category
    Dog:
      description: A representation of a dog
      allOf:
        - $ref: '#/components/schemas/Pet'
        - type: object
          properties:
            packSize:
              type: integer
              format: int32
              description: The size of the pack the dog is from
              default: 1
              minimum: 1
          required:
            - packSize
    HoneyBee:
      description: A representation of a honey bee
      allOf:
        - $ref: '#/components/schemas/Pet'
        - type: object
          properties:
            honeyPerDay:
              type: number
              description: Average amount of honey produced per day in ounces
              example: 3.14
          required:
            - honeyPerDay
    Id:
      type: integer
      format: int64
      readOnly: true
    Order:
      type: object
      properties:
        id:
          description: Order ID
          allOf:
            - $ref: '#/components/schemas/Id'
        petId:
          description: Pet ID
          allOf:
            - $ref: '#/components/schemas/Id'
        quantity:
          type: integer
          format: int32
          minimum: 1
          default: 1
        shipDate:
          description: Estimated ship date
          type: string
          format: date-time
        status:
          type: string
          description: Order Status
          enum:
            - placed
            - approved
            - delivered
        complete:
          description: Indicates whenever order was completed or not
          type: boolean
          default: false
          readOnly: true
        rqeuestId:
          description: Unique Request Id
          type: string
          writeOnly: true
      xml:
        name: Order
    Pet:
      type: object
      required:
        - name
        - photoUrls
      discriminator:
        propertyName: petType
        mapping:
          cat: '#/components/schemas/Cat'
          dog: '#/components/schemas/Dog'
          bee: '#/components/schemas/HoneyBee'
      properties:
        id:
          externalDocs:
            description: "Find more info here"
            url: "https://example.com"
          description: Pet ID
          allOf:
            - $ref: '#/components/schemas/Id'
        category:
          description: Categories this pet belongs to
          allOf:
            - $ref: '#/components/schemas/Category'
        name:
          description: The name given to a pet
          type: string
          example: Guru
        photoUrls:
          description: The list of URL to a cute photos featuring pet
          type: array
          maxItems: 20
          xml:
            name: photoUrl
            wrapped: true
          items:
            type: string
            format: url
        friend:
          allOf:
            - $ref: '#/components/schemas/Pet'
        tags:
          description: Tags attached to the pet
          type: array
          minItems: 1
          xml:
            name: tag
            wrapped: true
          items:
            $ref: '#/components/schemas/Tag'
        status:
          type: string
          description: Pet status in the store
          enum:
            - available
            - pending
            - sold
        petType:
          description: Type of a pet
          type: string
      xml:
        name: Pet
    Tag:
      type: object
      properties:
        id:
          description: Tag ID
          allOf:
            - $ref: '#/components/schemas/Id'
        name:
          description: Tag name
          type: string
          minLength: 1
      xml:
        name: Tag
    User:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/Id'
        pet:
          oneOf:
            - $ref: '#/components/schemas/Pet'
            - $ref: '#/components/schemas/Tag'
        username:
          description: User supplied username
          type: string
          minLength: 4
          example: John78
        firstName:
          description: User first name
          type: string
          minLength: 1
          example: John
        lastName:
          description: User last name
          type: string
          minLength: 1
          example: Smith
        email:
          description: User email address
          type: string
          format: email
          example: john.smith@example.com
        password:
          type: string
          description: >-
            User password, MUST contain a mix of upper and lower case letters,
            as well as digits
          format: password
          minLength: 8
          pattern: '/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/'
          example: drowssaP123
        phone:
          description: User phone number in international format
          type: string
          pattern: '/^\+(?:[0-9]-?){6,14}[0-9]$/'
          example: +1-202-555-0192
          nullable: true
        userStatus:
          description: User status
          type: integer
          format: int32
      xml:
        name: User
  requestBodies:
    Pet:
      content:
        application/json:
          schema:
            allOf:
              - description: My Pet
                title: Pettie
              - $ref: '#/components/schemas/Pet'
        application/xml:
          schema:
            type: 'object'
            properties:
              name:
                type: string
                description: hooray
      description: Pet object that needs to be added to the store
      required: true
    UserArray:
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: '#/components/schemas/User'
      description: List of user object
      required: true
  securitySchemes:
    basic:
      type: http
      scheme: basic
    petstore_auth:
      description: |
        Get access to data while protecting your account credentials.
        OAuth2 is also a safer and more secure way to give you access.
      type: oauth2
      flows:
        implicit:
          authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
          scopes:
            'write:pets': modify pets in your account
            'read:pets': read your pets
    api_key:
      description: >
        For this sample, you can use the api key `special-key` to test the
        authorization filters.
      type: apiKey
      name: api_key
      in: header
  examples:
    Order:
      value:
        quantity: 1,
        shipDate: 2018-10-19T16:46:45Z,
        status: placed,
        complete: false
