Skip to content

Instantly share code, notes, and snippets.

@lukereding
Created June 2, 2017 15:19
Show Gist options
  • Select an option

  • Save lukereding/58b53e37511080d0219241a63a5eb5d8 to your computer and use it in GitHub Desktop.

Select an option

Save lukereding/58b53e37511080d0219241a63a5eb5d8 to your computer and use it in GitHub Desktop.
test_swag_yaml
swagger: '2.0'
info:
description: >-
This is a simple example of a REST API deployed on Anaconda Enterprise and
documented with Swagger UI.
version: 2017.06.02
title: quotes
termsOfService: 'http://swagger.io/terms/'
contact:
email: [email protected]
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
host: 'enterprise.demo.continuum.io:30640'
basePath: /
tags:
- name: quotes
description: retrieve JSON quotations
- name: hello
description: says 'hello'!
schemes:
- http
paths:
/quote:
get:
tags:
- quotes
summary: Returns a list of quotations.
description: Shows all three quotations.
produces:
- application/json
responses:
'200':
description: OK
schema:
$ref: '#/definitions/return_quotation'
'/quote/{quote_number}':
get:
tags:
- quotes
summary: Returns one of the quotations
description: Returns one of the quotations
parameters:
- name: quote_number
in: path
required: true
description: Number from 1 - 3 giving the type of quotation number to return.
responses:
'200':
description: OK
schema:
$ref: '#/definitions/return_quotation'
/hello:
get:
tags:
- hello
summary: Returns 'Hello Stranger!' by default. Use POST method to change the name
description: Says hello.
produces:
- application/json
responses:
'200':
description: OK
schema:
$ref: '#/definitions/say_hello'
post:
tags:
- hello
summary: Post a new name.
description: Post a new name.
produces:
- application/json
parameters:
- in: body
name: name
required: false
description: 'JSON data giving the new name, e.g. {''name'':''Harry''}'
schema:
$ref: '#/definitions/post_name'
responses:
'200':
description: OK
schema:
$ref: '#/definitions/say_hello'
'405':
description: method not allowed
'415':
description: unsupported media type
definitions:
post_name:
properties:
name:
type: string
required:
- name
say_hello:
properties:
hello:
type: string
required:
- hello
return_quotation:
properties:
quote_number:
type: string
required:
- quote_number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment