Skip to content

Instantly share code, notes, and snippets.

@wtrocki
Created September 6, 2019 11:31
Show Gist options
  • Save wtrocki/2ece5c69bc585d36d601b0ce701103f7 to your computer and use it in GitHub Desktop.
Save wtrocki/2ece5c69bc585d36d601b0ce701103f7 to your computer and use it in GitHub Desktop.
swagger: '2.0'
info:
title: CodeGen
description: A brand new API with no content. Go nuts!
version: '1.0'
consumes:
- application/json
produces:
- application/json
paths:
/tasks:
get:
summary: List All Tasks
description: Gets a list of all `Task` entities.
operationId: getTasks
responses:
'200':
description: Successful response - returns an array of `Task` entities.
schema:
type: array
items:
$ref: '#/definitions/Task'
post:
summary: Create a Task
description: Creates a new instance of a `Task`.
operationId: createTask
parameters:
-
name: body
in: body
description: A new `Task` to be created.
required: true
schema:
$ref: '#/definitions/Task'
responses:
'201':
description: Successful response.
'/tasks/{taskId}':
get:
summary: Get a Task
description: Gets the details of a single instance of a `Task`.
operationId: getTask
responses:
'200':
description: Successful response - returns a single `Task`.
schema:
$ref: '#/definitions/Task'
put:
summary: Update a Task
description: Updates an existing `Task`.
operationId: updateTask
parameters:
-
name: body
in: body
description: Updated `Task` information.
required: true
schema:
$ref: '#/definitions/Task'
responses:
'202':
description: Successful response.
delete:
summary: Delete a Task
description: Deletes an existing `Task`.
operationId: deleteTask
responses:
'204':
description: Successful response.
parameters:
-
name: taskId
in: path
description: A unique identifier for a `Task`.
required: true
type: string
definitions:
Task:
title: Root Type for Task
description: 'Task definition '
type: object
properties:
name:
type: string
description:
type: string
completed:
type: boolean
example: |-
{
"name": "test",
"description": "test",
"completed": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment