Skip to content

Instantly share code, notes, and snippets.

@ygkn
Created April 25, 2023 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ygkn/ee1fe6f0af798670f820bd357cf05cd9 to your computer and use it in GitHub Desktop.
Save ygkn/ee1fe6f0af798670f820bd357cf05cd9 to your computer and use it in GitHub Desktop.
openapi: 3.1.0
info:
title: TODO 管理ツール API
version: 1.0.0
servers:
- url: https://dev.example.com/api/v1
description: エンドポイント(開発)
- url: https://example.com/api/v1
description: エンドポイント(本番)
tags:
- name: todo
description: Operations about todo
paths:
/todos:
post:
tags:
- todo
summary: Add a new todo
requestBody:
description: Create a new todo
content:
application/json:
schema:
$ref: '#/components/schemas/Todo'
application/xml:
schema:
$ref: '#/components/schemas/Todo'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/Todo'
required: true
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Todo'
application/xml:
schema:
$ref: '#/components/schemas/Todo'
'405':
description: Invalid input
get:
tags:
- todo
summary: List todos
responses:
'200':
description: Successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Todo'
application/xml:
schema:
type: array
items:
$ref: '#/components/schemas/Todo'
'405':
description: Invalid input
/todos/{todoId}:
get:
tags:
- todo
summary: find todo by id
parameters:
- name: todoId
in: path
description: ID of todo to return
required: true
schema:
$ref: '#/components/schemas/Todo/properties/id'
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Todo'
application/xml:
schema:
$ref: '#/components/schemas/Todo'
'405':
description: Invalid input
put:
tags:
- todo
summary: Update an existing todo
parameters:
- name: todoId
in: path
description: ID of todo to update
required: true
schema:
$ref: '#/components/schemas/Todo/properties/id'
requestBody:
description: Update an existent todo
content:
application/json:
schema:
$ref: '#/components/schemas/Todo'
application/xml:
schema:
$ref: '#/components/schemas/Todo'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/Todo'
required: true
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Todo'
application/xml:
schema:
$ref: '#/components/schemas/Todo'
'400':
description: Invalid ID supplied
'404':
description: Todo not found
'405':
description: Validation exception
delete:
tags:
- todo
summary: Update an existing todo
parameters:
- name: todoId
in: path
description: ID of todo to update
required: true
schema:
$ref: '#/components/schemas/Todo/properties/id'
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Todo'
application/xml:
schema:
$ref: '#/components/schemas/Todo'
'400':
description: Invalid ID supplied
'404':
description: Todo not found
'405':
description: Validation exception
components:
schemas:
Todo:
type: object
properties:
id:
type: integer
format: int64
example: 10
title:
type: string
status:
type: string
enum:
- to do
- doing
- done
xml:
name: todo
ApiResponse:
type: object
properties:
code:
type: integer
format: int32
type:
type: string
message:
type: string
xml:
name: '##default'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment