Skip to content

Instantly share code, notes, and snippets.

@iainconnor
Last active August 15, 2017 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iainconnor/6568520a0fbd15ccd6af583b73a2add4 to your computer and use it in GitHub Desktop.
Save iainconnor/6568520a0fbd15ccd6af583b73a2add4 to your computer and use it in GitHub Desktop.
openapi: "3.0.0"
info:
version: a.bc
title: Swagger Petstore
description: Foobar
servers:
- url: http://petstore.swagger.io/v1
paths:
/pets:
get:
description: HEllo
summary: List all pets
operationId: listPets
tags:
- pets
parameters:
- name: limit
in: query
description: How many items to return at one time (max 100)
required: false
schema:
oneOf:
- $ref: "#/components/schemas/Simple"
- $ref: "#/components/schemas/Simple2"
responses:
200:
description: An paged array of pets
headers:
x-next:
description: A link to the next page of responses
schema:
type: string
content:
application/json:
schema:
$ref: "#/components/schemas/Pets"
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
post:
description: Creates a new pet in the store. Duplicates are allowed
operationId: addPet
requestBody:
description: food
required: true
content:
application/json:
schema:
type: object
required:
- lat
- long
properties:
lat:
type: number
long:
type: number
application/x-www-form-urlencoded:
schema:
properties:
name:
type: object
properties:
id:
type: array
items:
type: string
status:
description: Updated status of the pet
type: string
responses:
200:
description: pet response
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/pets/{petId}:
get:
summary: Info for a specific pet
operationId: showPetById
tags:
- pets
parameters:
- name: petId
in: path
required: true
description: The id of the pet to retrieve
schema:
type: string
responses:
200:
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Pets"
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
components:
schemas:
Simple:
items:
type: string
Simple2:
type: integer
Pet:
required:
- id
- name
properties:
id:
type: array
items:
type: string
name:
oneOf:
- $ref: "#/components/schemas/Simple"
- $ref: "#/components/schemas/Simple2"
tag:
type: string
Pets:
type: array
items:
$ref: "#/components/schemas/Pet"
Error:
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment