fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #424 from hey-api/fix/schemas-export

fix: do not export common properties as schemas

authored by

Lubos and committed by
GitHub
c22aabd3 b7b0859e

+23 -3373
+5
.changeset/tall-snakes-float.md
··· 1 + --- 2 + "@hey-api/openapi-ts": patch 3 + --- 4 + 5 + fix: do not export common properties as schemas
-6
packages/openapi-ts/src/utils/write/schemas.ts
··· 33 33 addSchema(name, schema); 34 34 } 35 35 } 36 - for (const name in openApi.components.parameters) { 37 - if (openApi.components.parameters.hasOwnProperty(name)) { 38 - const parameter = openApi.components.parameters[name]; 39 - addSchema(name, parameter); 40 - } 41 - } 42 36 } 43 37 } 44 38 };
-20
packages/openapi-ts/test/__snapshots__/test/generated/v3/schemas.gen.ts.snap
··· 1640 1640 }, 1641 1641 }, 1642 1642 } as const; 1643 - 1644 - export const $SimpleParameter = { 1645 - description: 'This is a reusable parameter', 1646 - name: 'parameter', 1647 - in: 'query', 1648 - required: false, 1649 - schema: { 1650 - type: 'string', 1651 - }, 1652 - } as const; 1653 - 1654 - export const $x_Foo_Bar = { 1655 - description: 'Parameter with illegal characters', 1656 - name: 'x-Foo-Bar', 1657 - in: 'header', 1658 - required: true, 1659 - schema: { 1660 - type: 'string', 1661 - }, 1662 - } as const;
-1
packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/index.ts.snap
··· 2 2 3 3 export { ApiError } from './core/ApiError'; 4 4 export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI'; 5 - export * from './schemas.gen'; 6 5 export * from './services.gen'; 7 6 export * from './types.gen';
-1662
packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/schemas.gen.ts.snap
··· 1 - // This file is auto-generated by @hey-api/openapi-ts 2 - 3 - export const $camelCaseCommentWithBreaks = { 4 - description: `Testing multiline comments in string: First line 5 - Second line 6 - 7 - Fourth line`, 8 - type: 'integer', 9 - } as const; 10 - 11 - export const $CommentWithBreaks = { 12 - description: `Testing multiline comments in string: First line 13 - Second line 14 - 15 - Fourth line`, 16 - type: 'integer', 17 - } as const; 18 - 19 - export const $CommentWithBackticks = { 20 - description: 'Testing backticks in string: `backticks` and ```multiple backticks``` should work', 21 - type: 'integer', 22 - } as const; 23 - 24 - export const $CommentWithBackticksAndQuotes = { 25 - description: `Testing backticks and quotes in string: \`backticks\`, 'quotes', "double quotes" and \`\`\`multiple backticks\`\`\` should work`, 26 - type: 'integer', 27 - } as const; 28 - 29 - export const $CommentWithSlashes = { 30 - description: 'Testing slashes in string: \backwards\\ and /forwards/// should work', 31 - type: 'integer', 32 - } as const; 33 - 34 - export const $CommentWithExpressionPlaceholders = { 35 - description: 'Testing expression placeholders in string: ${expression} should work', 36 - type: 'integer', 37 - } as const; 38 - 39 - export const $CommentWithQuotes = { 40 - description: `Testing quotes in string: 'single quote''' and "double quotes""" should work`, 41 - type: 'integer', 42 - } as const; 43 - 44 - export const $CommentWithReservedCharacters = { 45 - description: 'Testing reserved characters in string: /* inline */ and /** inline **/ should work', 46 - type: 'integer', 47 - } as const; 48 - 49 - export const $SimpleInteger = { 50 - description: 'This is a simple number', 51 - type: 'integer', 52 - } as const; 53 - 54 - export const $SimpleBoolean = { 55 - description: 'This is a simple boolean', 56 - type: 'boolean', 57 - } as const; 58 - 59 - export const $SimpleString = { 60 - description: 'This is a simple string', 61 - type: 'string', 62 - } as const; 63 - 64 - export const $NonAsciiStringæøåÆØÅöôêÊ字符串 = { 65 - description: 'A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串)', 66 - type: 'string', 67 - } as const; 68 - 69 - export const $SimpleFile = { 70 - description: 'This is a simple file', 71 - type: 'file', 72 - } as const; 73 - 74 - export const $SimpleReference = { 75 - description: 'This is a simple reference', 76 - $ref: '#/components/schemas/ModelWithString', 77 - } as const; 78 - 79 - export const $SimpleStringWithPattern = { 80 - description: 'This is a simple string', 81 - type: 'string', 82 - nullable: true, 83 - maxLength: 64, 84 - pattern: '^[a-zA-Z0-9_]*$', 85 - } as const; 86 - 87 - export const $EnumWithStrings = { 88 - description: 'This is a simple enum with strings', 89 - enum: ['Success', 'Warning', 'Error', "'Single Quote'", '"Double Quotes"', 'Non-ascii: øæåôöØÆÅÔÖ字符串'], 90 - } as const; 91 - 92 - export const $EnumWithReplacedCharacters = { 93 - enum: ["'Single Quote'", '"Double Quotes"', 'øæåôöØÆÅÔÖ字符串', 3.1, ''], 94 - type: 'string', 95 - } as const; 96 - 97 - export const $EnumWithNumbers = { 98 - description: 'This is a simple enum with numbers', 99 - enum: [1, 2, 3, 1.1, 1.2, 1.3, 100, 200, 300, -100, -200, -300, -1.1, -1.2, -1.3], 100 - default: 200, 101 - } as const; 102 - 103 - export const $EnumFromDescription = { 104 - description: 'Success=1,Warning=2,Error=3', 105 - type: 'number', 106 - } as const; 107 - 108 - export const $EnumWithExtensions = { 109 - description: 'This is a simple enum with numbers', 110 - enum: [200, 400, 500], 111 - 'x-enum-varnames': ['CUSTOM_SUCCESS', 'CUSTOM_WARNING', 'CUSTOM_ERROR'], 112 - 'x-enum-descriptions': [ 113 - 'Used when the status of something is successful', 114 - 'Used when the status of something has a warning', 115 - 'Used when the status of something has an error', 116 - ], 117 - } as const; 118 - 119 - export const $EnumWithXEnumNames = { 120 - enum: [0, 1, 2], 121 - 'x-enumNames': ['zero', 'one', 'two'], 122 - } as const; 123 - 124 - export const $ArrayWithNumbers = { 125 - description: 'This is a simple array with numbers', 126 - type: 'array', 127 - items: { 128 - type: 'integer', 129 - }, 130 - } as const; 131 - 132 - export const $ArrayWithBooleans = { 133 - description: 'This is a simple array with booleans', 134 - type: 'array', 135 - items: { 136 - type: 'boolean', 137 - }, 138 - } as const; 139 - 140 - export const $ArrayWithStrings = { 141 - description: 'This is a simple array with strings', 142 - type: 'array', 143 - items: { 144 - type: 'string', 145 - }, 146 - default: ['test'], 147 - } as const; 148 - 149 - export const $ArrayWithReferences = { 150 - description: 'This is a simple array with references', 151 - type: 'array', 152 - items: { 153 - $ref: '#/components/schemas/ModelWithString', 154 - }, 155 - } as const; 156 - 157 - export const $ArrayWithArray = { 158 - description: 'This is a simple array containing an array', 159 - type: 'array', 160 - items: { 161 - type: 'array', 162 - items: { 163 - $ref: '#/components/schemas/ModelWithString', 164 - }, 165 - }, 166 - } as const; 167 - 168 - export const $ArrayWithProperties = { 169 - description: 'This is a simple array with properties', 170 - type: 'array', 171 - items: { 172 - type: 'object', 173 - properties: { 174 - foo: { 175 - $ref: '#/components/schemas/camelCaseCommentWithBreaks', 176 - }, 177 - bar: { 178 - type: 'string', 179 - }, 180 - }, 181 - }, 182 - } as const; 183 - 184 - export const $ArrayWithAnyOfProperties = { 185 - description: 'This is a simple array with any of properties', 186 - type: 'array', 187 - items: { 188 - anyOf: [ 189 - { 190 - type: 'object', 191 - properties: { 192 - foo: { 193 - type: 'string', 194 - default: 'test', 195 - }, 196 - }, 197 - }, 198 - { 199 - type: 'object', 200 - properties: { 201 - bar: { 202 - type: 'string', 203 - }, 204 - }, 205 - }, 206 - ], 207 - }, 208 - } as const; 209 - 210 - export const $AnyOfAnyAndNull = { 211 - type: 'object', 212 - properties: { 213 - data: { 214 - anyOf: [ 215 - {}, 216 - { 217 - type: 'null', 218 - }, 219 - ], 220 - }, 221 - }, 222 - } as const; 223 - 224 - export const $AnyOfArrays = { 225 - description: 'This is a simple array with any of properties', 226 - type: 'object', 227 - properties: { 228 - results: { 229 - items: { 230 - anyOf: [ 231 - { 232 - type: 'object', 233 - properties: { 234 - foo: { 235 - type: 'string', 236 - }, 237 - }, 238 - }, 239 - { 240 - type: 'object', 241 - properties: { 242 - bar: { 243 - type: 'string', 244 - }, 245 - }, 246 - }, 247 - ], 248 - }, 249 - type: 'array', 250 - }, 251 - }, 252 - } as const; 253 - 254 - export const $DictionaryWithString = { 255 - description: 'This is a string dictionary', 256 - type: 'object', 257 - additionalProperties: { 258 - type: 'string', 259 - }, 260 - } as const; 261 - 262 - export const $DictionaryWithPropertiesAndAdditionalProperties = { 263 - type: 'object', 264 - properties: { 265 - foo: { 266 - type: 'string', 267 - }, 268 - }, 269 - additionalProperties: { 270 - type: 'string', 271 - }, 272 - } as const; 273 - 274 - export const $DictionaryWithReference = { 275 - description: 'This is a string reference', 276 - type: 'object', 277 - additionalProperties: { 278 - $ref: '#/components/schemas/ModelWithString', 279 - }, 280 - } as const; 281 - 282 - export const $DictionaryWithArray = { 283 - description: 'This is a complex dictionary', 284 - type: 'object', 285 - additionalProperties: { 286 - type: 'array', 287 - items: { 288 - $ref: '#/components/schemas/ModelWithString', 289 - }, 290 - }, 291 - } as const; 292 - 293 - export const $DictionaryWithDictionary = { 294 - description: 'This is a string dictionary', 295 - type: 'object', 296 - additionalProperties: { 297 - type: 'object', 298 - additionalProperties: { 299 - type: 'string', 300 - }, 301 - }, 302 - } as const; 303 - 304 - export const $DictionaryWithProperties = { 305 - description: 'This is a complex dictionary', 306 - type: 'object', 307 - additionalProperties: { 308 - type: 'object', 309 - properties: { 310 - foo: { 311 - type: 'string', 312 - }, 313 - bar: { 314 - type: 'string', 315 - }, 316 - }, 317 - }, 318 - } as const; 319 - 320 - export const $ModelWithInteger = { 321 - description: 'This is a model with one number property', 322 - type: 'object', 323 - properties: { 324 - prop: { 325 - description: 'This is a simple number property', 326 - type: 'integer', 327 - }, 328 - }, 329 - } as const; 330 - 331 - export const $ModelWithBoolean = { 332 - description: 'This is a model with one boolean property', 333 - type: 'object', 334 - properties: { 335 - prop: { 336 - description: 'This is a simple boolean property', 337 - type: 'boolean', 338 - }, 339 - }, 340 - } as const; 341 - 342 - export const $ModelWithString = { 343 - description: 'This is a model with one string property', 344 - type: 'object', 345 - properties: { 346 - prop: { 347 - description: 'This is a simple string property', 348 - type: 'string', 349 - }, 350 - }, 351 - } as const; 352 - 353 - export const $Model_From_Zendesk = { 354 - description: `\`Comment\` or \`VoiceComment\`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets)`, 355 - type: 'string', 356 - } as const; 357 - 358 - export const $ModelWithNullableString = { 359 - description: 'This is a model with one string property', 360 - type: 'object', 361 - required: ['nullableRequiredProp1', 'nullableRequiredProp2'], 362 - properties: { 363 - nullableProp1: { 364 - description: 'This is a simple string property', 365 - type: 'string', 366 - nullable: true, 367 - }, 368 - nullableRequiredProp1: { 369 - description: 'This is a simple string property', 370 - type: 'string', 371 - nullable: true, 372 - }, 373 - nullableProp2: { 374 - description: 'This is a simple string property', 375 - type: ['string', 'null'], 376 - }, 377 - nullableRequiredProp2: { 378 - description: 'This is a simple string property', 379 - type: ['string', 'null'], 380 - }, 381 - 'foo_bar-enum': { 382 - description: 'This is a simple enum with strings', 383 - enum: ['Success', 'Warning', 'Error', 'ØÆÅ字符串'], 384 - }, 385 - }, 386 - } as const; 387 - 388 - export const $ModelWithEnum = { 389 - description: 'This is a model with one enum', 390 - type: 'object', 391 - properties: { 392 - 'foo_bar-enum': { 393 - description: 'This is a simple enum with strings', 394 - enum: ['Success', 'Warning', 'Error', 'ØÆÅ字符串'], 395 - }, 396 - statusCode: { 397 - description: 'These are the HTTP error code enums', 398 - enum: ['100', '200 FOO', '300 FOO_BAR', '400 foo-bar', '500 foo.bar', '600 foo&bar'], 399 - }, 400 - bool: { 401 - description: 'Simple boolean enum', 402 - type: 'boolean', 403 - enum: [true], 404 - }, 405 - }, 406 - } as const; 407 - 408 - export const $ModelWithEnumWithHyphen = { 409 - description: 'This is a model with one enum with escaped name', 410 - type: 'object', 411 - properties: { 412 - 'foo-bar-baz-qux': { 413 - type: 'string', 414 - enum: ['3.0'], 415 - title: 'Foo-Bar-Baz-Qux', 416 - default: '3.0', 417 - }, 418 - }, 419 - } as const; 420 - 421 - export const $ModelWithEnumFromDescription = { 422 - description: 'This is a model with one enum', 423 - type: 'object', 424 - properties: { 425 - test: { 426 - type: 'integer', 427 - description: 'Success=1,Warning=2,Error=3', 428 - }, 429 - }, 430 - } as const; 431 - 432 - export const $ModelWithNestedEnums = { 433 - description: 'This is a model with nested enums', 434 - type: 'object', 435 - properties: { 436 - dictionaryWithEnum: { 437 - type: 'object', 438 - additionalProperties: { 439 - enum: ['Success', 'Warning', 'Error'], 440 - }, 441 - }, 442 - dictionaryWithEnumFromDescription: { 443 - type: 'object', 444 - additionalProperties: { 445 - type: 'integer', 446 - description: 'Success=1,Warning=2,Error=3', 447 - }, 448 - }, 449 - arrayWithEnum: { 450 - type: 'array', 451 - items: { 452 - enum: ['Success', 'Warning', 'Error'], 453 - }, 454 - }, 455 - arrayWithDescription: { 456 - type: 'array', 457 - items: { 458 - type: 'integer', 459 - description: 'Success=1,Warning=2,Error=3', 460 - }, 461 - }, 462 - 'foo_bar-enum': { 463 - description: 'This is a simple enum with strings', 464 - enum: ['Success', 'Warning', 'Error', 'ØÆÅ字符串'], 465 - }, 466 - }, 467 - } as const; 468 - 469 - export const $ModelWithReference = { 470 - description: 'This is a model with one property containing a reference', 471 - type: 'object', 472 - properties: { 473 - prop: { 474 - $ref: '#/components/schemas/ModelWithProperties', 475 - }, 476 - }, 477 - } as const; 478 - 479 - export const $ModelWithArrayReadOnlyAndWriteOnly = { 480 - description: 'This is a model with one property containing an array', 481 - type: 'object', 482 - properties: { 483 - prop: { 484 - type: 'array', 485 - items: { 486 - $ref: '#/components/schemas/ModelWithReadOnlyAndWriteOnly', 487 - }, 488 - }, 489 - propWithFile: { 490 - type: 'array', 491 - items: { 492 - type: 'file', 493 - }, 494 - }, 495 - propWithNumber: { 496 - type: 'array', 497 - items: { 498 - type: 'number', 499 - }, 500 - }, 501 - }, 502 - } as const; 503 - 504 - export const $ModelWithArray = { 505 - description: 'This is a model with one property containing an array', 506 - type: 'object', 507 - properties: { 508 - prop: { 509 - type: 'array', 510 - items: { 511 - $ref: '#/components/schemas/ModelWithString', 512 - }, 513 - }, 514 - propWithFile: { 515 - type: 'array', 516 - items: { 517 - type: 'file', 518 - }, 519 - }, 520 - propWithNumber: { 521 - type: 'array', 522 - items: { 523 - type: 'number', 524 - }, 525 - }, 526 - }, 527 - } as const; 528 - 529 - export const $ModelWithDictionary = { 530 - description: 'This is a model with one property containing a dictionary', 531 - type: 'object', 532 - properties: { 533 - prop: { 534 - type: 'object', 535 - additionalProperties: { 536 - type: 'string', 537 - }, 538 - }, 539 - }, 540 - } as const; 541 - 542 - export const $DeprecatedModel = { 543 - deprecated: true, 544 - description: 'This is a deprecated model with a deprecated property', 545 - type: 'object', 546 - properties: { 547 - prop: { 548 - deprecated: true, 549 - description: 'This is a deprecated property', 550 - type: 'string', 551 - }, 552 - }, 553 - } as const; 554 - 555 - export const $ModelWithCircularReference = { 556 - description: 'This is a model with one property containing a circular reference', 557 - type: 'object', 558 - properties: { 559 - prop: { 560 - $ref: '#/components/schemas/ModelWithCircularReference', 561 - }, 562 - }, 563 - } as const; 564 - 565 - export const $CompositionWithOneOf = { 566 - description: "This is a model with one property with a 'one of' relationship", 567 - type: 'object', 568 - properties: { 569 - propA: { 570 - type: 'object', 571 - oneOf: [ 572 - { 573 - $ref: '#/components/schemas/ModelWithString', 574 - }, 575 - { 576 - $ref: '#/components/schemas/ModelWithEnum', 577 - }, 578 - { 579 - $ref: '#/components/schemas/ModelWithArray', 580 - }, 581 - { 582 - $ref: '#/components/schemas/ModelWithDictionary', 583 - }, 584 - ], 585 - }, 586 - }, 587 - } as const; 588 - 589 - export const $CompositionWithOneOfAnonymous = { 590 - description: "This is a model with one property with a 'one of' relationship where the options are not $ref", 591 - type: 'object', 592 - properties: { 593 - propA: { 594 - type: 'object', 595 - oneOf: [ 596 - { 597 - description: 'Anonymous object type', 598 - type: 'object', 599 - properties: { 600 - propA: { 601 - type: 'string', 602 - }, 603 - }, 604 - }, 605 - { 606 - description: 'Anonymous string type', 607 - type: 'string', 608 - }, 609 - { 610 - description: 'Anonymous integer type', 611 - type: 'integer', 612 - }, 613 - ], 614 - }, 615 - }, 616 - } as const; 617 - 618 - export const $ModelCircle = { 619 - description: 'Circle', 620 - type: 'object', 621 - required: ['kind'], 622 - properties: { 623 - kind: { 624 - type: 'string', 625 - }, 626 - radius: { 627 - type: 'number', 628 - }, 629 - }, 630 - } as const; 631 - 632 - export const $ModelSquare = { 633 - description: 'Square', 634 - type: 'object', 635 - required: ['kind'], 636 - properties: { 637 - kind: { 638 - type: 'string', 639 - }, 640 - sideLength: { 641 - type: 'number', 642 - }, 643 - }, 644 - } as const; 645 - 646 - export const $CompositionWithOneOfDiscriminator = { 647 - description: "This is a model with one property with a 'one of' relationship where the options are not $ref", 648 - type: 'object', 649 - oneOf: [ 650 - { 651 - $ref: '#/components/schemas/ModelCircle', 652 - }, 653 - { 654 - $ref: '#/components/schemas/ModelSquare', 655 - }, 656 - ], 657 - discriminator: { 658 - propertyName: 'kind', 659 - mapping: { 660 - circle: '#/components/schemas/ModelCircle', 661 - square: '#/components/schemas/ModelSquare', 662 - }, 663 - }, 664 - } as const; 665 - 666 - export const $CompositionWithAnyOf = { 667 - description: "This is a model with one property with a 'any of' relationship", 668 - type: 'object', 669 - properties: { 670 - propA: { 671 - type: 'object', 672 - anyOf: [ 673 - { 674 - $ref: '#/components/schemas/ModelWithString', 675 - }, 676 - { 677 - $ref: '#/components/schemas/ModelWithEnum', 678 - }, 679 - { 680 - $ref: '#/components/schemas/ModelWithArray', 681 - }, 682 - { 683 - $ref: '#/components/schemas/ModelWithDictionary', 684 - }, 685 - ], 686 - }, 687 - }, 688 - } as const; 689 - 690 - export const $CompositionWithAnyOfAnonymous = { 691 - description: "This is a model with one property with a 'any of' relationship where the options are not $ref", 692 - type: 'object', 693 - properties: { 694 - propA: { 695 - type: 'object', 696 - anyOf: [ 697 - { 698 - description: 'Anonymous object type', 699 - type: 'object', 700 - properties: { 701 - propA: { 702 - type: 'string', 703 - }, 704 - }, 705 - }, 706 - { 707 - description: 'Anonymous string type', 708 - type: 'string', 709 - }, 710 - { 711 - description: 'Anonymous integer type', 712 - type: 'integer', 713 - }, 714 - ], 715 - }, 716 - }, 717 - } as const; 718 - 719 - export const $CompositionWithNestedAnyAndTypeNull = { 720 - description: "This is a model with nested 'any of' property with a type null", 721 - type: 'object', 722 - properties: { 723 - propA: { 724 - type: 'object', 725 - anyOf: [ 726 - { 727 - items: { 728 - anyOf: [ 729 - { 730 - $ref: '#/components/schemas/ModelWithDictionary', 731 - }, 732 - { 733 - type: 'null', 734 - }, 735 - ], 736 - }, 737 - type: 'array', 738 - }, 739 - { 740 - items: { 741 - anyOf: [ 742 - { 743 - $ref: '#/components/schemas/ModelWithArray', 744 - }, 745 - { 746 - type: 'null', 747 - }, 748 - ], 749 - }, 750 - type: 'array', 751 - }, 752 - ], 753 - }, 754 - }, 755 - } as const; 756 - 757 - export const $Enum1 = { 758 - enum: ['Bird', 'Dog'], 759 - type: 'string', 760 - } as const; 761 - 762 - export const $ConstValue = { 763 - type: 'string', 764 - const: 'ConstValue', 765 - } as const; 766 - 767 - export const $CompositionWithNestedAnyOfAndNull = { 768 - description: "This is a model with one property with a 'any of' relationship where the options are not $ref", 769 - type: 'object', 770 - properties: { 771 - propA: { 772 - anyOf: [ 773 - { 774 - items: { 775 - anyOf: [ 776 - { 777 - $ref: '#/components/schemas/Enum1', 778 - }, 779 - { 780 - $ref: '#/components/schemas/ConstValue', 781 - }, 782 - ], 783 - }, 784 - type: 'array', 785 - }, 786 - { 787 - type: 'null', 788 - }, 789 - ], 790 - title: 'Scopes', 791 - }, 792 - }, 793 - } as const; 794 - 795 - export const $CompositionWithOneOfAndNullable = { 796 - description: "This is a model with one property with a 'one of' relationship", 797 - type: 'object', 798 - properties: { 799 - propA: { 800 - nullable: true, 801 - type: 'object', 802 - oneOf: [ 803 - { 804 - type: 'object', 805 - properties: { 806 - boolean: { 807 - type: 'boolean', 808 - }, 809 - }, 810 - }, 811 - { 812 - $ref: '#/components/schemas/ModelWithEnum', 813 - }, 814 - { 815 - $ref: '#/components/schemas/ModelWithArray', 816 - }, 817 - { 818 - $ref: '#/components/schemas/ModelWithDictionary', 819 - }, 820 - ], 821 - }, 822 - }, 823 - } as const; 824 - 825 - export const $CompositionWithOneOfAndSimpleDictionary = { 826 - description: 'This is a model that contains a simple dictionary within composition', 827 - type: 'object', 828 - properties: { 829 - propA: { 830 - oneOf: [ 831 - { 832 - type: 'boolean', 833 - }, 834 - { 835 - type: 'object', 836 - additionalProperties: { 837 - type: 'number', 838 - }, 839 - }, 840 - ], 841 - }, 842 - }, 843 - } as const; 844 - 845 - export const $CompositionWithOneOfAndSimpleArrayDictionary = { 846 - description: 'This is a model that contains a dictionary of simple arrays within composition', 847 - type: 'object', 848 - properties: { 849 - propA: { 850 - oneOf: [ 851 - { 852 - type: 'boolean', 853 - }, 854 - { 855 - type: 'object', 856 - additionalProperties: { 857 - type: 'array', 858 - items: { 859 - type: 'boolean', 860 - }, 861 - }, 862 - }, 863 - ], 864 - }, 865 - }, 866 - } as const; 867 - 868 - export const $CompositionWithOneOfAndComplexArrayDictionary = { 869 - description: 'This is a model that contains a dictionary of complex arrays (composited) within composition', 870 - type: 'object', 871 - properties: { 872 - propA: { 873 - oneOf: [ 874 - { 875 - type: 'boolean', 876 - }, 877 - { 878 - type: 'object', 879 - additionalProperties: { 880 - type: 'array', 881 - items: { 882 - oneOf: [ 883 - { 884 - type: 'number', 885 - }, 886 - { 887 - type: 'string', 888 - }, 889 - ], 890 - }, 891 - }, 892 - }, 893 - ], 894 - }, 895 - }, 896 - } as const; 897 - 898 - export const $CompositionWithAllOfAndNullable = { 899 - description: "This is a model with one property with a 'all of' relationship", 900 - type: 'object', 901 - properties: { 902 - propA: { 903 - nullable: true, 904 - type: 'object', 905 - allOf: [ 906 - { 907 - type: 'object', 908 - properties: { 909 - boolean: { 910 - type: 'boolean', 911 - }, 912 - }, 913 - }, 914 - { 915 - $ref: '#/components/schemas/ModelWithEnum', 916 - }, 917 - { 918 - $ref: '#/components/schemas/ModelWithArray', 919 - }, 920 - { 921 - $ref: '#/components/schemas/ModelWithDictionary', 922 - }, 923 - ], 924 - }, 925 - }, 926 - } as const; 927 - 928 - export const $CompositionWithAnyOfAndNullable = { 929 - description: "This is a model with one property with a 'any of' relationship", 930 - type: 'object', 931 - properties: { 932 - propA: { 933 - nullable: true, 934 - type: 'object', 935 - anyOf: [ 936 - { 937 - type: 'object', 938 - properties: { 939 - boolean: { 940 - type: 'boolean', 941 - }, 942 - }, 943 - }, 944 - { 945 - $ref: '#/components/schemas/ModelWithEnum', 946 - }, 947 - { 948 - $ref: '#/components/schemas/ModelWithArray', 949 - }, 950 - { 951 - $ref: '#/components/schemas/ModelWithDictionary', 952 - }, 953 - ], 954 - }, 955 - }, 956 - } as const; 957 - 958 - export const $CompositionBaseModel = { 959 - description: 'This is a base model with two simple optional properties', 960 - type: 'object', 961 - properties: { 962 - firstName: { 963 - type: 'string', 964 - }, 965 - lastname: { 966 - type: 'string', 967 - }, 968 - }, 969 - } as const; 970 - 971 - export const $CompositionExtendedModel = { 972 - description: 'This is a model that extends the base model', 973 - type: 'object', 974 - allOf: [ 975 - { 976 - $ref: '#/components/schemas/CompositionBaseModel', 977 - }, 978 - ], 979 - properties: { 980 - age: { 981 - type: 'number', 982 - }, 983 - }, 984 - required: ['firstName', 'lastname', 'age'], 985 - } as const; 986 - 987 - export const $ModelWithProperties = { 988 - description: 'This is a model with one nested property', 989 - type: 'object', 990 - required: ['required', 'requiredAndReadOnly', 'requiredAndNullable'], 991 - properties: { 992 - required: { 993 - type: 'string', 994 - }, 995 - requiredAndReadOnly: { 996 - type: 'string', 997 - readOnly: true, 998 - }, 999 - requiredAndNullable: { 1000 - type: 'string', 1001 - nullable: true, 1002 - }, 1003 - string: { 1004 - type: 'string', 1005 - }, 1006 - number: { 1007 - type: 'number', 1008 - }, 1009 - boolean: { 1010 - type: 'boolean', 1011 - }, 1012 - reference: { 1013 - $ref: '#/components/schemas/ModelWithString', 1014 - }, 1015 - 'property with space': { 1016 - type: 'string', 1017 - }, 1018 - default: { 1019 - type: 'string', 1020 - }, 1021 - try: { 1022 - type: 'string', 1023 - }, 1024 - '@namespace.string': { 1025 - type: 'string', 1026 - readOnly: true, 1027 - }, 1028 - '@namespace.integer': { 1029 - type: 'integer', 1030 - readOnly: true, 1031 - }, 1032 - }, 1033 - } as const; 1034 - 1035 - export const $ModelWithNestedProperties = { 1036 - description: 'This is a model with one nested property', 1037 - type: 'object', 1038 - required: ['first'], 1039 - properties: { 1040 - first: { 1041 - type: 'object', 1042 - required: ['second'], 1043 - readOnly: true, 1044 - nullable: true, 1045 - properties: { 1046 - second: { 1047 - type: 'object', 1048 - required: ['third'], 1049 - readOnly: true, 1050 - nullable: true, 1051 - properties: { 1052 - third: { 1053 - type: 'string', 1054 - required: true, 1055 - readOnly: true, 1056 - nullable: true, 1057 - }, 1058 - }, 1059 - }, 1060 - }, 1061 - }, 1062 - }, 1063 - } as const; 1064 - 1065 - export const $ModelWithDuplicateProperties = { 1066 - description: 'This is a model with duplicated properties', 1067 - type: 'object', 1068 - properties: { 1069 - prop: { 1070 - $ref: '#/components/schemas/ModelWithString', 1071 - }, 1072 - }, 1073 - } as const; 1074 - 1075 - export const $ModelWithOrderedProperties = { 1076 - description: 'This is a model with ordered properties', 1077 - type: 'object', 1078 - properties: { 1079 - zebra: { 1080 - type: 'string', 1081 - }, 1082 - apple: { 1083 - type: 'string', 1084 - }, 1085 - hawaii: { 1086 - type: 'string', 1087 - }, 1088 - }, 1089 - } as const; 1090 - 1091 - export const $ModelWithDuplicateImports = { 1092 - description: 'This is a model with duplicated imports', 1093 - type: 'object', 1094 - properties: { 1095 - propA: { 1096 - $ref: '#/components/schemas/ModelWithString', 1097 - }, 1098 - propB: { 1099 - $ref: '#/components/schemas/ModelWithString', 1100 - }, 1101 - propC: { 1102 - $ref: '#/components/schemas/ModelWithString', 1103 - }, 1104 - }, 1105 - } as const; 1106 - 1107 - export const $ModelThatExtends = { 1108 - description: 'This is a model that extends another model', 1109 - type: 'object', 1110 - allOf: [ 1111 - { 1112 - $ref: '#/components/schemas/ModelWithString', 1113 - }, 1114 - { 1115 - type: 'object', 1116 - properties: { 1117 - propExtendsA: { 1118 - type: 'string', 1119 - }, 1120 - propExtendsB: { 1121 - $ref: '#/components/schemas/ModelWithString', 1122 - }, 1123 - }, 1124 - }, 1125 - ], 1126 - } as const; 1127 - 1128 - export const $ModelThatExtendsExtends = { 1129 - description: 'This is a model that extends another model', 1130 - type: 'object', 1131 - allOf: [ 1132 - { 1133 - $ref: '#/components/schemas/ModelWithString', 1134 - }, 1135 - { 1136 - $ref: '#/components/schemas/ModelThatExtends', 1137 - }, 1138 - { 1139 - type: 'object', 1140 - properties: { 1141 - propExtendsC: { 1142 - type: 'string', 1143 - }, 1144 - propExtendsD: { 1145 - $ref: '#/components/schemas/ModelWithString', 1146 - }, 1147 - }, 1148 - }, 1149 - ], 1150 - } as const; 1151 - 1152 - export const $ModelWithPattern = { 1153 - description: 'This is a model that contains a some patterns', 1154 - type: 'object', 1155 - required: ['key', 'name'], 1156 - properties: { 1157 - key: { 1158 - maxLength: 64, 1159 - pattern: '^[a-zA-Z0-9_]*$', 1160 - type: 'string', 1161 - }, 1162 - name: { 1163 - maxLength: 255, 1164 - type: 'string', 1165 - }, 1166 - enabled: { 1167 - type: 'boolean', 1168 - readOnly: true, 1169 - }, 1170 - modified: { 1171 - type: 'string', 1172 - format: 'date-time', 1173 - readOnly: true, 1174 - }, 1175 - id: { 1176 - type: 'string', 1177 - pattern: '^d{2}-d{3}-d{4}$', 1178 - }, 1179 - text: { 1180 - type: 'string', 1181 - pattern: '^w+$', 1182 - }, 1183 - patternWithSingleQuotes: { 1184 - type: 'string', 1185 - pattern: "^[a-zA-Z0-9']*$", 1186 - }, 1187 - patternWithNewline: { 1188 - type: 'string', 1189 - pattern: `aaa 1190 - bbb`, 1191 - }, 1192 - patternWithBacktick: { 1193 - type: 'string', 1194 - pattern: 'aaa`bbb', 1195 - }, 1196 - }, 1197 - } as const; 1198 - 1199 - export const $File = { 1200 - required: ['mime'], 1201 - type: 'object', 1202 - properties: { 1203 - id: { 1204 - title: 'Id', 1205 - type: 'string', 1206 - readOnly: true, 1207 - minLength: 1, 1208 - }, 1209 - updated_at: { 1210 - title: 'Updated at', 1211 - type: 'string', 1212 - format: 'date-time', 1213 - readOnly: true, 1214 - }, 1215 - created_at: { 1216 - title: 'Created at', 1217 - type: 'string', 1218 - format: 'date-time', 1219 - readOnly: true, 1220 - }, 1221 - mime: { 1222 - title: 'Mime', 1223 - type: 'string', 1224 - maxLength: 24, 1225 - minLength: 1, 1226 - }, 1227 - file: { 1228 - title: 'File', 1229 - type: 'string', 1230 - readOnly: true, 1231 - format: 'uri', 1232 - }, 1233 - }, 1234 - } as const; 1235 - 1236 - export const $default = { 1237 - type: 'object', 1238 - properties: { 1239 - name: { 1240 - type: 'string', 1241 - }, 1242 - }, 1243 - } as const; 1244 - 1245 - export const $Pageable = { 1246 - type: 'object', 1247 - properties: { 1248 - page: { 1249 - minimum: 0, 1250 - type: 'integer', 1251 - format: 'int32', 1252 - default: 0, 1253 - }, 1254 - size: { 1255 - minimum: 1, 1256 - type: 'integer', 1257 - format: 'int32', 1258 - }, 1259 - sort: { 1260 - type: 'array', 1261 - items: { 1262 - type: 'string', 1263 - }, 1264 - }, 1265 - }, 1266 - } as const; 1267 - 1268 - export const $FreeFormObjectWithoutAdditionalProperties = { 1269 - description: 'This is a free-form object without additionalProperties.', 1270 - type: 'object', 1271 - } as const; 1272 - 1273 - export const $FreeFormObjectWithAdditionalPropertiesEqTrue = { 1274 - description: 'This is a free-form object with additionalProperties: true.', 1275 - type: 'object', 1276 - additionalProperties: true, 1277 - } as const; 1278 - 1279 - export const $FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { 1280 - description: 'This is a free-form object with additionalProperties: {}.', 1281 - type: 'object', 1282 - additionalProperties: {}, 1283 - } as const; 1284 - 1285 - export const $ModelWithConst = { 1286 - type: 'object', 1287 - properties: { 1288 - String: { 1289 - const: 'String', 1290 - }, 1291 - number: { 1292 - const: 0, 1293 - }, 1294 - null: { 1295 - const: null, 1296 - }, 1297 - withType: { 1298 - type: 'string', 1299 - const: 'Some string', 1300 - }, 1301 - }, 1302 - } as const; 1303 - 1304 - export const $ModelWithAdditionalPropertiesEqTrue = { 1305 - description: 'This is a model with one property and additionalProperties: true', 1306 - type: 'object', 1307 - properties: { 1308 - prop: { 1309 - description: 'This is a simple string property', 1310 - type: 'string', 1311 - }, 1312 - }, 1313 - additionalProperties: true, 1314 - } as const; 1315 - 1316 - export const $NestedAnyOfArraysNullable = { 1317 - properties: { 1318 - nullableArray: { 1319 - anyOf: [ 1320 - { 1321 - items: { 1322 - anyOf: [ 1323 - { 1324 - type: 'string', 1325 - }, 1326 - { 1327 - type: 'boolean', 1328 - }, 1329 - ], 1330 - }, 1331 - type: 'array', 1332 - }, 1333 - { 1334 - type: 'null', 1335 - }, 1336 - ], 1337 - }, 1338 - }, 1339 - type: 'object', 1340 - } as const; 1341 - 1342 - export const $CompositionWithOneOfAndProperties = { 1343 - type: 'object', 1344 - oneOf: [ 1345 - { 1346 - type: 'object', 1347 - required: ['foo'], 1348 - properties: { 1349 - foo: { 1350 - $ref: '#/components/parameters/SimpleParameter', 1351 - }, 1352 - }, 1353 - additionalProperties: false, 1354 - }, 1355 - { 1356 - type: 'object', 1357 - required: ['bar'], 1358 - properties: { 1359 - bar: { 1360 - $ref: '#/components/schemas/NonAsciiString%C3%A6%C3%B8%C3%A5%C3%86%C3%98%C3%85%C3%B6%C3%B4%C3%AA%C3%8A%E5%AD%97%E7%AC%A6%E4%B8%B2', 1361 - }, 1362 - }, 1363 - additionalProperties: false, 1364 - }, 1365 - ], 1366 - required: ['baz', 'qux'], 1367 - properties: { 1368 - baz: { 1369 - type: 'integer', 1370 - format: 'uint16', 1371 - minimum: 0, 1372 - nullable: true, 1373 - }, 1374 - qux: { 1375 - type: 'integer', 1376 - format: 'uint8', 1377 - minimum: 0, 1378 - }, 1379 - }, 1380 - } as const; 1381 - 1382 - export const $NullableObject = { 1383 - type: 'object', 1384 - nullable: true, 1385 - description: 'An object that can be null', 1386 - properties: { 1387 - foo: { 1388 - type: 'string', 1389 - }, 1390 - }, 1391 - default: null, 1392 - } as const; 1393 - 1394 - export const $CharactersInDescription = { 1395 - type: 'string', 1396 - description: 'Some % character', 1397 - } as const; 1398 - 1399 - export const $ModelWithNullableObject = { 1400 - type: 'object', 1401 - properties: { 1402 - data: { 1403 - $ref: '#/components/schemas/NullableObject', 1404 - }, 1405 - }, 1406 - } as const; 1407 - 1408 - export const $ModelWithOneOfEnum = { 1409 - oneOf: [ 1410 - { 1411 - type: 'object', 1412 - required: ['foo'], 1413 - properties: { 1414 - foo: { 1415 - type: 'string', 1416 - enum: ['Bar'], 1417 - }, 1418 - }, 1419 - }, 1420 - { 1421 - type: 'object', 1422 - required: ['foo'], 1423 - properties: { 1424 - foo: { 1425 - type: 'string', 1426 - enum: ['Baz'], 1427 - }, 1428 - }, 1429 - }, 1430 - { 1431 - type: 'object', 1432 - required: ['foo'], 1433 - properties: { 1434 - foo: { 1435 - type: 'string', 1436 - enum: ['Qux'], 1437 - }, 1438 - }, 1439 - }, 1440 - { 1441 - type: 'object', 1442 - required: ['content', 'foo'], 1443 - properties: { 1444 - content: { 1445 - type: 'string', 1446 - format: 'date-time', 1447 - }, 1448 - foo: { 1449 - type: 'string', 1450 - enum: ['Quux'], 1451 - }, 1452 - }, 1453 - }, 1454 - { 1455 - type: 'object', 1456 - required: ['content', 'foo'], 1457 - properties: { 1458 - content: { 1459 - type: 'array', 1460 - items: [ 1461 - { 1462 - type: 'string', 1463 - format: 'date-time', 1464 - }, 1465 - { 1466 - type: 'string', 1467 - }, 1468 - ], 1469 - maxItems: 2, 1470 - minItems: 2, 1471 - }, 1472 - foo: { 1473 - type: 'string', 1474 - enum: ['Corge'], 1475 - }, 1476 - }, 1477 - }, 1478 - ], 1479 - } as const; 1480 - 1481 - export const $ModelWithNestedArrayEnumsDataFoo = { 1482 - enum: ['foo', 'bar'], 1483 - type: 'string', 1484 - } as const; 1485 - 1486 - export const $ModelWithNestedArrayEnumsDataBar = { 1487 - enum: ['baz', 'qux'], 1488 - type: 'string', 1489 - } as const; 1490 - 1491 - export const $ModelWithNestedArrayEnumsData = { 1492 - type: 'object', 1493 - properties: { 1494 - foo: { 1495 - type: 'array', 1496 - items: { 1497 - $ref: '#/components/schemas/ModelWithNestedArrayEnumsDataFoo', 1498 - }, 1499 - }, 1500 - bar: { 1501 - type: 'array', 1502 - items: { 1503 - $ref: '#/components/schemas/ModelWithNestedArrayEnumsDataBar', 1504 - }, 1505 - }, 1506 - }, 1507 - } as const; 1508 - 1509 - export const $ModelWithNestedArrayEnums = { 1510 - type: 'object', 1511 - properties: { 1512 - array_strings: { 1513 - type: 'array', 1514 - items: { 1515 - type: 'string', 1516 - }, 1517 - }, 1518 - data: { 1519 - allOf: [ 1520 - { 1521 - $ref: '#/components/schemas/ModelWithNestedArrayEnumsData', 1522 - }, 1523 - ], 1524 - }, 1525 - }, 1526 - } as const; 1527 - 1528 - export const $ModelWithNestedCompositionEnums = { 1529 - type: 'object', 1530 - properties: { 1531 - foo: { 1532 - allOf: [ 1533 - { 1534 - $ref: '#/components/schemas/ModelWithNestedArrayEnumsDataFoo', 1535 - }, 1536 - ], 1537 - }, 1538 - }, 1539 - } as const; 1540 - 1541 - export const $ModelWithReadOnlyAndWriteOnly = { 1542 - type: 'object', 1543 - required: ['foo', 'bar', 'baz'], 1544 - properties: { 1545 - foo: { 1546 - type: 'string', 1547 - }, 1548 - bar: { 1549 - readOnly: true, 1550 - type: 'string', 1551 - }, 1552 - baz: { 1553 - type: 'string', 1554 - writeOnly: true, 1555 - }, 1556 - }, 1557 - } as const; 1558 - 1559 - export const $ModelWithConstantSizeArray = { 1560 - type: 'array', 1561 - items: { 1562 - type: 'number', 1563 - }, 1564 - minItems: 2, 1565 - maxItems: 2, 1566 - } as const; 1567 - 1568 - export const $ModelWithAnyOfConstantSizeArray = { 1569 - type: 'array', 1570 - items: { 1571 - oneOf: [ 1572 - { 1573 - type: 'number', 1574 - }, 1575 - { 1576 - type: 'string', 1577 - }, 1578 - ], 1579 - }, 1580 - minItems: 3, 1581 - maxItems: 3, 1582 - } as const; 1583 - 1584 - export const $ModelWithAnyOfConstantSizeArrayNullable = { 1585 - type: 'array', 1586 - items: { 1587 - oneOf: [ 1588 - { 1589 - type: 'number', 1590 - nullable: true, 1591 - }, 1592 - { 1593 - type: 'string', 1594 - }, 1595 - ], 1596 - }, 1597 - minItems: 3, 1598 - maxItems: 3, 1599 - } as const; 1600 - 1601 - export const $ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = { 1602 - type: 'array', 1603 - items: { 1604 - oneOf: [ 1605 - { 1606 - type: 'number', 1607 - }, 1608 - { 1609 - type: 'string', 1610 - }, 1611 - ], 1612 - }, 1613 - minItems: 2, 1614 - maxItems: 2, 1615 - } as const; 1616 - 1617 - export const $ModelWithAnyOfConstantSizeArrayAndIntersect = { 1618 - type: 'array', 1619 - items: { 1620 - allOf: [ 1621 - { 1622 - type: 'number', 1623 - }, 1624 - { 1625 - type: 'string', 1626 - }, 1627 - ], 1628 - }, 1629 - minItems: 2, 1630 - maxItems: 2, 1631 - } as const; 1632 - 1633 - export const $ModelWithNumericEnumUnion = { 1634 - type: 'object', 1635 - properties: { 1636 - value: { 1637 - type: 'number', 1638 - description: 'Период', 1639 - enum: [1, 3, 6, 12], 1640 - }, 1641 - }, 1642 - } as const; 1643 - 1644 - export const $SimpleParameter = { 1645 - description: 'This is a reusable parameter', 1646 - name: 'parameter', 1647 - in: 'query', 1648 - required: false, 1649 - schema: { 1650 - type: 'string', 1651 - }, 1652 - } as const; 1653 - 1654 - export const $x_Foo_Bar = { 1655 - description: 'Parameter with illegal characters', 1656 - name: 'x-Foo-Bar', 1657 - in: 'header', 1658 - required: true, 1659 - schema: { 1660 - type: 'string', 1661 - }, 1662 - } as const;
-1
packages/openapi-ts/test/__snapshots__/test/generated/v3_date/index.ts.snap
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - export * from './schemas.gen'; 4 3 export * from './types.gen';
-1662
packages/openapi-ts/test/__snapshots__/test/generated/v3_date/schemas.gen.ts.snap
··· 1 - // This file is auto-generated by @hey-api/openapi-ts 2 - 3 - export const $camelCaseCommentWithBreaks = { 4 - description: `Testing multiline comments in string: First line 5 - Second line 6 - 7 - Fourth line`, 8 - type: 'integer', 9 - } as const; 10 - 11 - export const $CommentWithBreaks = { 12 - description: `Testing multiline comments in string: First line 13 - Second line 14 - 15 - Fourth line`, 16 - type: 'integer', 17 - } as const; 18 - 19 - export const $CommentWithBackticks = { 20 - description: 'Testing backticks in string: `backticks` and ```multiple backticks``` should work', 21 - type: 'integer', 22 - } as const; 23 - 24 - export const $CommentWithBackticksAndQuotes = { 25 - description: `Testing backticks and quotes in string: \`backticks\`, 'quotes', "double quotes" and \`\`\`multiple backticks\`\`\` should work`, 26 - type: 'integer', 27 - } as const; 28 - 29 - export const $CommentWithSlashes = { 30 - description: 'Testing slashes in string: \backwards\\ and /forwards/// should work', 31 - type: 'integer', 32 - } as const; 33 - 34 - export const $CommentWithExpressionPlaceholders = { 35 - description: 'Testing expression placeholders in string: ${expression} should work', 36 - type: 'integer', 37 - } as const; 38 - 39 - export const $CommentWithQuotes = { 40 - description: `Testing quotes in string: 'single quote''' and "double quotes""" should work`, 41 - type: 'integer', 42 - } as const; 43 - 44 - export const $CommentWithReservedCharacters = { 45 - description: 'Testing reserved characters in string: /* inline */ and /** inline **/ should work', 46 - type: 'integer', 47 - } as const; 48 - 49 - export const $SimpleInteger = { 50 - description: 'This is a simple number', 51 - type: 'integer', 52 - } as const; 53 - 54 - export const $SimpleBoolean = { 55 - description: 'This is a simple boolean', 56 - type: 'boolean', 57 - } as const; 58 - 59 - export const $SimpleString = { 60 - description: 'This is a simple string', 61 - type: 'string', 62 - } as const; 63 - 64 - export const $NonAsciiStringæøåÆØÅöôêÊ字符串 = { 65 - description: 'A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串)', 66 - type: 'string', 67 - } as const; 68 - 69 - export const $SimpleFile = { 70 - description: 'This is a simple file', 71 - type: 'file', 72 - } as const; 73 - 74 - export const $SimpleReference = { 75 - description: 'This is a simple reference', 76 - $ref: '#/components/schemas/ModelWithString', 77 - } as const; 78 - 79 - export const $SimpleStringWithPattern = { 80 - description: 'This is a simple string', 81 - type: 'string', 82 - nullable: true, 83 - maxLength: 64, 84 - pattern: '^[a-zA-Z0-9_]*$', 85 - } as const; 86 - 87 - export const $EnumWithStrings = { 88 - description: 'This is a simple enum with strings', 89 - enum: ['Success', 'Warning', 'Error', "'Single Quote'", '"Double Quotes"', 'Non-ascii: øæåôöØÆÅÔÖ字符串'], 90 - } as const; 91 - 92 - export const $EnumWithReplacedCharacters = { 93 - enum: ["'Single Quote'", '"Double Quotes"', 'øæåôöØÆÅÔÖ字符串', 3.1, ''], 94 - type: 'string', 95 - } as const; 96 - 97 - export const $EnumWithNumbers = { 98 - description: 'This is a simple enum with numbers', 99 - enum: [1, 2, 3, 1.1, 1.2, 1.3, 100, 200, 300, -100, -200, -300, -1.1, -1.2, -1.3], 100 - default: 200, 101 - } as const; 102 - 103 - export const $EnumFromDescription = { 104 - description: 'Success=1,Warning=2,Error=3', 105 - type: 'number', 106 - } as const; 107 - 108 - export const $EnumWithExtensions = { 109 - description: 'This is a simple enum with numbers', 110 - enum: [200, 400, 500], 111 - 'x-enum-varnames': ['CUSTOM_SUCCESS', 'CUSTOM_WARNING', 'CUSTOM_ERROR'], 112 - 'x-enum-descriptions': [ 113 - 'Used when the status of something is successful', 114 - 'Used when the status of something has a warning', 115 - 'Used when the status of something has an error', 116 - ], 117 - } as const; 118 - 119 - export const $EnumWithXEnumNames = { 120 - enum: [0, 1, 2], 121 - 'x-enumNames': ['zero', 'one', 'two'], 122 - } as const; 123 - 124 - export const $ArrayWithNumbers = { 125 - description: 'This is a simple array with numbers', 126 - type: 'array', 127 - items: { 128 - type: 'integer', 129 - }, 130 - } as const; 131 - 132 - export const $ArrayWithBooleans = { 133 - description: 'This is a simple array with booleans', 134 - type: 'array', 135 - items: { 136 - type: 'boolean', 137 - }, 138 - } as const; 139 - 140 - export const $ArrayWithStrings = { 141 - description: 'This is a simple array with strings', 142 - type: 'array', 143 - items: { 144 - type: 'string', 145 - }, 146 - default: ['test'], 147 - } as const; 148 - 149 - export const $ArrayWithReferences = { 150 - description: 'This is a simple array with references', 151 - type: 'array', 152 - items: { 153 - $ref: '#/components/schemas/ModelWithString', 154 - }, 155 - } as const; 156 - 157 - export const $ArrayWithArray = { 158 - description: 'This is a simple array containing an array', 159 - type: 'array', 160 - items: { 161 - type: 'array', 162 - items: { 163 - $ref: '#/components/schemas/ModelWithString', 164 - }, 165 - }, 166 - } as const; 167 - 168 - export const $ArrayWithProperties = { 169 - description: 'This is a simple array with properties', 170 - type: 'array', 171 - items: { 172 - type: 'object', 173 - properties: { 174 - foo: { 175 - $ref: '#/components/schemas/camelCaseCommentWithBreaks', 176 - }, 177 - bar: { 178 - type: 'string', 179 - }, 180 - }, 181 - }, 182 - } as const; 183 - 184 - export const $ArrayWithAnyOfProperties = { 185 - description: 'This is a simple array with any of properties', 186 - type: 'array', 187 - items: { 188 - anyOf: [ 189 - { 190 - type: 'object', 191 - properties: { 192 - foo: { 193 - type: 'string', 194 - default: 'test', 195 - }, 196 - }, 197 - }, 198 - { 199 - type: 'object', 200 - properties: { 201 - bar: { 202 - type: 'string', 203 - }, 204 - }, 205 - }, 206 - ], 207 - }, 208 - } as const; 209 - 210 - export const $AnyOfAnyAndNull = { 211 - type: 'object', 212 - properties: { 213 - data: { 214 - anyOf: [ 215 - {}, 216 - { 217 - type: 'null', 218 - }, 219 - ], 220 - }, 221 - }, 222 - } as const; 223 - 224 - export const $AnyOfArrays = { 225 - description: 'This is a simple array with any of properties', 226 - type: 'object', 227 - properties: { 228 - results: { 229 - items: { 230 - anyOf: [ 231 - { 232 - type: 'object', 233 - properties: { 234 - foo: { 235 - type: 'string', 236 - }, 237 - }, 238 - }, 239 - { 240 - type: 'object', 241 - properties: { 242 - bar: { 243 - type: 'string', 244 - }, 245 - }, 246 - }, 247 - ], 248 - }, 249 - type: 'array', 250 - }, 251 - }, 252 - } as const; 253 - 254 - export const $DictionaryWithString = { 255 - description: 'This is a string dictionary', 256 - type: 'object', 257 - additionalProperties: { 258 - type: 'string', 259 - }, 260 - } as const; 261 - 262 - export const $DictionaryWithPropertiesAndAdditionalProperties = { 263 - type: 'object', 264 - properties: { 265 - foo: { 266 - type: 'string', 267 - }, 268 - }, 269 - additionalProperties: { 270 - type: 'string', 271 - }, 272 - } as const; 273 - 274 - export const $DictionaryWithReference = { 275 - description: 'This is a string reference', 276 - type: 'object', 277 - additionalProperties: { 278 - $ref: '#/components/schemas/ModelWithString', 279 - }, 280 - } as const; 281 - 282 - export const $DictionaryWithArray = { 283 - description: 'This is a complex dictionary', 284 - type: 'object', 285 - additionalProperties: { 286 - type: 'array', 287 - items: { 288 - $ref: '#/components/schemas/ModelWithString', 289 - }, 290 - }, 291 - } as const; 292 - 293 - export const $DictionaryWithDictionary = { 294 - description: 'This is a string dictionary', 295 - type: 'object', 296 - additionalProperties: { 297 - type: 'object', 298 - additionalProperties: { 299 - type: 'string', 300 - }, 301 - }, 302 - } as const; 303 - 304 - export const $DictionaryWithProperties = { 305 - description: 'This is a complex dictionary', 306 - type: 'object', 307 - additionalProperties: { 308 - type: 'object', 309 - properties: { 310 - foo: { 311 - type: 'string', 312 - }, 313 - bar: { 314 - type: 'string', 315 - }, 316 - }, 317 - }, 318 - } as const; 319 - 320 - export const $ModelWithInteger = { 321 - description: 'This is a model with one number property', 322 - type: 'object', 323 - properties: { 324 - prop: { 325 - description: 'This is a simple number property', 326 - type: 'integer', 327 - }, 328 - }, 329 - } as const; 330 - 331 - export const $ModelWithBoolean = { 332 - description: 'This is a model with one boolean property', 333 - type: 'object', 334 - properties: { 335 - prop: { 336 - description: 'This is a simple boolean property', 337 - type: 'boolean', 338 - }, 339 - }, 340 - } as const; 341 - 342 - export const $ModelWithString = { 343 - description: 'This is a model with one string property', 344 - type: 'object', 345 - properties: { 346 - prop: { 347 - description: 'This is a simple string property', 348 - type: 'string', 349 - }, 350 - }, 351 - } as const; 352 - 353 - export const $Model_From_Zendesk = { 354 - description: `\`Comment\` or \`VoiceComment\`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets)`, 355 - type: 'string', 356 - } as const; 357 - 358 - export const $ModelWithNullableString = { 359 - description: 'This is a model with one string property', 360 - type: 'object', 361 - required: ['nullableRequiredProp1', 'nullableRequiredProp2'], 362 - properties: { 363 - nullableProp1: { 364 - description: 'This is a simple string property', 365 - type: 'string', 366 - nullable: true, 367 - }, 368 - nullableRequiredProp1: { 369 - description: 'This is a simple string property', 370 - type: 'string', 371 - nullable: true, 372 - }, 373 - nullableProp2: { 374 - description: 'This is a simple string property', 375 - type: ['string', 'null'], 376 - }, 377 - nullableRequiredProp2: { 378 - description: 'This is a simple string property', 379 - type: ['string', 'null'], 380 - }, 381 - 'foo_bar-enum': { 382 - description: 'This is a simple enum with strings', 383 - enum: ['Success', 'Warning', 'Error', 'ØÆÅ字符串'], 384 - }, 385 - }, 386 - } as const; 387 - 388 - export const $ModelWithEnum = { 389 - description: 'This is a model with one enum', 390 - type: 'object', 391 - properties: { 392 - 'foo_bar-enum': { 393 - description: 'This is a simple enum with strings', 394 - enum: ['Success', 'Warning', 'Error', 'ØÆÅ字符串'], 395 - }, 396 - statusCode: { 397 - description: 'These are the HTTP error code enums', 398 - enum: ['100', '200 FOO', '300 FOO_BAR', '400 foo-bar', '500 foo.bar', '600 foo&bar'], 399 - }, 400 - bool: { 401 - description: 'Simple boolean enum', 402 - type: 'boolean', 403 - enum: [true], 404 - }, 405 - }, 406 - } as const; 407 - 408 - export const $ModelWithEnumWithHyphen = { 409 - description: 'This is a model with one enum with escaped name', 410 - type: 'object', 411 - properties: { 412 - 'foo-bar-baz-qux': { 413 - type: 'string', 414 - enum: ['3.0'], 415 - title: 'Foo-Bar-Baz-Qux', 416 - default: '3.0', 417 - }, 418 - }, 419 - } as const; 420 - 421 - export const $ModelWithEnumFromDescription = { 422 - description: 'This is a model with one enum', 423 - type: 'object', 424 - properties: { 425 - test: { 426 - type: 'integer', 427 - description: 'Success=1,Warning=2,Error=3', 428 - }, 429 - }, 430 - } as const; 431 - 432 - export const $ModelWithNestedEnums = { 433 - description: 'This is a model with nested enums', 434 - type: 'object', 435 - properties: { 436 - dictionaryWithEnum: { 437 - type: 'object', 438 - additionalProperties: { 439 - enum: ['Success', 'Warning', 'Error'], 440 - }, 441 - }, 442 - dictionaryWithEnumFromDescription: { 443 - type: 'object', 444 - additionalProperties: { 445 - type: 'integer', 446 - description: 'Success=1,Warning=2,Error=3', 447 - }, 448 - }, 449 - arrayWithEnum: { 450 - type: 'array', 451 - items: { 452 - enum: ['Success', 'Warning', 'Error'], 453 - }, 454 - }, 455 - arrayWithDescription: { 456 - type: 'array', 457 - items: { 458 - type: 'integer', 459 - description: 'Success=1,Warning=2,Error=3', 460 - }, 461 - }, 462 - 'foo_bar-enum': { 463 - description: 'This is a simple enum with strings', 464 - enum: ['Success', 'Warning', 'Error', 'ØÆÅ字符串'], 465 - }, 466 - }, 467 - } as const; 468 - 469 - export const $ModelWithReference = { 470 - description: 'This is a model with one property containing a reference', 471 - type: 'object', 472 - properties: { 473 - prop: { 474 - $ref: '#/components/schemas/ModelWithProperties', 475 - }, 476 - }, 477 - } as const; 478 - 479 - export const $ModelWithArrayReadOnlyAndWriteOnly = { 480 - description: 'This is a model with one property containing an array', 481 - type: 'object', 482 - properties: { 483 - prop: { 484 - type: 'array', 485 - items: { 486 - $ref: '#/components/schemas/ModelWithReadOnlyAndWriteOnly', 487 - }, 488 - }, 489 - propWithFile: { 490 - type: 'array', 491 - items: { 492 - type: 'file', 493 - }, 494 - }, 495 - propWithNumber: { 496 - type: 'array', 497 - items: { 498 - type: 'number', 499 - }, 500 - }, 501 - }, 502 - } as const; 503 - 504 - export const $ModelWithArray = { 505 - description: 'This is a model with one property containing an array', 506 - type: 'object', 507 - properties: { 508 - prop: { 509 - type: 'array', 510 - items: { 511 - $ref: '#/components/schemas/ModelWithString', 512 - }, 513 - }, 514 - propWithFile: { 515 - type: 'array', 516 - items: { 517 - type: 'file', 518 - }, 519 - }, 520 - propWithNumber: { 521 - type: 'array', 522 - items: { 523 - type: 'number', 524 - }, 525 - }, 526 - }, 527 - } as const; 528 - 529 - export const $ModelWithDictionary = { 530 - description: 'This is a model with one property containing a dictionary', 531 - type: 'object', 532 - properties: { 533 - prop: { 534 - type: 'object', 535 - additionalProperties: { 536 - type: 'string', 537 - }, 538 - }, 539 - }, 540 - } as const; 541 - 542 - export const $DeprecatedModel = { 543 - deprecated: true, 544 - description: 'This is a deprecated model with a deprecated property', 545 - type: 'object', 546 - properties: { 547 - prop: { 548 - deprecated: true, 549 - description: 'This is a deprecated property', 550 - type: 'string', 551 - }, 552 - }, 553 - } as const; 554 - 555 - export const $ModelWithCircularReference = { 556 - description: 'This is a model with one property containing a circular reference', 557 - type: 'object', 558 - properties: { 559 - prop: { 560 - $ref: '#/components/schemas/ModelWithCircularReference', 561 - }, 562 - }, 563 - } as const; 564 - 565 - export const $CompositionWithOneOf = { 566 - description: "This is a model with one property with a 'one of' relationship", 567 - type: 'object', 568 - properties: { 569 - propA: { 570 - type: 'object', 571 - oneOf: [ 572 - { 573 - $ref: '#/components/schemas/ModelWithString', 574 - }, 575 - { 576 - $ref: '#/components/schemas/ModelWithEnum', 577 - }, 578 - { 579 - $ref: '#/components/schemas/ModelWithArray', 580 - }, 581 - { 582 - $ref: '#/components/schemas/ModelWithDictionary', 583 - }, 584 - ], 585 - }, 586 - }, 587 - } as const; 588 - 589 - export const $CompositionWithOneOfAnonymous = { 590 - description: "This is a model with one property with a 'one of' relationship where the options are not $ref", 591 - type: 'object', 592 - properties: { 593 - propA: { 594 - type: 'object', 595 - oneOf: [ 596 - { 597 - description: 'Anonymous object type', 598 - type: 'object', 599 - properties: { 600 - propA: { 601 - type: 'string', 602 - }, 603 - }, 604 - }, 605 - { 606 - description: 'Anonymous string type', 607 - type: 'string', 608 - }, 609 - { 610 - description: 'Anonymous integer type', 611 - type: 'integer', 612 - }, 613 - ], 614 - }, 615 - }, 616 - } as const; 617 - 618 - export const $ModelCircle = { 619 - description: 'Circle', 620 - type: 'object', 621 - required: ['kind'], 622 - properties: { 623 - kind: { 624 - type: 'string', 625 - }, 626 - radius: { 627 - type: 'number', 628 - }, 629 - }, 630 - } as const; 631 - 632 - export const $ModelSquare = { 633 - description: 'Square', 634 - type: 'object', 635 - required: ['kind'], 636 - properties: { 637 - kind: { 638 - type: 'string', 639 - }, 640 - sideLength: { 641 - type: 'number', 642 - }, 643 - }, 644 - } as const; 645 - 646 - export const $CompositionWithOneOfDiscriminator = { 647 - description: "This is a model with one property with a 'one of' relationship where the options are not $ref", 648 - type: 'object', 649 - oneOf: [ 650 - { 651 - $ref: '#/components/schemas/ModelCircle', 652 - }, 653 - { 654 - $ref: '#/components/schemas/ModelSquare', 655 - }, 656 - ], 657 - discriminator: { 658 - propertyName: 'kind', 659 - mapping: { 660 - circle: '#/components/schemas/ModelCircle', 661 - square: '#/components/schemas/ModelSquare', 662 - }, 663 - }, 664 - } as const; 665 - 666 - export const $CompositionWithAnyOf = { 667 - description: "This is a model with one property with a 'any of' relationship", 668 - type: 'object', 669 - properties: { 670 - propA: { 671 - type: 'object', 672 - anyOf: [ 673 - { 674 - $ref: '#/components/schemas/ModelWithString', 675 - }, 676 - { 677 - $ref: '#/components/schemas/ModelWithEnum', 678 - }, 679 - { 680 - $ref: '#/components/schemas/ModelWithArray', 681 - }, 682 - { 683 - $ref: '#/components/schemas/ModelWithDictionary', 684 - }, 685 - ], 686 - }, 687 - }, 688 - } as const; 689 - 690 - export const $CompositionWithAnyOfAnonymous = { 691 - description: "This is a model with one property with a 'any of' relationship where the options are not $ref", 692 - type: 'object', 693 - properties: { 694 - propA: { 695 - type: 'object', 696 - anyOf: [ 697 - { 698 - description: 'Anonymous object type', 699 - type: 'object', 700 - properties: { 701 - propA: { 702 - type: 'string', 703 - }, 704 - }, 705 - }, 706 - { 707 - description: 'Anonymous string type', 708 - type: 'string', 709 - }, 710 - { 711 - description: 'Anonymous integer type', 712 - type: 'integer', 713 - }, 714 - ], 715 - }, 716 - }, 717 - } as const; 718 - 719 - export const $CompositionWithNestedAnyAndTypeNull = { 720 - description: "This is a model with nested 'any of' property with a type null", 721 - type: 'object', 722 - properties: { 723 - propA: { 724 - type: 'object', 725 - anyOf: [ 726 - { 727 - items: { 728 - anyOf: [ 729 - { 730 - $ref: '#/components/schemas/ModelWithDictionary', 731 - }, 732 - { 733 - type: 'null', 734 - }, 735 - ], 736 - }, 737 - type: 'array', 738 - }, 739 - { 740 - items: { 741 - anyOf: [ 742 - { 743 - $ref: '#/components/schemas/ModelWithArray', 744 - }, 745 - { 746 - type: 'null', 747 - }, 748 - ], 749 - }, 750 - type: 'array', 751 - }, 752 - ], 753 - }, 754 - }, 755 - } as const; 756 - 757 - export const $Enum1 = { 758 - enum: ['Bird', 'Dog'], 759 - type: 'string', 760 - } as const; 761 - 762 - export const $ConstValue = { 763 - type: 'string', 764 - const: 'ConstValue', 765 - } as const; 766 - 767 - export const $CompositionWithNestedAnyOfAndNull = { 768 - description: "This is a model with one property with a 'any of' relationship where the options are not $ref", 769 - type: 'object', 770 - properties: { 771 - propA: { 772 - anyOf: [ 773 - { 774 - items: { 775 - anyOf: [ 776 - { 777 - $ref: '#/components/schemas/Enum1', 778 - }, 779 - { 780 - $ref: '#/components/schemas/ConstValue', 781 - }, 782 - ], 783 - }, 784 - type: 'array', 785 - }, 786 - { 787 - type: 'null', 788 - }, 789 - ], 790 - title: 'Scopes', 791 - }, 792 - }, 793 - } as const; 794 - 795 - export const $CompositionWithOneOfAndNullable = { 796 - description: "This is a model with one property with a 'one of' relationship", 797 - type: 'object', 798 - properties: { 799 - propA: { 800 - nullable: true, 801 - type: 'object', 802 - oneOf: [ 803 - { 804 - type: 'object', 805 - properties: { 806 - boolean: { 807 - type: 'boolean', 808 - }, 809 - }, 810 - }, 811 - { 812 - $ref: '#/components/schemas/ModelWithEnum', 813 - }, 814 - { 815 - $ref: '#/components/schemas/ModelWithArray', 816 - }, 817 - { 818 - $ref: '#/components/schemas/ModelWithDictionary', 819 - }, 820 - ], 821 - }, 822 - }, 823 - } as const; 824 - 825 - export const $CompositionWithOneOfAndSimpleDictionary = { 826 - description: 'This is a model that contains a simple dictionary within composition', 827 - type: 'object', 828 - properties: { 829 - propA: { 830 - oneOf: [ 831 - { 832 - type: 'boolean', 833 - }, 834 - { 835 - type: 'object', 836 - additionalProperties: { 837 - type: 'number', 838 - }, 839 - }, 840 - ], 841 - }, 842 - }, 843 - } as const; 844 - 845 - export const $CompositionWithOneOfAndSimpleArrayDictionary = { 846 - description: 'This is a model that contains a dictionary of simple arrays within composition', 847 - type: 'object', 848 - properties: { 849 - propA: { 850 - oneOf: [ 851 - { 852 - type: 'boolean', 853 - }, 854 - { 855 - type: 'object', 856 - additionalProperties: { 857 - type: 'array', 858 - items: { 859 - type: 'boolean', 860 - }, 861 - }, 862 - }, 863 - ], 864 - }, 865 - }, 866 - } as const; 867 - 868 - export const $CompositionWithOneOfAndComplexArrayDictionary = { 869 - description: 'This is a model that contains a dictionary of complex arrays (composited) within composition', 870 - type: 'object', 871 - properties: { 872 - propA: { 873 - oneOf: [ 874 - { 875 - type: 'boolean', 876 - }, 877 - { 878 - type: 'object', 879 - additionalProperties: { 880 - type: 'array', 881 - items: { 882 - oneOf: [ 883 - { 884 - type: 'number', 885 - }, 886 - { 887 - type: 'string', 888 - }, 889 - ], 890 - }, 891 - }, 892 - }, 893 - ], 894 - }, 895 - }, 896 - } as const; 897 - 898 - export const $CompositionWithAllOfAndNullable = { 899 - description: "This is a model with one property with a 'all of' relationship", 900 - type: 'object', 901 - properties: { 902 - propA: { 903 - nullable: true, 904 - type: 'object', 905 - allOf: [ 906 - { 907 - type: 'object', 908 - properties: { 909 - boolean: { 910 - type: 'boolean', 911 - }, 912 - }, 913 - }, 914 - { 915 - $ref: '#/components/schemas/ModelWithEnum', 916 - }, 917 - { 918 - $ref: '#/components/schemas/ModelWithArray', 919 - }, 920 - { 921 - $ref: '#/components/schemas/ModelWithDictionary', 922 - }, 923 - ], 924 - }, 925 - }, 926 - } as const; 927 - 928 - export const $CompositionWithAnyOfAndNullable = { 929 - description: "This is a model with one property with a 'any of' relationship", 930 - type: 'object', 931 - properties: { 932 - propA: { 933 - nullable: true, 934 - type: 'object', 935 - anyOf: [ 936 - { 937 - type: 'object', 938 - properties: { 939 - boolean: { 940 - type: 'boolean', 941 - }, 942 - }, 943 - }, 944 - { 945 - $ref: '#/components/schemas/ModelWithEnum', 946 - }, 947 - { 948 - $ref: '#/components/schemas/ModelWithArray', 949 - }, 950 - { 951 - $ref: '#/components/schemas/ModelWithDictionary', 952 - }, 953 - ], 954 - }, 955 - }, 956 - } as const; 957 - 958 - export const $CompositionBaseModel = { 959 - description: 'This is a base model with two simple optional properties', 960 - type: 'object', 961 - properties: { 962 - firstName: { 963 - type: 'string', 964 - }, 965 - lastname: { 966 - type: 'string', 967 - }, 968 - }, 969 - } as const; 970 - 971 - export const $CompositionExtendedModel = { 972 - description: 'This is a model that extends the base model', 973 - type: 'object', 974 - allOf: [ 975 - { 976 - $ref: '#/components/schemas/CompositionBaseModel', 977 - }, 978 - ], 979 - properties: { 980 - age: { 981 - type: 'number', 982 - }, 983 - }, 984 - required: ['firstName', 'lastname', 'age'], 985 - } as const; 986 - 987 - export const $ModelWithProperties = { 988 - description: 'This is a model with one nested property', 989 - type: 'object', 990 - required: ['required', 'requiredAndReadOnly', 'requiredAndNullable'], 991 - properties: { 992 - required: { 993 - type: 'string', 994 - }, 995 - requiredAndReadOnly: { 996 - type: 'string', 997 - readOnly: true, 998 - }, 999 - requiredAndNullable: { 1000 - type: 'string', 1001 - nullable: true, 1002 - }, 1003 - string: { 1004 - type: 'string', 1005 - }, 1006 - number: { 1007 - type: 'number', 1008 - }, 1009 - boolean: { 1010 - type: 'boolean', 1011 - }, 1012 - reference: { 1013 - $ref: '#/components/schemas/ModelWithString', 1014 - }, 1015 - 'property with space': { 1016 - type: 'string', 1017 - }, 1018 - default: { 1019 - type: 'string', 1020 - }, 1021 - try: { 1022 - type: 'string', 1023 - }, 1024 - '@namespace.string': { 1025 - type: 'string', 1026 - readOnly: true, 1027 - }, 1028 - '@namespace.integer': { 1029 - type: 'integer', 1030 - readOnly: true, 1031 - }, 1032 - }, 1033 - } as const; 1034 - 1035 - export const $ModelWithNestedProperties = { 1036 - description: 'This is a model with one nested property', 1037 - type: 'object', 1038 - required: ['first'], 1039 - properties: { 1040 - first: { 1041 - type: 'object', 1042 - required: ['second'], 1043 - readOnly: true, 1044 - nullable: true, 1045 - properties: { 1046 - second: { 1047 - type: 'object', 1048 - required: ['third'], 1049 - readOnly: true, 1050 - nullable: true, 1051 - properties: { 1052 - third: { 1053 - type: 'string', 1054 - required: true, 1055 - readOnly: true, 1056 - nullable: true, 1057 - }, 1058 - }, 1059 - }, 1060 - }, 1061 - }, 1062 - }, 1063 - } as const; 1064 - 1065 - export const $ModelWithDuplicateProperties = { 1066 - description: 'This is a model with duplicated properties', 1067 - type: 'object', 1068 - properties: { 1069 - prop: { 1070 - $ref: '#/components/schemas/ModelWithString', 1071 - }, 1072 - }, 1073 - } as const; 1074 - 1075 - export const $ModelWithOrderedProperties = { 1076 - description: 'This is a model with ordered properties', 1077 - type: 'object', 1078 - properties: { 1079 - zebra: { 1080 - type: 'string', 1081 - }, 1082 - apple: { 1083 - type: 'string', 1084 - }, 1085 - hawaii: { 1086 - type: 'string', 1087 - }, 1088 - }, 1089 - } as const; 1090 - 1091 - export const $ModelWithDuplicateImports = { 1092 - description: 'This is a model with duplicated imports', 1093 - type: 'object', 1094 - properties: { 1095 - propA: { 1096 - $ref: '#/components/schemas/ModelWithString', 1097 - }, 1098 - propB: { 1099 - $ref: '#/components/schemas/ModelWithString', 1100 - }, 1101 - propC: { 1102 - $ref: '#/components/schemas/ModelWithString', 1103 - }, 1104 - }, 1105 - } as const; 1106 - 1107 - export const $ModelThatExtends = { 1108 - description: 'This is a model that extends another model', 1109 - type: 'object', 1110 - allOf: [ 1111 - { 1112 - $ref: '#/components/schemas/ModelWithString', 1113 - }, 1114 - { 1115 - type: 'object', 1116 - properties: { 1117 - propExtendsA: { 1118 - type: 'string', 1119 - }, 1120 - propExtendsB: { 1121 - $ref: '#/components/schemas/ModelWithString', 1122 - }, 1123 - }, 1124 - }, 1125 - ], 1126 - } as const; 1127 - 1128 - export const $ModelThatExtendsExtends = { 1129 - description: 'This is a model that extends another model', 1130 - type: 'object', 1131 - allOf: [ 1132 - { 1133 - $ref: '#/components/schemas/ModelWithString', 1134 - }, 1135 - { 1136 - $ref: '#/components/schemas/ModelThatExtends', 1137 - }, 1138 - { 1139 - type: 'object', 1140 - properties: { 1141 - propExtendsC: { 1142 - type: 'string', 1143 - }, 1144 - propExtendsD: { 1145 - $ref: '#/components/schemas/ModelWithString', 1146 - }, 1147 - }, 1148 - }, 1149 - ], 1150 - } as const; 1151 - 1152 - export const $ModelWithPattern = { 1153 - description: 'This is a model that contains a some patterns', 1154 - type: 'object', 1155 - required: ['key', 'name'], 1156 - properties: { 1157 - key: { 1158 - maxLength: 64, 1159 - pattern: '^[a-zA-Z0-9_]*$', 1160 - type: 'string', 1161 - }, 1162 - name: { 1163 - maxLength: 255, 1164 - type: 'string', 1165 - }, 1166 - enabled: { 1167 - type: 'boolean', 1168 - readOnly: true, 1169 - }, 1170 - modified: { 1171 - type: 'string', 1172 - format: 'date-time', 1173 - readOnly: true, 1174 - }, 1175 - id: { 1176 - type: 'string', 1177 - pattern: '^d{2}-d{3}-d{4}$', 1178 - }, 1179 - text: { 1180 - type: 'string', 1181 - pattern: '^w+$', 1182 - }, 1183 - patternWithSingleQuotes: { 1184 - type: 'string', 1185 - pattern: "^[a-zA-Z0-9']*$", 1186 - }, 1187 - patternWithNewline: { 1188 - type: 'string', 1189 - pattern: `aaa 1190 - bbb`, 1191 - }, 1192 - patternWithBacktick: { 1193 - type: 'string', 1194 - pattern: 'aaa`bbb', 1195 - }, 1196 - }, 1197 - } as const; 1198 - 1199 - export const $File = { 1200 - required: ['mime'], 1201 - type: 'object', 1202 - properties: { 1203 - id: { 1204 - title: 'Id', 1205 - type: 'string', 1206 - readOnly: true, 1207 - minLength: 1, 1208 - }, 1209 - updated_at: { 1210 - title: 'Updated at', 1211 - type: 'string', 1212 - format: 'date-time', 1213 - readOnly: true, 1214 - }, 1215 - created_at: { 1216 - title: 'Created at', 1217 - type: 'string', 1218 - format: 'date-time', 1219 - readOnly: true, 1220 - }, 1221 - mime: { 1222 - title: 'Mime', 1223 - type: 'string', 1224 - maxLength: 24, 1225 - minLength: 1, 1226 - }, 1227 - file: { 1228 - title: 'File', 1229 - type: 'string', 1230 - readOnly: true, 1231 - format: 'uri', 1232 - }, 1233 - }, 1234 - } as const; 1235 - 1236 - export const $default = { 1237 - type: 'object', 1238 - properties: { 1239 - name: { 1240 - type: 'string', 1241 - }, 1242 - }, 1243 - } as const; 1244 - 1245 - export const $Pageable = { 1246 - type: 'object', 1247 - properties: { 1248 - page: { 1249 - minimum: 0, 1250 - type: 'integer', 1251 - format: 'int32', 1252 - default: 0, 1253 - }, 1254 - size: { 1255 - minimum: 1, 1256 - type: 'integer', 1257 - format: 'int32', 1258 - }, 1259 - sort: { 1260 - type: 'array', 1261 - items: { 1262 - type: 'string', 1263 - }, 1264 - }, 1265 - }, 1266 - } as const; 1267 - 1268 - export const $FreeFormObjectWithoutAdditionalProperties = { 1269 - description: 'This is a free-form object without additionalProperties.', 1270 - type: 'object', 1271 - } as const; 1272 - 1273 - export const $FreeFormObjectWithAdditionalPropertiesEqTrue = { 1274 - description: 'This is a free-form object with additionalProperties: true.', 1275 - type: 'object', 1276 - additionalProperties: true, 1277 - } as const; 1278 - 1279 - export const $FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { 1280 - description: 'This is a free-form object with additionalProperties: {}.', 1281 - type: 'object', 1282 - additionalProperties: {}, 1283 - } as const; 1284 - 1285 - export const $ModelWithConst = { 1286 - type: 'object', 1287 - properties: { 1288 - String: { 1289 - const: 'String', 1290 - }, 1291 - number: { 1292 - const: 0, 1293 - }, 1294 - null: { 1295 - const: null, 1296 - }, 1297 - withType: { 1298 - type: 'string', 1299 - const: 'Some string', 1300 - }, 1301 - }, 1302 - } as const; 1303 - 1304 - export const $ModelWithAdditionalPropertiesEqTrue = { 1305 - description: 'This is a model with one property and additionalProperties: true', 1306 - type: 'object', 1307 - properties: { 1308 - prop: { 1309 - description: 'This is a simple string property', 1310 - type: 'string', 1311 - }, 1312 - }, 1313 - additionalProperties: true, 1314 - } as const; 1315 - 1316 - export const $NestedAnyOfArraysNullable = { 1317 - properties: { 1318 - nullableArray: { 1319 - anyOf: [ 1320 - { 1321 - items: { 1322 - anyOf: [ 1323 - { 1324 - type: 'string', 1325 - }, 1326 - { 1327 - type: 'boolean', 1328 - }, 1329 - ], 1330 - }, 1331 - type: 'array', 1332 - }, 1333 - { 1334 - type: 'null', 1335 - }, 1336 - ], 1337 - }, 1338 - }, 1339 - type: 'object', 1340 - } as const; 1341 - 1342 - export const $CompositionWithOneOfAndProperties = { 1343 - type: 'object', 1344 - oneOf: [ 1345 - { 1346 - type: 'object', 1347 - required: ['foo'], 1348 - properties: { 1349 - foo: { 1350 - $ref: '#/components/parameters/SimpleParameter', 1351 - }, 1352 - }, 1353 - additionalProperties: false, 1354 - }, 1355 - { 1356 - type: 'object', 1357 - required: ['bar'], 1358 - properties: { 1359 - bar: { 1360 - $ref: '#/components/schemas/NonAsciiString%C3%A6%C3%B8%C3%A5%C3%86%C3%98%C3%85%C3%B6%C3%B4%C3%AA%C3%8A%E5%AD%97%E7%AC%A6%E4%B8%B2', 1361 - }, 1362 - }, 1363 - additionalProperties: false, 1364 - }, 1365 - ], 1366 - required: ['baz', 'qux'], 1367 - properties: { 1368 - baz: { 1369 - type: 'integer', 1370 - format: 'uint16', 1371 - minimum: 0, 1372 - nullable: true, 1373 - }, 1374 - qux: { 1375 - type: 'integer', 1376 - format: 'uint8', 1377 - minimum: 0, 1378 - }, 1379 - }, 1380 - } as const; 1381 - 1382 - export const $NullableObject = { 1383 - type: 'object', 1384 - nullable: true, 1385 - description: 'An object that can be null', 1386 - properties: { 1387 - foo: { 1388 - type: 'string', 1389 - }, 1390 - }, 1391 - default: null, 1392 - } as const; 1393 - 1394 - export const $CharactersInDescription = { 1395 - type: 'string', 1396 - description: 'Some % character', 1397 - } as const; 1398 - 1399 - export const $ModelWithNullableObject = { 1400 - type: 'object', 1401 - properties: { 1402 - data: { 1403 - $ref: '#/components/schemas/NullableObject', 1404 - }, 1405 - }, 1406 - } as const; 1407 - 1408 - export const $ModelWithOneOfEnum = { 1409 - oneOf: [ 1410 - { 1411 - type: 'object', 1412 - required: ['foo'], 1413 - properties: { 1414 - foo: { 1415 - type: 'string', 1416 - enum: ['Bar'], 1417 - }, 1418 - }, 1419 - }, 1420 - { 1421 - type: 'object', 1422 - required: ['foo'], 1423 - properties: { 1424 - foo: { 1425 - type: 'string', 1426 - enum: ['Baz'], 1427 - }, 1428 - }, 1429 - }, 1430 - { 1431 - type: 'object', 1432 - required: ['foo'], 1433 - properties: { 1434 - foo: { 1435 - type: 'string', 1436 - enum: ['Qux'], 1437 - }, 1438 - }, 1439 - }, 1440 - { 1441 - type: 'object', 1442 - required: ['content', 'foo'], 1443 - properties: { 1444 - content: { 1445 - type: 'string', 1446 - format: 'date-time', 1447 - }, 1448 - foo: { 1449 - type: 'string', 1450 - enum: ['Quux'], 1451 - }, 1452 - }, 1453 - }, 1454 - { 1455 - type: 'object', 1456 - required: ['content', 'foo'], 1457 - properties: { 1458 - content: { 1459 - type: 'array', 1460 - items: [ 1461 - { 1462 - type: 'string', 1463 - format: 'date-time', 1464 - }, 1465 - { 1466 - type: 'string', 1467 - }, 1468 - ], 1469 - maxItems: 2, 1470 - minItems: 2, 1471 - }, 1472 - foo: { 1473 - type: 'string', 1474 - enum: ['Corge'], 1475 - }, 1476 - }, 1477 - }, 1478 - ], 1479 - } as const; 1480 - 1481 - export const $ModelWithNestedArrayEnumsDataFoo = { 1482 - enum: ['foo', 'bar'], 1483 - type: 'string', 1484 - } as const; 1485 - 1486 - export const $ModelWithNestedArrayEnumsDataBar = { 1487 - enum: ['baz', 'qux'], 1488 - type: 'string', 1489 - } as const; 1490 - 1491 - export const $ModelWithNestedArrayEnumsData = { 1492 - type: 'object', 1493 - properties: { 1494 - foo: { 1495 - type: 'array', 1496 - items: { 1497 - $ref: '#/components/schemas/ModelWithNestedArrayEnumsDataFoo', 1498 - }, 1499 - }, 1500 - bar: { 1501 - type: 'array', 1502 - items: { 1503 - $ref: '#/components/schemas/ModelWithNestedArrayEnumsDataBar', 1504 - }, 1505 - }, 1506 - }, 1507 - } as const; 1508 - 1509 - export const $ModelWithNestedArrayEnums = { 1510 - type: 'object', 1511 - properties: { 1512 - array_strings: { 1513 - type: 'array', 1514 - items: { 1515 - type: 'string', 1516 - }, 1517 - }, 1518 - data: { 1519 - allOf: [ 1520 - { 1521 - $ref: '#/components/schemas/ModelWithNestedArrayEnumsData', 1522 - }, 1523 - ], 1524 - }, 1525 - }, 1526 - } as const; 1527 - 1528 - export const $ModelWithNestedCompositionEnums = { 1529 - type: 'object', 1530 - properties: { 1531 - foo: { 1532 - allOf: [ 1533 - { 1534 - $ref: '#/components/schemas/ModelWithNestedArrayEnumsDataFoo', 1535 - }, 1536 - ], 1537 - }, 1538 - }, 1539 - } as const; 1540 - 1541 - export const $ModelWithReadOnlyAndWriteOnly = { 1542 - type: 'object', 1543 - required: ['foo', 'bar', 'baz'], 1544 - properties: { 1545 - foo: { 1546 - type: 'string', 1547 - }, 1548 - bar: { 1549 - readOnly: true, 1550 - type: 'string', 1551 - }, 1552 - baz: { 1553 - type: 'string', 1554 - writeOnly: true, 1555 - }, 1556 - }, 1557 - } as const; 1558 - 1559 - export const $ModelWithConstantSizeArray = { 1560 - type: 'array', 1561 - items: { 1562 - type: 'number', 1563 - }, 1564 - minItems: 2, 1565 - maxItems: 2, 1566 - } as const; 1567 - 1568 - export const $ModelWithAnyOfConstantSizeArray = { 1569 - type: 'array', 1570 - items: { 1571 - oneOf: [ 1572 - { 1573 - type: 'number', 1574 - }, 1575 - { 1576 - type: 'string', 1577 - }, 1578 - ], 1579 - }, 1580 - minItems: 3, 1581 - maxItems: 3, 1582 - } as const; 1583 - 1584 - export const $ModelWithAnyOfConstantSizeArrayNullable = { 1585 - type: 'array', 1586 - items: { 1587 - oneOf: [ 1588 - { 1589 - type: 'number', 1590 - nullable: true, 1591 - }, 1592 - { 1593 - type: 'string', 1594 - }, 1595 - ], 1596 - }, 1597 - minItems: 3, 1598 - maxItems: 3, 1599 - } as const; 1600 - 1601 - export const $ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = { 1602 - type: 'array', 1603 - items: { 1604 - oneOf: [ 1605 - { 1606 - type: 'number', 1607 - }, 1608 - { 1609 - type: 'string', 1610 - }, 1611 - ], 1612 - }, 1613 - minItems: 2, 1614 - maxItems: 2, 1615 - } as const; 1616 - 1617 - export const $ModelWithAnyOfConstantSizeArrayAndIntersect = { 1618 - type: 'array', 1619 - items: { 1620 - allOf: [ 1621 - { 1622 - type: 'number', 1623 - }, 1624 - { 1625 - type: 'string', 1626 - }, 1627 - ], 1628 - }, 1629 - minItems: 2, 1630 - maxItems: 2, 1631 - } as const; 1632 - 1633 - export const $ModelWithNumericEnumUnion = { 1634 - type: 'object', 1635 - properties: { 1636 - value: { 1637 - type: 'number', 1638 - description: 'Период', 1639 - enum: [1, 3, 6, 12], 1640 - }, 1641 - }, 1642 - } as const; 1643 - 1644 - export const $SimpleParameter = { 1645 - description: 'This is a reusable parameter', 1646 - name: 'parameter', 1647 - in: 'query', 1648 - required: false, 1649 - schema: { 1650 - type: 'string', 1651 - }, 1652 - } as const; 1653 - 1654 - export const $x_Foo_Bar = { 1655 - description: 'Parameter with illegal characters', 1656 - name: 'x-Foo-Bar', 1657 - in: 'header', 1658 - required: true, 1659 - schema: { 1660 - type: 'string', 1661 - }, 1662 - } as const;
-1
packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/index.ts.snap
··· 4 4 export { CancelablePromise, CancelError } from './core/CancelablePromise'; 5 5 export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI'; 6 6 export * from './enums.gen'; 7 - export * from './schemas.gen'; 8 7 export * from './services.gen'; 9 8 export * from './types.gen';
-20
packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/schemas.gen.ts.snap packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_json/schemas.gen.ts.snap
··· 1640 1640 }, 1641 1641 }, 1642 1642 } as const; 1643 - 1644 - export const $SimpleParameter = { 1645 - description: 'This is a reusable parameter', 1646 - name: 'parameter', 1647 - in: 'query', 1648 - required: false, 1649 - schema: { 1650 - type: 'string', 1651 - }, 1652 - } as const; 1653 - 1654 - export const $x_Foo_Bar = { 1655 - description: 'Parameter with illegal characters', 1656 - name: 'x-Foo-Bar', 1657 - in: 'header', 1658 - required: true, 1659 - schema: { 1660 - type: 'string', 1661 - }, 1662 - } as const;
+3
packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_json/index.ts.snap
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export * from './schemas.gen';
+15
packages/openapi-ts/test/index.spec.ts
··· 71 71 ...config, 72 72 client: 'angular', 73 73 enums: false, 74 + schemas: false, 74 75 } as UserConfig, 75 76 description: 'generate angular client', 76 77 name: 'v3_angular', ··· 116 117 ...config, 117 118 exportCore: false, 118 119 exportServices: false, 120 + schemas: false, 119 121 types: '^ModelWithPattern', 120 122 useDateType: true, 121 123 } as UserConfig, ··· 159 161 config: { 160 162 ...config, 161 163 enums: 'typescript', 164 + schemas: false, 162 165 } as UserConfig, 163 166 description: 'generate TypeScript enums', 164 167 name: 'v3_enums_typescript', ··· 188 191 } as UserConfig, 189 192 description: 'generate pascalcase types', 190 193 name: 'v3_pascalcase', 194 + }, 195 + { 196 + config: { 197 + ...config, 198 + enums: false, 199 + exportCore: false, 200 + exportServices: false, 201 + schemas: true, 202 + types: false, 203 + } as UserConfig, 204 + description: 'generate JSON Schemas', 205 + name: 'v3_schemas_json', 191 206 }, 192 207 ])('$description', async ({ name, config }) => { 193 208 const output = toOutputPath(name);