fork of hey-api/openapi-ts because I need some additional things
1swagger: '2.0'
2info:
3 title: Swagger 2.0 external example
4 version: 1
5# Paths using external references
6paths:
7 /external-model:
8 get:
9 summary: Get external model
10 parameters:
11 - $ref: '#/parameters/ExternalIdParam'
12 - $ref: '#/parameters/ExternalUuidParam'
13 responses:
14 '200':
15 $ref: '#/responses/ExternalModelResponse'
16 '400':
17 $ref: '#/responses/ExternalUuidResponse'
18 post:
19 summary: Create external model
20 parameters:
21 - $ref: '#/parameters/ExternalModelBody'
22 responses:
23 '201':
24 $ref: '#/responses/ExternalModelResponse'
25 '422':
26 $ref: '#/responses/ExternalUnionResponse'
27
28 /external-uuid:
29 get:
30 summary: Get external UUID
31 parameters:
32 - $ref: '#/parameters/ExternalUuidParam'
33 responses:
34 '200':
35 $ref: '#/responses/ExternalUuidResponse'
36 put:
37 summary: Update external UUID
38 parameters:
39 - $ref: '#/parameters/ExternalUuidBody'
40 responses:
41 '200':
42 $ref: '#/responses/ExternalUuidResponse'
43
44 /external-nested:
45 get:
46 summary: Get external nested object
47 parameters:
48 - $ref: '#/parameters/ExternalDeepParam'
49 responses:
50 '200':
51 $ref: '#/responses/ExternalNestedResponse'
52 post:
53 summary: Create external nested object
54 parameters:
55 - $ref: '#/parameters/ExternalNestedBody'
56 responses:
57 '201':
58 $ref: '#/responses/ExternalNestedResponse'
59
60 /external-mixed:
61 get:
62 summary: Get mixed external data
63 parameters:
64 - $ref: '#/parameters/ExternalIdParam'
65 - $ref: '#/parameters/ExternalUuidParam'
66 - $ref: '#/parameters/ExternalDeepParam'
67 - $ref: '#/parameters/ExternalNumericParam'
68 responses:
69 '200':
70 $ref: '#/responses/ExternalArrayResponse'
71 post:
72 summary: Create mixed external data
73 parameters:
74 - $ref: '#/parameters/ExternalMixedBody'
75 responses:
76 '201':
77 $ref: '#/responses/ExternalModelResponse'
78
79 /external-array:
80 get:
81 summary: Get array of external models
82 responses:
83 '200':
84 $ref: '#/responses/ExternalArrayResponse'
85 post:
86 summary: Create array of external models
87 parameters:
88 - name: body
89 in: body
90 required: true
91 schema:
92 type: array
93 items:
94 $ref: './external-shared.json#/definitions/ExternalSharedModel'
95 responses:
96 '201':
97 $ref: '#/responses/ExternalArrayResponse'
98
99 /external-union:
100 get:
101 summary: Get union of external types
102 responses:
103 '200':
104 $ref: '#/responses/ExternalUnionResponse'
105 post:
106 summary: Create union of external types
107 parameters:
108 - name: body
109 in: body
110 required: true
111 schema:
112 oneOf:
113 - $ref: './external-shared.json#/definitions/ExternalSharedModel'
114 - $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
115 - $ref: './external-shared.json#/definitions/ExternalNested'
116 responses:
117 '201':
118 $ref: '#/responses/ExternalUnionResponse'
119
120 /external-properties/{id}:
121 get:
122 summary: Get external properties
123 parameters:
124 - name: id
125 in: path
126 required: true
127 schema:
128 $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/id'
129 - name: uuid
130 in: query
131 schema:
132 $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
133 - name: deep
134 in: header
135 schema:
136 $ref: './external-shared.json#/definitions/ExternalNested/properties/inner/properties/deep'
137 responses:
138 '200':
139 schema:
140 type: object
141 properties:
142 id:
143 $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/id'
144 name:
145 $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/name'
146 uuid:
147 $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
148 deep:
149 $ref: './external-shared.json#/definitions/ExternalNested/properties/inner/properties/deep'
150 numeric:
151 $ref: './external-shared.json#/definitions/ExternalNestedNumeric/properties/0/properties/1'
152
153# Definitions (equivalent to components/schemas in OpenAPI 3.0)
154definitions:
155 # Basic external schema references (multiple uses of each type)
156 ExternalSchemaA:
157 description: External schema (A)
158 $ref: './external-shared.json#/definitions/ExternalSharedModel'
159 ExternalSchemaB:
160 description: External schema (B) - second use of ExternalSharedModel
161 $ref: './external-shared.json#/definitions/ExternalSharedModel'
162 ExternalSchemaC:
163 description: External schema (C) - third use of ExternalSharedModel
164 $ref: './external-shared.json#/definitions/ExternalSharedModel'
165
166 # Path-based references using /path syntax
167 ExternalSchemaPathA:
168 description: External schema via path reference (A)
169 $ref: './external-shared.json#/definitions/ExternalSharedModel'
170 ExternalSchemaPathB:
171 description: External schema via path reference (B) - second use
172 $ref: './external-shared.json#/definitions/ExternalSharedModel'
173
174 # UUID type references (multiple uses)
175 ExternalSchemaPropertyA:
176 description: External schema property (A)
177 type: object
178 properties:
179 uuid1:
180 $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
181 ExternalSchemaPropertyB:
182 description: External schema property (B) - second use of UUID
183 type: object
184 properties:
185 uuid2:
186 $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
187 ExternalSchemaPropertyC:
188 description: External schema property (C) - third use of UUID
189 type: object
190 properties:
191 uuid3:
192 $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
193
194 # Duplicate refs in same schema
195 ExternalSchemaPropertyD:
196 description: External schema property with duplicate refs (D)
197 type: object
198 properties:
199 uuid4:
200 $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
201 uuid5:
202 $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
203
204 # External property references
205 ExternalSchemaExternalProp:
206 description: External schema property via external property ref (id)
207 type: object
208 properties:
209 id3:
210 $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/id'
211 id4:
212 $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/id'
213
214 # Alias references
215 ExternalSchemaExternalPropAlias:
216 description: Alias to external property via component property ref
217 type: object
218 properties:
219 id5:
220 $ref: '#/definitions/ExternalSchemaExternalProp/properties/id3'
221 id6:
222 $ref: '#/definitions/ExternalSchemaExternalProp/properties/id4'
223
224 # Nested property references (multiple uses)
225 ExternalDoubleNestedProp:
226 description: External double nested prop via property ref
227 type: object
228 properties:
229 deep1:
230 $ref: './external-shared.json#/definitions/ExternalNested/properties/inner/properties/deep'
231 deep2:
232 $ref: './external-shared.json#/definitions/ExternalNested/properties/inner/properties/deep'
233
234 # Numeric property references (multiple uses)
235 ExternalDoubleNestedNumeric:
236 description: External double nested numeric properties
237 type: object
238 properties:
239 numeric1:
240 $ref: './external-shared.json#/definitions/ExternalNestedNumeric/properties/0/properties/1'
241 numeric2:
242 $ref: './external-shared.json#/definitions/ExternalNestedNumeric/properties/0/properties/1'
243
244 # Complex nested object references
245 ExternalNestedObjectA:
246 description: External nested object reference (A)
247 $ref: './external-shared.json#/definitions/ExternalNested'
248 ExternalNestedObjectB:
249 description: External nested object reference (B) - second use
250 $ref: './external-shared.json#/definitions/ExternalNested'
251
252 # Numeric nested object references
253 ExternalNestedNumericObjectA:
254 description: External numeric nested object reference (A)
255 $ref: './external-shared.json#/definitions/ExternalNestedNumeric'
256 ExternalNestedNumericObjectB:
257 description: External numeric nested object reference (B) - second use
258 $ref: './external-shared.json#/definitions/ExternalNestedNumeric'
259
260 # Mixed property references
261 ExternalMixedProperties:
262 description: Mixed external property references
263 type: object
264 properties:
265 id7:
266 $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/id'
267 name1:
268 $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/name'
269 uuid6:
270 $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
271 deep3:
272 $ref: './external-shared.json#/definitions/ExternalNested/properties/inner/properties/deep'
273 numeric3:
274 $ref: './external-shared.json#/definitions/ExternalNestedNumeric/properties/0/properties/1'
275
276 # Array of external references
277 ExternalArraySchema:
278 description: Array containing external references
279 type: object
280 properties:
281 items:
282 type: array
283 items:
284 $ref: './external-shared.json#/definitions/ExternalSharedModel'
285 uuidItems:
286 type: array
287 items:
288 $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
289
290 # Union types with external references
291 ExternalUnionSchema:
292 description: Union type with external references
293 oneOf:
294 - $ref: './external-shared.json#/definitions/ExternalSharedModel'
295 - $ref: './external-shared.json#/definitions/ExternalSharedModel'
296 - $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
297 - $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
298
299 # AllOf with external references
300 ExternalAllOfSchema:
301 description: AllOf with external references
302 allOf:
303 - $ref: './external-shared.json#/definitions/ExternalSharedModel'
304 - $ref: './external-shared.json#/definitions/ExternalSharedModel'
305 - type: object
306 properties:
307 additional:
308 $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
309
310 # AnyOf with external references
311 ExternalAnyOfSchema:
312 description: AnyOf with external references
313 anyOf:
314 - $ref: './external-shared.json#/definitions/ExternalNested'
315 - $ref: './external-shared.json#/definitions/ExternalNested'
316 - $ref: './external-shared.json#/definitions/ExternalNestedNumeric'
317 - $ref: './external-shared.json#/definitions/ExternalNestedNumeric'
318
319# Parameters using external references
320parameters:
321 ExternalIdParam:
322 name: id
323 in: path
324 required: true
325 schema:
326 $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/id'
327 ExternalUuidParam:
328 name: uuid
329 in: query
330 schema:
331 $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
332 ExternalDeepParam:
333 name: deep
334 in: header
335 schema:
336 $ref: './external-shared.json#/definitions/ExternalNested/properties/inner/properties/deep'
337 ExternalNumericParam:
338 name: numeric
339 in: query
340 schema:
341 $ref: './external-shared.json#/definitions/ExternalNestedNumeric/properties/0/properties/1'
342
343 # Request bodies using external references
344 ExternalModelBody:
345 name: body
346 in: body
347 description: Request body using external model
348 required: true
349 schema:
350 $ref: './external-shared.json#/definitions/ExternalSharedModel'
351 ExternalUuidBody:
352 name: body
353 in: body
354 description: Request body using external UUID
355 schema:
356 $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
357 ExternalNestedBody:
358 name: body
359 in: body
360 description: Request body using external nested object
361 schema:
362 $ref: './external-shared.json#/definitions/ExternalNested'
363 ExternalMixedBody:
364 name: body
365 in: body
366 description: Request body with mixed external properties
367 schema:
368 type: object
369 properties:
370 id:
371 $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/id'
372 name:
373 $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/name'
374 uuid:
375 $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
376 deep:
377 $ref: './external-shared.json#/definitions/ExternalNested/properties/inner/properties/deep'
378
379# Responses using external references
380responses:
381 ExternalModelResponse:
382 description: Response using external model
383 schema:
384 $ref: './external-shared.json#/definitions/ExternalSharedModel'
385 ExternalUuidResponse:
386 description: Response using external UUID
387 schema:
388 $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
389 ExternalNestedResponse:
390 description: Response using external nested object
391 schema:
392 $ref: './external-shared.json#/definitions/ExternalNested'
393 ExternalArrayResponse:
394 description: Response with array of external models
395 schema:
396 type: array
397 items:
398 $ref: './external-shared.json#/definitions/ExternalSharedModel'
399 ExternalUnionResponse:
400 description: Response with union of external types
401 schema:
402 oneOf:
403 - $ref: './external-shared.json#/definitions/ExternalSharedModel'
404 - $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid'
405 - $ref: './external-shared.json#/definitions/ExternalNested'