Skip to content

Instantly share code, notes, and snippets.

@DavidBiesack
Last active May 17, 2017 19:24
Show Gist options
  • Save DavidBiesack/4f3008fb7a035b2aebf7068ebcd4aeca to your computer and use it in GitHub Desktop.
Save DavidBiesack/4f3008fb7a035b2aebf7068ebcd4aeca to your computer and use it in GitHub Desktop.
simple-openapi.yaml for swagger-codegen issue
swagger: "2.0"
info:
title: Sample REST API
description: A sample REST API for swagger-codegen and apidoc
version: "1"
contact:
name: David Biesack
email: David.Biesack@sas.com
externalDocs:
description: More information
url: http://www.example.com/more/information
schemes:
- http
basePath: /sample
tags:
- name: Thing 1
description: Thing 2's brother
paths:
/things:
post:
summary: Create a new thing
description: Creates a new thing based on the representation in the request body.
tags:
- Things
consumes:
- application/vnd.sas.thing+json
- application/json
produces:
- application/vnd.sas.thing+json
- application/json
parameters:
- name: thing
in: body
required: true
schema:
$ref: "#/definitions/createThing"
description: The representation of a thing.
responses:
"201":
description: A thing was created.
schema:
$ref: "#/definitions/thing"
headers:
Location:
description: The URL of the thing.
type: string
format: uri
ETag:
description: The entity tag for the thing.
type: string
Last-Modified:
description: The time stamp in `EEE, dd MMM yyyy HH:mm:ss GMT` format when the thing was last modified.
type: string
"400":
description: The request was invalid.
definitions:
createThing:
title: Create a Thing
description: The representation used to create a new thing.
properties:
type:
type: string
description: The type of thing.
enum:
- typeA
- typeB
- typeC
- typeD
name:
type: string
description: The name of this thing.
version:
type: integer
format: int32
description: The version number of the thing representation.
This representation is version 1.
description:
type: string
description: The description of the thing.
updateThing:
title: Update a Thing
description: The representation used to update a thing.
required:
- id
allOf:
- $ref: "#/definitions/createThing"
- type: object
properties:
id:
type: string
description: The unique identifier for the thing.
thingSummary:
title: A Thing Summary
description: The summary representation of a thing.
allOf:
- $ref: "#/definitions/updateThing"
- type: object
properties:
text:
description: The text data for this thing
type: string
thing:
title: A Thing
description: The representation of a thing.
allOf:
- $ref: "#/definitions/thingSummary"
- type: object
properties:
xyzField:
type: string
description: The derived xyz value of the thing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment