fork of hey-api/openapi-ts because I need some additional things
1openapi: 3.0.4
2info:
3 title: OpenAPI 3.0.4 oRPC example
4 version: 1
5paths:
6 /users:
7 get:
8 tags:
9 - users
10 operationId: getUsers
11 summary: Get all users
12 parameters:
13 - name: limit
14 in: query
15 description: Maximum number of users to return
16 required: false
17 schema:
18 type: integer
19 default: 10
20 - name: offset
21 in: query
22 description: Number of users to skip
23 required: false
24 schema:
25 type: integer
26 default: 0
27 responses:
28 '200':
29 description: List of users
30 content:
31 application/json:
32 schema:
33 type: array
34 items:
35 $ref: '#/components/schemas/User'
36 post:
37 tags:
38 - users
39 operationId: createUser
40 summary: Create a new user
41 requestBody:
42 required: true
43 content:
44 application/json:
45 schema:
46 $ref: '#/components/schemas/CreateUserInput'
47 responses:
48 '201':
49 description: User created
50 content:
51 application/json:
52 schema:
53 $ref: '#/components/schemas/User'
54 /users/{userId}:
55 get:
56 tags:
57 - users
58 operationId: getUserById
59 summary: Get a user by ID
60 parameters:
61 - name: userId
62 in: path
63 description: User ID
64 required: true
65 schema:
66 type: string
67 responses:
68 '200':
69 description: User found
70 content:
71 application/json:
72 schema:
73 $ref: '#/components/schemas/User'
74 put:
75 tags:
76 - users
77 operationId: updateUser
78 summary: Update a user
79 parameters:
80 - name: userId
81 in: path
82 description: User ID
83 required: true
84 schema:
85 type: string
86 requestBody:
87 required: true
88 content:
89 application/json:
90 schema:
91 $ref: '#/components/schemas/UpdateUserInput'
92 responses:
93 '200':
94 description: User updated
95 content:
96 application/json:
97 schema:
98 $ref: '#/components/schemas/User'
99 delete:
100 tags:
101 - users
102 operationId: deleteUser
103 summary: Delete a user
104 parameters:
105 - name: userId
106 in: path
107 description: User ID
108 required: true
109 schema:
110 type: string
111 - name: X-Request-Id
112 in: header
113 description: Request ID for tracing
114 required: false
115 schema:
116 type: string
117 responses:
118 '204':
119 description: User deleted
120 /posts:
121 get:
122 tags:
123 - posts
124 operationId: getPosts
125 summary: Get all posts
126 parameters:
127 - name: authorId
128 in: query
129 description: Filter by author ID
130 required: false
131 schema:
132 type: string
133 - name: status
134 in: query
135 description: Filter by status
136 required: false
137 schema:
138 type: string
139 enum:
140 - draft
141 - published
142 - archived
143 responses:
144 '200':
145 description: List of posts
146 content:
147 application/json:
148 schema:
149 type: array
150 items:
151 $ref: '#/components/schemas/Post'
152 post:
153 tags:
154 - posts
155 operationId: createPost
156 summary: Create a new post
157 parameters:
158 - name: X-Author-Id
159 in: header
160 description: Author ID
161 required: true
162 schema:
163 type: string
164 requestBody:
165 required: true
166 content:
167 application/json:
168 schema:
169 $ref: '#/components/schemas/CreatePostInput'
170 responses:
171 '201':
172 description: Post created
173 content:
174 application/json:
175 schema:
176 $ref: '#/components/schemas/Post'
177 /posts/{postId}:
178 get:
179 tags:
180 - posts
181 operationId: getPostById
182 summary: Get a post by ID
183 parameters:
184 - name: postId
185 in: path
186 description: Post ID
187 required: true
188 schema:
189 type: string
190 - name: includeComments
191 in: query
192 description: Include comments in response
193 required: false
194 schema:
195 type: boolean
196 default: false
197 responses:
198 '200':
199 description: Post found
200 content:
201 application/json:
202 schema:
203 $ref: '#/components/schemas/Post'
204components:
205 schemas:
206 User:
207 type: object
208 required:
209 - id
210 - email
211 - name
212 properties:
213 id:
214 type: string
215 email:
216 type: string
217 format: email
218 name:
219 type: string
220 createdAt:
221 type: string
222 format: date-time
223 CreateUserInput:
224 type: object
225 required:
226 - email
227 - name
228 properties:
229 email:
230 type: string
231 format: email
232 name:
233 type: string
234 password:
235 type: string
236 minLength: 8
237 UpdateUserInput:
238 type: object
239 properties:
240 email:
241 type: string
242 format: email
243 name:
244 type: string
245 Post:
246 type: object
247 required:
248 - id
249 - title
250 - content
251 - authorId
252 properties:
253 id:
254 type: string
255 title:
256 type: string
257 content:
258 type: string
259 authorId:
260 type: string
261 status:
262 type: string
263 enum:
264 - draft
265 - published
266 - archived
267 createdAt:
268 type: string
269 format: date-time
270 CreatePostInput:
271 type: object
272 required:
273 - title
274 - content
275 properties:
276 title:
277 type: string
278 content:
279 type: string
280 status:
281 type: string
282 enum:
283 - draft
284 - published
285 default: draft