Skip to content

Commit e0a7104

Browse files
Add openapi specs
1 parent 2e1a1fc commit e0a7104

22 files changed

+10899
-0
lines changed

docs/openapi/README.md

Lines changed: 297 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,297 @@
1+
#/components/schemas/Task'
2+
post:
3+
summary: Create a new task
4+
requestBody:
5+
required: true
6+
content:
7+
application/json:
8+
schema:
9+
type: object
10+
properties:
11+
title:
12+
type: string
13+
user_id:
14+
type: string
15+
note_id:
16+
type: string
17+
responses:
18+
'201':
19+
description: Task created successfully
20+
content:
21+
application/json:
22+
schema:
23+
$ref: '#/components/schemas/Task'
24+
'400':
25+
description: Invalid input
26+
'500':
27+
description: Internal server error
28+
29+
/tasks/{id}:
30+
get:
31+
summary: Get a task by ID
32+
parameters:
33+
- name: id
34+
in: path
35+
required: true
36+
schema:
37+
type: string
38+
responses:
39+
'200':
40+
description: Task found
41+
content:
42+
application/json:
43+
schema:
44+
$ref: '#/components/schemas/Task'
45+
'404':
46+
description: Task not found
47+
'500':
48+
description: Internal server error
49+
put:
50+
summary: Update a task
51+
parameters:
52+
- name: id
53+
in: path
54+
required: true
55+
schema:
56+
type: string
57+
requestBody:
58+
required: true
59+
content:
60+
application/json:
61+
schema:
62+
type: object
63+
properties:
64+
title:
65+
type: string
66+
responses:
67+
'200':
68+
description: Task updated successfully
69+
content:
70+
application/json:
71+
schema:
72+
$ref: '#/components/schemas/Task'
73+
'404':
74+
description: Task not found
75+
'500':
76+
description: Internal server error
77+
delete:
78+
summary: Delete a task
79+
parameters:
80+
- name: id
81+
in: path
82+
required: true
83+
schema:
84+
type: string
85+
responses:
86+
'204':
87+
description: Task deleted successfully
88+
'404':
89+
description: Task not found
90+
'500':
91+
description: Internal server error
92+
93+
/trash:
94+
get:
95+
summary: Get all trashed items
96+
responses:
97+
'200':
98+
description: A list of trashed items
99+
content:
100+
application/json:
101+
schema:
102+
type: array
103+
items:
104+
$ref: '#/components/schemas/TrashedItem'
105+
delete:
106+
summary: Empty trash
107+
responses:
108+
'200':
109+
description: Trash emptied successfully
110+
'500':
111+
description: Internal server error
112+
113+
/trash/restore/{type}/{id}:
114+
post:
115+
summary: Restore a trashed item
116+
parameters:
117+
- name: type
118+
in: path
119+
required: true
120+
schema:
121+
type: string
122+
- name: id
123+
in: path
124+
required: true
125+
schema:
126+
type: string
127+
responses:
128+
'200':
129+
description: Item restored successfully
130+
'400':
131+
description: Invalid input
132+
'500':
133+
description: Internal server error
134+
135+
/trash/{type}/{id}:
136+
delete:
137+
summary: Permanently delete a trashed item
138+
parameters:
139+
- name: type
140+
in: path
141+
required: true
142+
schema:
143+
type: string
144+
- name: id
145+
in: path
146+
required: true
147+
schema:
148+
type: string
149+
responses:
150+
'200':
151+
description: Item permanently deleted
152+
'400':
153+
description: Invalid input
154+
'500':
155+
description: Internal server error
156+
157+
/notebooks:
158+
get:
159+
summary: Get all notebooks
160+
responses:
161+
'200':
162+
description: A list of notebooks
163+
content:
164+
application/json:
165+
schema:
166+
type: array
167+
items:
168+
$ref: '#/components/schemas/Notebook'
169+
post:
170+
summary: Create a new notebook
171+
requestBody:
172+
required: true
173+
content:
174+
application/json:
175+
schema:
176+
type: object
177+
properties:
178+
name:
179+
type: string
180+
user_id:
181+
type: string
182+
responses:
183+
'201':
184+
description: Notebook created successfully
185+
content:
186+
application/json:
187+
schema:
188+
$ref: '#/components/schemas/Notebook'
189+
'400':
190+
description: Invalid input
191+
'500':
192+
description: Internal server error
193+
194+
/notebooks/{id}:
195+
get:
196+
summary: Get a notebook by ID
197+
parameters:
198+
- name: id
199+
in: path
200+
required: true
201+
schema:
202+
type: string
203+
responses:
204+
'200':
205+
description: Notebook found
206+
content:
207+
application/json:
208+
schema:
209+
$ref: '#/components/schemas/Notebook'
210+
'404':
211+
description: Notebook not found
212+
'500':
213+
description: Internal server error
214+
put:
215+
summary: Update a notebook
216+
parameters:
217+
- name: id
218+
in: path
219+
required: true
220+
schema:
221+
type: string
222+
requestBody:
223+
required: true
224+
content:
225+
application/json:
226+
schema:
227+
type: object
228+
properties:
229+
name:
230+
type: string
231+
responses:
232+
'200':
233+
description: Notebook updated successfully
234+
content:
235+
application/json:
236+
schema:
237+
$ref: '#/components/schemas/Notebook'
238+
'404':
239+
description: Notebook not found
240+
'500':
241+
description: Internal server error
242+
delete:
243+
summary: Delete a notebook
244+
parameters:
245+
- name: id
246+
in: path
247+
required: true
248+
schema:
249+
type: string
250+
responses:
251+
'204':
252+
description: Notebook deleted successfully
253+
'404':
254+
description: Notebook not found
255+
'500':
256+
description: Internal server error
257+
258+
components:
259+
schemas:
260+
Task:
261+
type: object
262+
properties:
263+
id:
264+
type: string
265+
title:
266+
type: string
267+
user_id:
268+
type: string
269+
note_id:
270+
type: string
271+
TrashedItem:
272+
type: object
273+
properties:
274+
id:
275+
type: string
276+
title:
277+
type: string
278+
type:
279+
type: string
280+
Notebook:
281+
type: object
282+
properties:
283+
id:
284+
type: string
285+
name:
286+
type: string
287+
user_id:
288+
type: string
289+
```
290+
291+
### Notes:
292+
1. **Schemas**: The `Task`, `TrashedItem`, and `Notebook` schemas are defined under `components.schemas`. You can expand these schemas based on your actual data structure.
293+
2. **Responses**: Each endpoint has responses defined for success and error cases. You can customize the error messages and codes as needed.
294+
3. **Authentication**: The specification does not include authentication details. If your API requires authentication (e.g., JWT tokens), you may want to add security definitions.
295+
4. **Additional Endpoints**: If there are more endpoints (like for notes, roles, etc.), you can add them similarly to the above structure.
296+
297+
Feel free to modify the specification according to your specific requirements or additional endpoints that may not have been covered in the provided code.

0 commit comments

Comments
 (0)