Skip to content

Instantly share code, notes, and snippets.

@iainconnor
Last active August 15, 2017 04:09

Revisions

  1. iainconnor revised this gist Aug 15, 2017. 1 changed file with 138 additions and 39 deletions.
    177 changes: 138 additions & 39 deletions swagger.yaml
    Original file line number Diff line number Diff line change
    @@ -1,49 +1,148 @@
    openapi: 3.0.0
    openapi: "3.0.0"
    info:
    version: '1.0'
    title: Demo
    description: 'Just a demonstration. · Generated with ❤ by GameMaker · https://github.com/iainconnor/game-maker.'
    version: a.bc
    title: Swagger Petstore
    description: Foobar
    servers:
    - url: 'http://www.mydemo.com/rest_api/foo'
    - 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:
    Bar:
    type: object
    Simple:
    items:
    type: string
    Simple2:
    type: integer
    Pet:
    required:
    - id
    - name
    properties:
    zim:
    oneOf:
    - type: string
    - type: integer
    zam:
    oneOf:
    - type: array
    items:
    type: string
    - type: array
    items:
    $ref: '#/components/schemas/Fuzz'
    - type: boolean
    zuzz:
    id:
    type: array
    items:
    $ref: '#/components/schemas/Fizz'
    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:
    - zim
    - zam
    - zuzz
    Fizz:
    type: object
    - code
    - message
    properties:
    a:
    type: string
    Fuzz:
    type: object
    allOf:
    - type: object
    - $ref: '#/components/schemas/Fizz'
    - properties:
    b:
    type: boolean
    required:
    - b
    code:
    type: integer
    format: int32
    message:
    type: string
  2. iainconnor revised this gist Aug 15, 2017. 1 changed file with 39 additions and 98 deletions.
    137 changes: 39 additions & 98 deletions swagger.yaml
    Original file line number Diff line number Diff line change
    @@ -1,108 +1,49 @@
    openapi: 3.0.0
    info:
    version: a.bc
    title: Swagger Petstore
    description: Foobar
    version: '1.0'
    title: Demo
    description: 'Just a demonstration. · Generated with ❤ by GameMaker · https://github.com/iainconnor/game-maker.'
    servers:
    - url: 'http://petstore.swagger.io/v1'
    - url: 'http://www.mydemo.com/rest_api/foo'
    paths:
    /pets:
    get:
    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/Pets'
    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:
    summary: Create a pet
    operationId: createPets
    tags:
    - pets
    responses:
    '201':
    description: Null response
    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:
    Pet:
    required:
    - id
    - name
    Bar:
    type: object
    properties:
    id:
    type: integer
    format: int64
    name:
    type: string
    tag:
    type: string
    Pets:
    type: array
    items:
    $ref: '#/components/schemas/Pet'
    Error:
    zim:
    oneOf:
    - type: string
    - type: integer
    zam:
    oneOf:
    - type: array
    items:
    type: string
    - type: array
    items:
    $ref: '#/components/schemas/Fuzz'
    - type: boolean
    zuzz:
    type: array
    items:
    $ref: '#/components/schemas/Fizz'
    required:
    - code
    - message
    - zim
    - zam
    - zuzz
    Fizz:
    type: object
    properties:
    code:
    type: integer
    format: int32
    message:
    a:
    type: string
    Fuzz:
    type: object
    allOf:
    - type: object
    - $ref: '#/components/schemas/Fizz'
    - properties:
    b:
    type: boolean
    required:
    - b
  3. iainconnor created this gist Aug 14, 2017.
    108 changes: 108 additions & 0 deletions swagger.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,108 @@
    openapi: 3.0.0
    info:
    version: a.bc
    title: Swagger Petstore
    description: Foobar
    servers:
    - url: 'http://petstore.swagger.io/v1'
    paths:
    /pets:
    get:
    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/Pets'
    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:
    summary: Create a pet
    operationId: createPets
    tags:
    - pets
    responses:
    '201':
    description: Null response
    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:
    Pet:
    required:
    - id
    - name
    properties:
    id:
    type: integer
    format: int64
    name:
    type: string
    tag:
    type: string
    Pets:
    type: array
    items:
    $ref: '#/components/schemas/Pet'
    Error:
    required:
    - code
    - message
    properties:
    code:
    type: integer
    format: int32
    message:
    type: string