Created
January 28, 2020 11:28
-
-
Save adambutler/009e0e1219686635aa30c82443b3741b to your computer and use it in GitHub Desktop.
This file contains 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
openapi: "3.0.0" | |
info: | |
version: 1.0.0 | |
title: Swagger Todos | |
license: | |
name: MIT | |
servers: | |
- url: http://todostore.swagger.io/v1 | |
paths: | |
/: | |
get: | |
summary: List all todos | |
operationId: listTodos | |
tags: | |
- todos | |
responses: | |
'200': | |
description: A paged array of todos | |
content: | |
application/json: | |
schema: | |
$ref: "#/components/schemas/Todos" | |
post: | |
summary: Create a todo | |
operationId: createTodos | |
tags: | |
- todos | |
parameters: | |
- name: title | |
in: query | |
required: true | |
description: The todo title | |
schema: | |
type: string | |
- name: checked | |
in: query | |
required: false | |
description: Item is completed | |
schema: | |
type: boolean | |
default: false | |
responses: | |
'201': | |
description: Returns todo | |
content: | |
application/json: | |
schema: | |
$ref: "#/components/schemas/Todo" | |
/{id}: | |
get: | |
summary: Info for a specific todo | |
operationId: showTodoById | |
tags: | |
- todos | |
parameters: | |
- name: id | |
in: path | |
required: true | |
description: The id of the todo to retrieve | |
schema: | |
type: string | |
responses: | |
'200': | |
description: Expected response to a valid request | |
content: | |
application/json: | |
schema: | |
$ref: "#/components/schemas/Todo" | |
delete: | |
summary: Remove a todo | |
operationId: destroyTodoById | |
tags: | |
- todos | |
parameters: | |
- name: id | |
in: path | |
required: true | |
description: The id of the todo to retrieve | |
schema: | |
type: string | |
responses: | |
'204': | |
description: No content | |
components: | |
schemas: | |
Todo: | |
type: object | |
required: | |
- id | |
- title | |
- checked | |
properties: | |
id: | |
type: integer | |
format: int64 | |
example: 1 | |
title: | |
type: string | |
example: 'First things first' | |
checked: | |
type: boolean | |
default: false | |
Todos: | |
type: array | |
items: | |
$ref: "#/components/schemas/Todo" | |
Error: | |
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