openapi: "3.0.0"
info:
	description: Sample API definition that validates cleanly
	version: 1.0.0
	title: Swagger Petstore
	license:
		name: MIT
		url: "http://www.apache.org/licenses/LICENSE-2.0.html"
	contact:
		email: "apiteam@swagger.io"
servers:
	- url: http://petstore.swagger.io/v1
tags:
	- name: pets
		description: A pet
paths:
	/pets:
		get:
			summary: List all pets
			description: List all pets
			operationId: list_pets
			tags:
				- pets
			parameters:
				- name: limit
					in: query
					description: How many items to return at one time (max 100)
					required: false
					schema:
						type: integer
						format: int32
						default: 10
						minimum: 0
						maximum: 100
				- name: start
					in: query
					description: A token which indicates the first item to return
					required: false
					schema:
						type: string
						pattern: '^[a-zA-Z0-9 ]+$'
						minLength: 1
						maxLength: 128
			responses:
				'200':
					description: A paged array of pets
					headers:
						x-next:
							schema:
								type: string
								description: A link to the next page of responses
								pattern: '^[a-zA-Z0-9]+$'
								minLength: 1
								maxLength: 128
					content:
						application/json:
							schema:
								$ref: "#/components/schemas/PetCollection"
				default:
					description: unexpected error
					content:
						application/json:
							schema:
								$ref: "#/components/schemas/Error"
		post:
			summary: Create a pet
			description: Create a pet
			operationId: create_pet
			tags:
				- pets
			responses:
				'201':
					description: success!
					content:
						application/json:
							schema:
								$ref: "#/components/schemas/Pet"
				default:
					description: unexpected error
					content:
						application/json:
							schema:
								$ref: "#/components/schemas/Error"
	/pets/{pet_id}:
		get:
			summary: Info for a specific pet
			description: Get information about a specific pet
			operationId: get_pet
			tags:
				- pets
			parameters:
				- name: pet_id
					in: path
					required: true
					description: The id of the pet to retrieve
					schema:
						type: string
						pattern: '^[0-9]+$'
						minLength: 1
						maxLength: 100
			responses:
				'200':
					description: Expected response to a valid request
					content:
						application/json:
							schema:
								$ref: "#/components/schemas/Pet"
				default:
					description: unexpected error
					content:
						application/json:
							schema:
								$ref: "#/components/schemas/Error"
components:
	schemas:
		Pet:
			type: object
			description:
				A pet
			required:
				- id
				- name
			properties:
				id:
					type: integer
					format: int64
					minimum: 0
					maximum: 1024
					description: "id property"
				name:
					type: string
					description: "name property"
					pattern: '^[a-zA-Z0-9]+$'
					minLength: 1
					maxLength: 50
				tag:
					type: string
					description: "tag property"
					pattern: '^[a-zA-Z0-9]+$'
					minLength: 1
					maxLength: 50
			example:
				id: 1
				name: doggie
				tag: dog
		PetCollection:
			type: object
			description:
				A list of pets
			required:
				- pets
				- limit
			properties:
				pets:
					type: array
					minItems: 0
					maxItems: 20
					description: "object containing a list of pets"
					items:
						$ref: "#/components/schemas/Pet"
				limit:
					type: integer
					format: int32
					minimum: 0
					maximum: 100
					description: limit
				next_token:
					type: string
					description: next token
					pattern: '^[a-zA-Z0-9_]+$'
					minLength: 1
					maxLength: 128
				first:
					allOf:
						- $ref: '#/components/schemas/PageLink'
						- description: Link to the first page of results
				last:
					allOf:
						- $ref: '#/components/schemas/PageLink'
						- description: Link to the last page of results
				previous:
					allOf:
						- $ref: '#/components/schemas/PageLink'
						- description: Link to the previous page of results
				next:
					allOf:
						- $ref: '#/components/schemas/PageLink'
						- description: Link to the next page of results
			example:
				pets:
				- id: 1
					name: doggie
					tag: dog
				next_url: 'https://www.nexturl.com'
				limit: 50
				next_token: TOKEN_STRING
		PageLink:
			type: object
			description: Link to a page of results
			properties:
				href:
					description: Request URL string
					type: string
					pattern: '^[a-zA-Z0-9]+$'
					minLength: 1
					maxLength: 128
		Error:
			type: object
			description:
				An error in processing a service request
			required:
				- code
				- message
			properties:
				code:
					type: integer
					format: int32
					minimum: 0
					maximum: 599
					description: "code property"
				message:
					type: string
					description: "message property"
					pattern: '^[a-zA-Z0-9_ ]*$'
					minLength: 1
					maxLength: 300
			example:
				code: 123
				message: "error occurred"
