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