Created
October 27, 2017 19:16
-
-
Save bhaskarmelkani/bfa61a9f98f5d0ee9b15be04a8f18afa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: "2.0" | |
info: | |
version: 2.0.0 | |
title: Swagger Petstore | |
description: A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification | |
termsOfService: http://swagger.io/terms/ | |
contact: | |
name: Swagger API Team | |
email: [email protected] | |
url: https://tech.zalando.com | |
license: | |
name: MIT | |
url: http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT | |
securityDefinitions: | |
oauth: | |
x-doc-exclude: true | |
type: oauth2 | |
tokenUrl: https://auth.example.com/oauth2/token | |
flow: password | |
scopes: | |
petstore.read: Access to read petstore | |
petstore.write: Access to write to petstore | |
oauth1: | |
type: oauth2 | |
tokenUrl: https://auth.example.com/oauth2/token | |
flow: password | |
scopes: | |
petstore.read: Access to read petstore | |
petstore.write: Access to write to petstore | |
security: | |
- oauth: [petstore.read] | |
- oauth1: [petstore.read] | |
host: petstore.swagger.io | |
basePath: /api | |
schemes: | |
- http | |
consumes: | |
- application/json | |
produces: | |
- application/json | |
parameters: | |
Authorization: | |
x-doc-exclude: true | |
name: Authorization | |
in: header | |
description: OAUTH2 (IAM) or JWT token | |
required: true | |
type: string | |
format: OAUTH2 (IAM) or JWT token | |
Authorization1: | |
name: Authorization | |
in: header | |
description: OAUTH2 (IAM) or JWT token | |
required: true | |
type: string | |
format: OAUTH2 (IAM) or JWT token | |
paths: | |
/pets: | |
x-doc-exclude: true | |
get: | |
summary: Get pets | |
description: | | |
Returns all pets from the system that the user has access to. | |
operationId: findPets | |
parameters: | |
- $ref: "#/parameters/Authorization" | |
- name: limit | |
in: query | |
description: Maximum number of results to return | |
required: false | |
type: integer | |
format: int32 | |
x-example: 10 | |
responses: | |
"200": | |
description: Pet response. | |
schema: | |
$ref: '#/definitions/Pets' | |
examples: | |
'application/json': | |
data: | |
- id: 1 | |
name: 'Foo' | |
type: 'cat' | |
gender: 'female' | |
- id: 2 | |
name: 'Bar' | |
type: 'dog' | |
gender: 'male' | |
"403": | |
description: Forbidden | |
schema: | |
$ref: '#/definitions/Error403' | |
default: | |
description: unexpected error | |
schema: | |
$ref: '#/definitions/Error' | |
post: | |
summary: Create a pet | |
description: Creates a new pet in the store. Duplicates are allowed | |
operationId: addPet | |
security: | |
- oauth: [petstore.write] | |
parameters: | |
- $ref: "#/parameters/Authorization" | |
- name: pet | |
in: body | |
description: Pet to add to the store | |
required: true | |
schema: | |
$ref: '#/definitions/NewPet' | |
x-examples: | |
default: | |
name: 'Foo' | |
type: 'cat' | |
gender: 'female' | |
responses: | |
"201": | |
description: pet response | |
schema: | |
$ref: '#/definitions/Pet' | |
examples: | |
'application/json': | |
id: 1 | |
name: 'Foo' | |
type: 'cat' | |
gender: 'female' | |
"403": | |
description: Forbidden | |
schema: | |
$ref: '#/definitions/Error403' | |
default: | |
description: unexpected error | |
schema: | |
$ref: '#/definitions/Error' | |
/pets/{id}: | |
get: | |
summary: Get a pet by id | |
description: Returns a user based on a single ID, if the user does not have access to the pet | |
operationId: find pet by id | |
parameters: | |
- $ref: "#/parameters/Authorization" | |
- name: id | |
in: path | |
description: ID of pet to fetch | |
required: true | |
type: integer | |
format: int64 | |
x-example: 1 | |
responses: | |
"200": | |
description: pet response | |
schema: | |
$ref: '#/definitions/Pet' | |
examples: | |
'application/json': | |
id: 1 | |
name: 'Foo' | |
type: 'cat' | |
gender: 'female' | |
"403": | |
description: Forbidden | |
schema: | |
$ref: '#/definitions/Error403' | |
default: | |
description: unexpected error | |
schema: | |
$ref: '#/definitions/Error' | |
delete: | |
x-doc-exclude: true | |
summary: Delete a pet | |
description: Deletes a single pet based on the ID supplied | |
operationId: deletePet | |
security: | |
- oauth: [petstore.write] | |
parameters: | |
- $ref: "#/parameters/Authorization" | |
- name: id | |
in: path | |
description: ID of pet to delete | |
required: true | |
type: integer | |
format: int64 | |
x-example: 1 | |
responses: | |
"204": | |
description: Pet deleted. | |
"403": | |
description: Forbidden | |
schema: | |
$ref: '#/definitions/Error403' | |
default: | |
description: unexpected error | |
schema: | |
$ref: '#/definitions/Error' | |
definitions: | |
Pets: | |
type: 'object' | |
description: 'List of pets' | |
properties: | |
data: | |
description: 'List of pets' | |
type: 'array' | |
items: | |
$ref: "#/definitions/Pet" | |
Pet: | |
type: 'object' | |
description: 'Pet description' | |
properties: | |
id: | |
description: 'Id of pet' | |
type: 'integer' | |
name: | |
description: 'Name of pet' | |
type: 'string' | |
example: 'Foo' | |
type: | |
description: 'Type of pet' | |
type: 'string' | |
example: 'cat' | |
gender: | |
description: 'Gender of pet' | |
enum: | |
- male | |
- female | |
NewPet: | |
type: 'object' | |
description: 'Pet description' | |
required: | |
- name | |
properties: | |
name: | |
description: 'Name of pet' | |
type: 'string' | |
example: 'Foo' | |
type: | |
description: 'Type of pet' | |
type: 'string' | |
example: 'cat' | |
gender: | |
description: 'Gender of pet' | |
enum: | |
- male | |
- female | |
Error: | |
required: | |
- code | |
- message | |
type: 'object' | |
properties: | |
code: | |
type: integer | |
format: int32 | |
message: | |
type: string | |
Error403: | |
required: | |
- code | |
- message | |
type: 'object' | |
properties: | |
code: | |
type: integer | |
format: int32 | |
description: 'Status code' | |
message: | |
type: string | |
description: 'Status message' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment