Created
September 21, 2016 21:54
-
-
Save hugohil/5f7632961402f9bc9c7ceb2f23bc9090 to your computer and use it in GitHub Desktop.
Base swagger API definition
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: '1.0.0' | |
title: My API | |
description: A sample API to start hacking with swagger | |
contact: | |
name: John Doe | |
email: [email protected] | |
url: http://example.com | |
license: | |
name: MIT | |
url: http://opensource.org/licenses/MIT | |
host: api.myservice.com | |
basePath: /v1 | |
schemes: | |
- http | |
consumes: | |
- application/json | |
produces: | |
- application/json | |
paths: | |
/items: | |
get: | |
description: Returns all tiems | |
produces: | |
- application/json | |
- application/xml | |
responses: | |
'200': | |
description: item response | |
schema: | |
type: array | |
items: | |
$ref: '#/definitions/item' | |
default: | |
description: unexpected error | |
schema: | |
$ref: '#/definitions/errorModel' | |
post: | |
description: Creates a new item in the store. | |
operationId: addItem | |
produces: | |
- application/json | |
parameters: | |
- name: item | |
in: body | |
description: Pet to add to the store | |
required: true | |
schema: | |
$ref: '#/definitions/newItem' | |
responses: | |
'201': | |
description: item response | |
schema: | |
$ref: '#/definitions/item' | |
default: | |
description: unexpected error | |
schema: | |
$ref: '#/definitions/errorModel' | |
definitions: | |
item: | |
type: object | |
required: | |
- id | |
- name | |
properties: | |
id: | |
type: integer | |
format: int64 | |
name: | |
type: string | |
newItem: | |
type: object | |
required: | |
- name | |
properties: | |
id: | |
type: integer | |
format: int64 | |
name: | |
type: string | |
errorModel: | |
type: object | |
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