Skip to content

Instantly share code, notes, and snippets.

@khepin
Last active October 31, 2018 21:38
Show Gist options
  • Select an option

  • Save khepin/83c6702abb7012c2848983ed778dec68 to your computer and use it in GitHub Desktop.

Select an option

Save khepin/83c6702abb7012c2848983ed778dec68 to your computer and use it in GitHub Desktop.
{
"info": {
"version": "2",
"description": "Per store pets management",
"license": {
"name": "Copyright"
},
"title": "Pet Store",
"contact": {
"url": "https://pet-store.slack.com/messages/d5d84ed1-802d-4e3a-8280-d7e769087207",
"name": "Pet Store Team Slack Channel"
}
},
"components": {
"securitySchemes": {
"cookieAuth": {
"type": "apiKey",
"in": "cookie",
"name": "session_id"
}
},
"schemas": {
"Pagination": {
"type": "object",
"description": "Pagination information",
"properties": {
"count": {
"type": "integer",
"description": "Number of results in this response",
"example": 10
},
"per_page": {
"type": "integer",
"description": "Number of items to return per page",
"example": 10
},
"current_page": {
"type": "integer",
"description": "Current page selected",
"example": 1
},
"total": {
"type": "integer",
"description": "Total number of results in query",
"example": 765
},
"links": {
"type": "object",
"description": "Set of links for paging through a collection",
"properties": {}
},
"total_pages": {
"type": "integer",
"description": "Total number of pages",
"example": 77
}
}
},
"Pet": {
"type": "object",
"description": "Pet",
"properties": {
"species": {
"type": "string",
"description": "What kind of animal is this",
"enum": [
"dog",
"cat"
],
"example": "dog"
},
"created_at": {
"type": "string",
"description": "Date at which the resource was created",
"format": "date-time",
"example": "2017-10-20T00:14:02+0000",
"readOnly": true
},
"id": {
"type": "string",
"description": "uuid",
"example": "98901a98c7cd45ea9ac09df80eb1029b"
},
"race": {
"type": "string",
"description": "What kind of dog / cat this is (labrador, golden retriever, siamese, etc...)",
"example": "Labrador"
},
"updated_at": {
"type": "string",
"description": "Date at which the resource was last updated",
"format": "date-time",
"example": "2017-10-20T00:14:02+0000",
"readOnly": true
},
"origin": {
"type": "string",
"description": "Country of origin",
"example": "Egypt"
},
"store_id": {
"type": "string",
"description": "store_id",
"format": "uuid",
"example": "bccc72e3-4fba-4dfd-93f3-9e133a7ca172"
},
"birthday": {
"type": "string",
"description": "Birth date of the pet",
"format": "date-time",
"example": "2017-10-20T00:14:02+0000"
}
}
}
},
"parameters": {
"Sort": {
"description": "Field name and direction used for sorting a list",
"in": "query",
"name": "sort",
"schema": {
"type": "string",
"example": "last_name:asc,created_date:desc"
}
},
"PerPage": {
"description": "Number of items per page",
"in": "query",
"name": "per_page",
"schema": {
"type": "integer",
"example": 15
}
},
"Page": {
"description": "Number of the page to be returned",
"in": "query",
"name": "page",
"schema": {
"type": "integer",
"example": 2
}
}
}
},
"security": [
{
"cookieAuth": []
}
],
"servers": [
{
"url": "https://www.local.petstore.net/api/v2",
"description": "Local dev server, uses your local data."
},
{
"url": "https://www.petstore.com/api/v2",
"description": "Production server. Live data."
},
{
"url": "https://staging.petstore.net/api/v2",
"description": "Staging server. Staging data."
}
],
"paths": {
"/store/{storeId}/pets": {
"parameters": [
{
"required": true,
"description": "Unique identifier for the store",
"in": "path",
"name": "storeId",
"schema": {
"type": "string",
"format": "uuid",
"example": "d15f3b72-d038-4299-ace6-a6b02801588b"
}
}
],
"post": {
"summary": "Create a new Pet record",
"parameters": [
{
"required": true,
"description": "CSRF Protection Token",
"in": "header",
"name": "X-XSRF-TOKEN",
"schema": {
"type": "string",
"example": "eyJpdiI6Ijhrd3NYMWZSQ1wvblBSZWhFUW15dUtnPT0iLCJ2YWx1ZSI6ImY5VVdLQjB1dkRPQ0Q3ampyRGdKSDB"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "Pet",
"properties": {
"data": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
},
"description": "Success"
},
"400": {
"description": "Failure! The request is invalid."
},
"401": {
"description": "Failure! The user is not logged in."
},
"403": {
"description": "Failure! The user is not authorized to perform this action."
},
"404": {
"description": "Resource Not Found"
},
"419": {
"description": "Failure! The user's XSRF token is invalid."
},
"422": {
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "An error response for invalid data",
"properties": {
"message_tl": {
"type": "string",
"description": "A translated version of the message.",
"example": "Le nom du produit est trop long"
},
"message": {
"type": "string",
"description": "A human readable description of the error",
"example": "The product title exceeds the maximum length"
},
"code": {
"type": "string",
"description": "A text code that describes the error and is guaranteed to not change from API version to version.",
"example": "product.title.too_long"
},
"fields": {
"type": "object",
"description": "A map of fields on which an error was discovered and the associated error object",
"properties": {}
}
}
}
}
},
"description": "Unprocessable Entity"
},
"500": {
"description": "Failure! An unspecified error occurred on the server."
}
},
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
},
"required": true,
"description": "Pet Request Body"
},
"tags": [
"Pets"
],
"operationId": "createPet"
},
"get": {
"summary": "Retrieve all the pets for this store",
"parameters": [
{
"$ref": "#/components/parameters/Page"
},
{
"$ref": "#/components/parameters/PerPage"
},
{
"$ref": "#/components/parameters/Sort"
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "List of pets",
"properties": {
"meta": {
"type": "object",
"description": "Response Metadata",
"properties": {
"pagination": {
"$ref": "#/components/schemas/Pagination"
}
}
},
"data": {
"type": "array",
"description": "List of pets",
"items": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
}
},
"description": "Success"
},
"401": {
"description": "Failure! The user is not logged in."
},
"403": {
"description": "Failure! The user is not authorized to perform this action."
},
"404": {
"description": "Resource Not Found"
},
"500": {
"description": "Failure! An unspecified error occurred on the server."
}
},
"tags": [
"Pets"
],
"operationId": "listPets"
}
},
"/store/{storeId}/pets/{petId}": {
"parameters": [
{
"required": true,
"description": "Unique identifier for the store",
"in": "path",
"name": "storeId",
"schema": {
"type": "string",
"format": "uuid",
"example": "d15f3b72-d038-4299-ace6-a6b02801588b"
}
},
{
"required": true,
"description": "The ID of the pet in our store. A UUID.",
"in": "path",
"name": "petId",
"schema": {
"type": "string",
"format": "uuid",
"example": "060be70e-7b92-4560-94ce-d02733785447"
}
}
],
"delete": {
"summary": "Remove a pet's record from the store",
"parameters": [
{
"required": true,
"description": "CSRF Protection Token",
"in": "header",
"name": "X-XSRF-TOKEN",
"schema": {
"type": "string",
"example": "eyJpdiI6Ijhrd3NYMWZSQ1wvblBSZWhFUW15dUtnPT0iLCJ2YWx1ZSI6ImY5VVdLQjB1dkRPQ0Q3ampyRGdKSDB"
}
}
],
"responses": {
"204": {
"description": "Success! No content returned."
},
"400": {
"description": "Failure! The request is invalid."
},
"401": {
"description": "Failure! The user is not logged in."
},
"403": {
"description": "Failure! The user is not authorized to perform this action."
},
"404": {
"description": "Resource Not Found"
},
"419": {
"description": "Failure! The user's XSRF token is invalid."
},
"500": {
"description": "Failure! An unspecified error occurred on the server."
}
},
"tags": [
"Pets"
],
"operationId": "removePet"
},
"get": {
"summary": "Retrieve a single pet record",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "Pet",
"properties": {
"data": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
},
"description": "Success"
},
"401": {
"description": "Failure! The user is not logged in."
},
"403": {
"description": "Failure! The user is not authorized to perform this action."
},
"404": {
"description": "Resource Not Found"
},
"500": {
"description": "Failure! An unspecified error occurred on the server."
}
},
"tags": [
"Pets"
],
"operationId": "getPet"
},
"put": {
"summary": "Update store information for a pet",
"parameters": [
{
"required": true,
"description": "CSRF Protection Token",
"in": "header",
"name": "X-XSRF-TOKEN",
"schema": {
"type": "string",
"example": "eyJpdiI6Ijhrd3NYMWZSQ1wvblBSZWhFUW15dUtnPT0iLCJ2YWx1ZSI6ImY5VVdLQjB1dkRPQ0Q3ampyRGdKSDB"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "Pet",
"properties": {
"data": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
},
"description": "Success"
},
"400": {
"description": "Failure! The request is invalid."
},
"401": {
"description": "Failure! The user is not logged in."
},
"403": {
"description": "Failure! The user is not authorized to perform this action."
},
"404": {
"description": "Resource Not Found"
},
"419": {
"description": "Failure! The user's XSRF token is invalid."
},
"422": {
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "An error response for invalid data",
"properties": {
"message_tl": {
"type": "string",
"description": "A translated version of the message.",
"example": "Le nom du produit est trop long"
},
"message": {
"type": "string",
"description": "A human readable description of the error",
"example": "The product title exceeds the maximum length"
},
"code": {
"type": "string",
"description": "A text code that describes the error and is guaranteed to not change from API version to version.",
"example": "product.title.too_long"
},
"fields": {
"type": "object",
"description": "A map of fields on which an error was discovered and the associated error object",
"properties": {}
}
}
}
}
},
"description": "Unprocessable Entity"
},
"500": {
"description": "Failure! An unspecified error occurred on the server."
}
},
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
},
"required": true,
"description": "Pet Request Body"
},
"tags": [
"Pets"
],
"operationId": "updatePet"
}
}
},
"tags": [
{
"description": "Pet Service APIs",
"name": "PSAAS (Pet Store As A Service)"
}
],
"openapi": "3.0.1"
}
---
info:
version: '2'
description: Per store pets management
license:
name: Copyright
title: Pet Store
contact:
url: https://pet-store.slack.com/messages/d5d84ed1-802d-4e3a-8280-d7e769087207
name: Pet Store Team Slack Channel
components:
securitySchemes:
cookieAuth:
type: apiKey
in: cookie
name: session_id
schemas:
Pagination:
type: object
description: Pagination information
properties:
count:
type: integer
description: Number of results in this response
example: 10
per_page:
type: integer
description: Number of items to return per page
example: 10
current_page:
type: integer
description: Current page selected
example: 1
total:
type: integer
description: Total number of results in query
example: 765
links:
type: object
description: Set of links for paging through a collection
properties: {}
total_pages:
type: integer
description: Total number of pages
example: 77
Pet:
type: object
description: Pet
properties:
species:
type: string
description: What kind of animal is this
enum:
- dog
- cat
example: dog
created_at:
type: string
description: Date at which the resource was created
format: date-time
example: '2017-10-20T00:14:02+0000'
readOnly: true
id:
type: string
description: uuid
example: 98901a98c7cd45ea9ac09df80eb1029b
race:
type: string
description: What kind of dog / cat this is (labrador, golden retriever,
siamese, etc...)
example: Labrador
updated_at:
type: string
description: Date at which the resource was last updated
format: date-time
example: '2017-10-20T00:14:02+0000'
readOnly: true
origin:
type: string
description: Country of origin
example: Egypt
store_id:
type: string
description: store_id
format: uuid
example: bccc72e3-4fba-4dfd-93f3-9e133a7ca172
birthday:
type: string
description: Birth date of the pet
format: date-time
example: '2017-10-20T00:14:02+0000'
parameters:
Sort:
description: Field name and direction used for sorting a list
in: query
name: sort
schema:
type: string
example: last_name:asc,created_date:desc
PerPage:
description: Number of items per page
in: query
name: per_page
schema:
type: integer
example: 15
Page:
description: Number of the page to be returned
in: query
name: page
schema:
type: integer
example: 2
security:
- cookieAuth: []
servers:
- url: https://www.local.petstore.net/api/v2
description: Local dev server, uses your local data.
- url: https://www.petstore.com/api/v2
description: Production server. Live data.
- url: https://staging.petstore.net/api/v2
description: Staging server. Staging data.
paths:
"/store/{storeId}/pets":
parameters:
- required: true
description: Unique identifier for the store
in: path
name: storeId
schema:
type: string
format: uuid
example: d15f3b72-d038-4299-ace6-a6b02801588b
post:
summary: Create a new Pet record
parameters:
- required: true
description: CSRF Protection Token
in: header
name: X-XSRF-TOKEN
schema:
type: string
example: eyJpdiI6Ijhrd3NYMWZSQ1wvblBSZWhFUW15dUtnPT0iLCJ2YWx1ZSI6ImY5VVdLQjB1dkRPQ0Q3ampyRGdKSDB
responses:
'403':
description: Failure! The user is not authorized to perform this action.
'500':
description: Failure! An unspecified error occurred on the server.
'422':
content:
application/json:
schema:
type: object
description: An error response for invalid data
properties:
message_tl:
type: string
description: A translated version of the message.
example: Le nom du produit est trop long
message:
type: string
description: A human readable description of the error
example: The product title exceeds the maximum length
code:
type: string
description: A text code that describes the error and is guaranteed
to not change from API version to version.
example: product.title.too_long
fields:
type: object
description: A map of fields on which an error was discovered
and the associated error object
properties: {}
description: Unprocessable Entity
'401':
description: Failure! The user is not logged in.
'419':
description: Failure! The user's XSRF token is invalid.
'400':
description: Failure! The request is invalid.
'404':
description: Resource Not Found
'200':
content:
application/json:
schema:
type: object
description: Pet
properties:
data:
"$ref": "#/components/schemas/Pet"
description: Success
requestBody:
content:
application/json:
schema:
"$ref": "#/components/schemas/Pet"
required: true
description: Pet Request Body
tags:
- Pets
operationId: createPet
get:
summary: Retrieve all the pets for this store
parameters:
- "$ref": "#/components/parameters/Page"
- "$ref": "#/components/parameters/PerPage"
- "$ref": "#/components/parameters/Sort"
responses:
'403':
description: Failure! The user is not authorized to perform this action.
'500':
description: Failure! An unspecified error occurred on the server.
'401':
description: Failure! The user is not logged in.
'404':
description: Resource Not Found
'200':
content:
application/json:
schema:
type: object
description: List of pets
properties:
meta:
type: object
description: Response Metadata
properties:
pagination:
"$ref": "#/components/schemas/Pagination"
data:
type: array
description: List of pets
items:
"$ref": "#/components/schemas/Pet"
description: Success
tags:
- Pets
operationId: listPets
"/store/{storeId}/pets/{petId}":
parameters:
- required: true
description: Unique identifier for the store
in: path
name: storeId
schema:
type: string
format: uuid
example: d15f3b72-d038-4299-ace6-a6b02801588b
- required: true
description: The ID of the pet in our store. A UUID.
in: path
name: petId
schema:
type: string
format: uuid
example: 060be70e-7b92-4560-94ce-d02733785447
delete:
summary: Remove a pet's record from the store
parameters:
- required: true
description: CSRF Protection Token
in: header
name: X-XSRF-TOKEN
schema:
type: string
example: eyJpdiI6Ijhrd3NYMWZSQ1wvblBSZWhFUW15dUtnPT0iLCJ2YWx1ZSI6ImY5VVdLQjB1dkRPQ0Q3ampyRGdKSDB
responses:
'403':
description: Failure! The user is not authorized to perform this action.
'204':
description: Success! No content returned.
'500':
description: Failure! An unspecified error occurred on the server.
'401':
description: Failure! The user is not logged in.
'419':
description: Failure! The user's XSRF token is invalid.
'400':
description: Failure! The request is invalid.
'404':
description: Resource Not Found
tags:
- Pets
operationId: removePet
get:
summary: Retrieve a single pet record
responses:
'403':
description: Failure! The user is not authorized to perform this action.
'500':
description: Failure! An unspecified error occurred on the server.
'401':
description: Failure! The user is not logged in.
'404':
description: Resource Not Found
'200':
content:
application/json:
schema:
type: object
description: Pet
properties:
data:
"$ref": "#/components/schemas/Pet"
description: Success
tags:
- Pets
operationId: getPet
put:
summary: Update store information for a pet
parameters:
- required: true
description: CSRF Protection Token
in: header
name: X-XSRF-TOKEN
schema:
type: string
example: eyJpdiI6Ijhrd3NYMWZSQ1wvblBSZWhFUW15dUtnPT0iLCJ2YWx1ZSI6ImY5VVdLQjB1dkRPQ0Q3ampyRGdKSDB
responses:
'403':
description: Failure! The user is not authorized to perform this action.
'500':
description: Failure! An unspecified error occurred on the server.
'422':
content:
application/json:
schema:
type: object
description: An error response for invalid data
properties:
message_tl:
type: string
description: A translated version of the message.
example: Le nom du produit est trop long
message:
type: string
description: A human readable description of the error
example: The product title exceeds the maximum length
code:
type: string
description: A text code that describes the error and is guaranteed
to not change from API version to version.
example: product.title.too_long
fields:
type: object
description: A map of fields on which an error was discovered
and the associated error object
properties: {}
description: Unprocessable Entity
'401':
description: Failure! The user is not logged in.
'419':
description: Failure! The user's XSRF token is invalid.
'400':
description: Failure! The request is invalid.
'404':
description: Resource Not Found
'200':
content:
application/json:
schema:
type: object
description: Pet
properties:
data:
"$ref": "#/components/schemas/Pet"
description: Success
requestBody:
content:
application/json:
schema:
"$ref": "#/components/schemas/Pet"
required: true
description: Pet Request Body
tags:
- Pets
operationId: updatePet
tags:
- description: Pet Service APIs
name: PSAAS (Pet Store As A Service)
openapi: 3.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment