Created
January 9, 2024 15:48
-
-
Save geraldWilliam/6e2a1bdfd083d553b9c70c4fc213fd1b to your computer and use it in GitHub Desktop.
OpenAPI 3.1.0 Simple TODO Spec
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.1.0 | |
info: | |
title: A TODO list application | |
description: A simple application to handle todos. | |
version: 1.0.0 | |
license: | |
name: Eclipse Public License 2.0 | |
url: 'https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html' | |
servers: | |
- url: 'http://localhost:8080/todoapp' | |
tags: | |
- name: todo | |
description: Todo management | |
paths: | |
/todo: | |
get: | |
tags: | |
- todo | |
summary: Get the list of all todos | |
operationId: todosGetAll | |
responses: | |
200: | |
description: List of all todos | |
content: | |
application/json: | |
schema: | |
type: array | |
items: | |
$ref: '#/components/schemas/Todo' | |
default: | |
description: Generic error response | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Error' | |
post: | |
tags: | |
- todo | |
summary: Create a new todo | |
operationId: todosCreate | |
requestBody: | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Todo' | |
responses: | |
200: | |
description: The created todo | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Todo' | |
default: | |
description: Generic error response | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Error' | |
/todo/{todoId}: | |
parameters: | |
- name: todoId | |
in: path | |
description: The id of the todo | |
required: true | |
schema: | |
type: string | |
example: e1cb23d0-6cbe-4a29-b586-bfa424bc93fd | |
get: | |
tags: | |
- todo | |
summary: Get a single todo based on its id | |
operationId: todosRead | |
responses: | |
200: | |
description: Ok | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Todo' | |
default: | |
description: Generic error response | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Error' | |
put: | |
tags: | |
- todo | |
summary: Update an existing todo | |
operationId: todosUpdate | |
requestBody: | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Todo' | |
responses: | |
200: | |
description: The updated todo | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Todo' | |
default: | |
description: Generic error response | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Error' | |
delete: | |
tags: | |
- todo | |
summary: Delete an existing todo | |
operationId: todosDelete | |
responses: | |
204: | |
description: Todo deleted response | |
default: | |
description: Generic error response | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Error' | |
components: | |
schemas: | |
Todo: | |
description: Object representing a Todo | |
required: | |
- description | |
type: object | |
properties: | |
completed: | |
description: indicates if a todo is completed or not | |
type: boolean | |
description: | |
description: description of the todo | |
type: string | |
examples: | |
- My important todo | |
id: | |
description: id of the todo | |
type: string | |
readOnly: true | |
examples: | |
- e1cb23d0-6cbe-4a29-b586-bfa424bc93fd | |
Error: | |
description: Object representing an error | |
type: object | |
properties: | |
code: | |
format: int32 | |
description: Error code that identify of the error | |
type: integer | |
examples: | |
- "1000" | |
message: | |
description: Short description of the error | |
type: string | |
examples: | |
- Could not perform the todo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment