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.

test: clean up Zod 3 tests

Lubos 517b2619 ad17c246

+14762 -65
+741
packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/mini/default/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import * as z from 'zod/v4-mini'; 4 + 5 + /** 6 + * Testing multiline comments in string: First line 7 + * Second line 8 + * 9 + * Fourth line 10 + */ 11 + export const zCommentWithBreaks = z.int(); 12 + 13 + /** 14 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 15 + */ 16 + export const zCommentWithBackticks = z.int(); 17 + 18 + /** 19 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 20 + */ 21 + export const zCommentWithBackticksAndQuotes = z.int(); 22 + 23 + /** 24 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 25 + */ 26 + export const zCommentWithSlashes = z.int(); 27 + 28 + /** 29 + * Testing expression placeholders in string: ${expression} should work 30 + */ 31 + export const zCommentWithExpressionPlaceholders = z.int(); 32 + 33 + /** 34 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 35 + */ 36 + export const zCommentWithQuotes = z.int(); 37 + 38 + /** 39 + * Testing reserved characters in string: * inline * and ** inline ** should work 40 + */ 41 + export const zCommentWithReservedCharacters = z.int(); 42 + 43 + /** 44 + * This is a simple number 45 + */ 46 + export const zSimpleInteger = z.int(); 47 + 48 + /** 49 + * This is a simple boolean 50 + */ 51 + export const zSimpleBoolean = z.boolean(); 52 + 53 + /** 54 + * This is a simple string 55 + */ 56 + export const zSimpleString = z.string(); 57 + 58 + /** 59 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 60 + */ 61 + export const zNonAsciiStringæøåÆøÅöôêÊ字符串 = z.string(); 62 + 63 + /** 64 + * This is a simple file 65 + */ 66 + export const zSimpleFile = z.string(); 67 + 68 + /** 69 + * This is a model with one string property 70 + */ 71 + export const zModelWithString = z.object({ 72 + prop: z.optional(z.string()) 73 + }); 74 + 75 + export const zSimpleReference = zModelWithString; 76 + 77 + /** 78 + * This is a simple string 79 + */ 80 + export const zSimpleStringWithPattern = z.string().check(z.maxLength(64), z.regex(/^[a-zA-Z0-9_]*$/)); 81 + 82 + /** 83 + * This is a simple enum with strings 84 + */ 85 + export const zEnumWithStrings = z.enum([ 86 + 'Success', 87 + 'Warning', 88 + 'Error', 89 + "'Single Quote'", 90 + '"Double Quotes"', 91 + 'Non-ascii: øæåôöØÆÅÔÖ字符串' 92 + ]); 93 + 94 + /** 95 + * This is a simple enum with numbers 96 + */ 97 + export const zEnumWithNumbers = z.unknown(); 98 + 99 + /** 100 + * Success=1,Warning=2,Error=3 101 + */ 102 + export const zEnumFromDescription = z.number(); 103 + 104 + /** 105 + * This is a simple enum with numbers 106 + */ 107 + export const zEnumWithExtensions = z.unknown(); 108 + 109 + /** 110 + * This is a simple array with numbers 111 + */ 112 + export const zArrayWithNumbers = z.array(z.int()); 113 + 114 + /** 115 + * This is a simple array with booleans 116 + */ 117 + export const zArrayWithBooleans = z.array(z.boolean()); 118 + 119 + /** 120 + * This is a simple array with strings 121 + */ 122 + export const zArrayWithStrings = z.array(z.string()); 123 + 124 + /** 125 + * This is a simple array with references 126 + */ 127 + export const zArrayWithReferences = z.array(zModelWithString); 128 + 129 + /** 130 + * This is a simple array containing an array 131 + */ 132 + export const zArrayWithArray = z.array(z.array(zModelWithString)); 133 + 134 + /** 135 + * This is a simple array with properties 136 + */ 137 + export const zArrayWithProperties = z.array(z.object({ 138 + foo: z.optional(z.string()), 139 + bar: z.optional(z.string()) 140 + })); 141 + 142 + /** 143 + * This is a string dictionary 144 + */ 145 + export const zDictionaryWithString = z.object({}); 146 + 147 + /** 148 + * This is a string reference 149 + */ 150 + export const zDictionaryWithReference = z.object({}); 151 + 152 + /** 153 + * This is a complex dictionary 154 + */ 155 + export const zDictionaryWithArray = z.object({}); 156 + 157 + /** 158 + * This is a string dictionary 159 + */ 160 + export const zDictionaryWithDictionary = z.record(z.string(), z.object({})); 161 + 162 + /** 163 + * This is a complex dictionary 164 + */ 165 + export const zDictionaryWithProperties = z.record(z.string(), z.object({ 166 + foo: z.optional(z.string()), 167 + bar: z.optional(z.string()) 168 + })); 169 + 170 + /** 171 + * This is a type-only model that defines Date as a string 172 + */ 173 + export const zDate = z.string(); 174 + 175 + /** 176 + * This is a model with one number property 177 + */ 178 + export const zModelWithInteger = z.object({ 179 + prop: z.optional(z.int()) 180 + }); 181 + 182 + /** 183 + * This is a model with one boolean property 184 + */ 185 + export const zModelWithBoolean = z.object({ 186 + prop: z.optional(z.boolean()) 187 + }); 188 + 189 + /** 190 + * This is a model with one string property 191 + */ 192 + export const zModelWithStringError = z.object({ 193 + prop: z.optional(z.string()) 194 + }); 195 + 196 + /** 197 + * This is a model with one string property 198 + */ 199 + export const zModelWithNullableString = z.object({ 200 + nullableProp: z.optional(z.union([ 201 + z.string(), 202 + z.null() 203 + ])), 204 + nullableRequiredProp: z.union([ 205 + z.string(), 206 + z.null() 207 + ]) 208 + }); 209 + 210 + /** 211 + * This is a model with one enum 212 + */ 213 + export const zModelWithEnum = z.object({ 214 + test: z.optional(z.enum([ 215 + 'Success', 216 + 'Warning', 217 + 'Error', 218 + 'ØÆÅ字符串' 219 + ])), 220 + statusCode: z.optional(z.enum([ 221 + '100', 222 + '200 FOO', 223 + '300 FOO_BAR', 224 + '400 foo-bar', 225 + '500 foo.bar', 226 + '600 foo&bar' 227 + ])), 228 + bool: z.optional(z.unknown()) 229 + }); 230 + 231 + /** 232 + * This is a model with one enum 233 + */ 234 + export const zModelWithEnumFromDescription = z.object({ 235 + test: z.optional(z.int()) 236 + }); 237 + 238 + /** 239 + * This is a model with nested enums 240 + */ 241 + export const zModelWithNestedEnums = z.object({ 242 + dictionaryWithEnum: z.optional(z.object({})), 243 + dictionaryWithEnumFromDescription: z.optional(z.object({})), 244 + arrayWithEnum: z.optional(z.array(z.enum([ 245 + 'Success', 246 + 'Warning', 247 + 'Error' 248 + ]))), 249 + arrayWithDescription: z.optional(z.array(z.int())) 250 + }); 251 + 252 + /** 253 + * This is a model with one nested property 254 + */ 255 + export const zModelWithProperties = z.object({ 256 + required: z.string(), 257 + requiredAndReadOnly: z.readonly(z.string()), 258 + string: z.optional(z.string()), 259 + number: z.optional(z.number()), 260 + boolean: z.optional(z.boolean()), 261 + reference: z.optional(zModelWithString), 262 + 'property with space': z.optional(z.string()), 263 + default: z.optional(z.string()), 264 + try: z.optional(z.string()), 265 + '@namespace.string': z.optional(z.readonly(z.string())), 266 + '@namespace.integer': z.optional(z.readonly(z.int())) 267 + }); 268 + 269 + /** 270 + * This is a model with one property containing a reference 271 + */ 272 + export const zModelWithReference = z.object({ 273 + prop: z.optional(zModelWithProperties) 274 + }); 275 + 276 + /** 277 + * This is a model with one property containing an array 278 + */ 279 + export const zModelWithArray = z.object({ 280 + prop: z.optional(z.array(zModelWithString)), 281 + propWithFile: z.optional(z.array(z.string())), 282 + propWithNumber: z.optional(z.array(z.number())) 283 + }); 284 + 285 + /** 286 + * This is a model with one property containing a dictionary 287 + */ 288 + export const zModelWithDictionary = z.object({ 289 + prop: z.optional(z.object({})) 290 + }); 291 + 292 + /** 293 + * This is a model with one property containing a circular reference 294 + */ 295 + export const zModelWithCircularReference = z.object({ 296 + prop: z.optional(z.lazy(() => { 297 + return zModelWithCircularReference; 298 + })) 299 + }); 300 + 301 + /** 302 + * This is a model with one nested property 303 + */ 304 + export const zModelWithNestedProperties = z.object({ 305 + first: z.readonly(z.object({ 306 + second: z.readonly(z.object({ 307 + third: z.readonly(z.string()) 308 + })) 309 + })) 310 + }); 311 + 312 + /** 313 + * This is a model with duplicated properties 314 + */ 315 + export const zModelWithDuplicateProperties = z.object({ 316 + prop: z.optional(zModelWithString) 317 + }); 318 + 319 + /** 320 + * This is a model with ordered properties 321 + */ 322 + export const zModelWithOrderedProperties = z.object({ 323 + zebra: z.optional(z.string()), 324 + apple: z.optional(z.string()), 325 + hawaii: z.optional(z.string()) 326 + }); 327 + 328 + /** 329 + * This is a model with duplicated imports 330 + */ 331 + export const zModelWithDuplicateImports = z.object({ 332 + propA: z.optional(zModelWithString), 333 + propB: z.optional(zModelWithString), 334 + propC: z.optional(zModelWithString) 335 + }); 336 + 337 + /** 338 + * This is a model that extends another model 339 + */ 340 + export const zModelThatExtends = z.intersection(zModelWithString, z.object({ 341 + propExtendsA: z.optional(z.string()), 342 + propExtendsB: z.optional(zModelWithString) 343 + })); 344 + 345 + /** 346 + * This is a model that extends another model 347 + */ 348 + export const zModelThatExtendsExtends = z.intersection(z.intersection(zModelWithString, zModelThatExtends), z.object({ 349 + propExtendsC: z.optional(z.string()), 350 + propExtendsD: z.optional(zModelWithString) 351 + })); 352 + 353 + export const zDefault = z.object({ 354 + name: z.optional(z.string()) 355 + }); 356 + 357 + /** 358 + * This is a model that contains a some patterns 359 + */ 360 + export const zModelWithPattern = z.object({ 361 + key: z.string().check(z.maxLength(64), z.regex(/^[a-zA-Z0-9_]*$/)), 362 + name: z.string().check(z.maxLength(255)), 363 + enabled: z.optional(z.readonly(z.boolean())), 364 + modified: z.optional(z.readonly(z.iso.datetime())), 365 + id: z.optional(z.string().check(z.regex(/^\d{2}-\d{3}-\d{4}$/))), 366 + text: z.optional(z.string().check(z.regex(/^\w+$/))), 367 + patternWithSingleQuotes: z.optional(z.string().check(z.regex(/^[a-zA-Z0-9']*$/))), 368 + patternWithNewline: z.optional(z.string().check(z.regex(/aaa\nbbb/))), 369 + patternWithBacktick: z.optional(z.string().check(z.regex(/aaa`bbb/))) 370 + }); 371 + 372 + export const zParameterActivityParams = z.object({ 373 + description: z.optional(z.string()), 374 + graduate_id: z.optional(z.int()), 375 + organization_id: z.optional(z.int()), 376 + parent_activity: z.optional(z.int()), 377 + post_id: z.optional(z.int()) 378 + }); 379 + 380 + export const zResponsePostActivityResponse = z.object({ 381 + description: z.optional(z.string()), 382 + graduate_id: z.optional(z.int()), 383 + organization_id: z.optional(z.int()), 384 + parent_activity_id: z.optional(z.int()), 385 + post_id: z.optional(z.int()) 386 + }); 387 + 388 + export const zFailureFailure = z.object({ 389 + error: z.optional(z.string()), 390 + message: z.optional(z.string()), 391 + reference_code: z.optional(z.string()) 392 + }); 393 + 394 + export const zServiceWithEmptyTagData = z.object({ 395 + body: z.optional(z.never()), 396 + path: z.optional(z.never()), 397 + query: z.optional(z.never()) 398 + }); 399 + 400 + export const zPatchApiVbyApiVersionNoTagData = z.object({ 401 + body: z.optional(z.never()), 402 + path: z.optional(z.never()), 403 + query: z.optional(z.never()) 404 + }); 405 + 406 + export const zFooWowData = z.object({ 407 + body: z.optional(z.never()), 408 + path: z.optional(z.never()), 409 + query: z.optional(z.never()) 410 + }); 411 + 412 + export const zDeleteCallWithoutParametersAndResponseData = z.object({ 413 + body: z.optional(z.never()), 414 + path: z.optional(z.never()), 415 + query: z.optional(z.never()) 416 + }); 417 + 418 + export const zGetCallWithoutParametersAndResponseData = z.object({ 419 + body: z.optional(z.never()), 420 + path: z.optional(z.never()), 421 + query: z.optional(z.never()) 422 + }); 423 + 424 + export const zHeadCallWithoutParametersAndResponseData = z.object({ 425 + body: z.optional(z.never()), 426 + path: z.optional(z.never()), 427 + query: z.optional(z.never()) 428 + }); 429 + 430 + export const zOptionsCallWithoutParametersAndResponseData = z.object({ 431 + body: z.optional(z.never()), 432 + path: z.optional(z.never()), 433 + query: z.optional(z.never()) 434 + }); 435 + 436 + export const zPatchCallWithoutParametersAndResponseData = z.object({ 437 + body: z.optional(z.never()), 438 + path: z.optional(z.never()), 439 + query: z.optional(z.never()) 440 + }); 441 + 442 + export const zPostCallWithoutParametersAndResponseData = z.object({ 443 + body: z.optional(z.never()), 444 + path: z.optional(z.never()), 445 + query: z.optional(z.never()) 446 + }); 447 + 448 + export const zPutCallWithoutParametersAndResponseData = z.object({ 449 + body: z.optional(z.never()), 450 + path: z.optional(z.never()), 451 + query: z.optional(z.never()) 452 + }); 453 + 454 + export const zCallWithDescriptionsData = z.object({ 455 + body: z.optional(z.never()), 456 + path: z.optional(z.never()), 457 + query: z.optional(z.object({ 458 + parameterWithBreaks: z.optional(z.string()), 459 + parameterWithBackticks: z.optional(z.string()), 460 + parameterWithSlashes: z.optional(z.string()), 461 + parameterWithExpressionPlaceholders: z.optional(z.string()), 462 + parameterWithQuotes: z.optional(z.string()), 463 + parameterWithReservedCharacters: z.optional(z.string()) 464 + })) 465 + }); 466 + 467 + export const zCallWithParametersData = z.object({ 468 + body: z.optional(z.never()), 469 + path: z.object({ 470 + parameterPath: z.string(), 471 + 'api-version': z.string() 472 + }), 473 + query: z.object({ 474 + parameterQuery: z.string() 475 + }), 476 + headers: z.object({ 477 + parameterHeader: z.string() 478 + }) 479 + }); 480 + 481 + export const zCallWithWeirdParameterNamesData = z.object({ 482 + body: z.optional(z.never()), 483 + path: z.object({ 484 + 'parameter.path.1': z.optional(z.string()), 485 + 'parameter-path-2': z.optional(z.string()), 486 + 'PARAMETER-PATH-3': z.optional(z.string()), 487 + 'api-version': z.string() 488 + }), 489 + query: z.object({ 490 + default: z.optional(z.string()), 491 + 'parameter-query': z.string() 492 + }), 493 + headers: z.object({ 494 + 'parameter.header': z.string() 495 + }) 496 + }); 497 + 498 + export const zCallWithDefaultParametersData = z.object({ 499 + body: z.optional(z.never()), 500 + path: z.optional(z.never()), 501 + query: z.object({ 502 + parameterString: z._default(z.string(), 'Hello World!'), 503 + parameterNumber: z._default(z.number(), 123), 504 + parameterBoolean: z._default(z.boolean(), true), 505 + parameterEnum: z.enum([ 506 + 'Success', 507 + 'Warning', 508 + 'Error' 509 + ]), 510 + parameterModel: z._default(z.object({ 511 + prop: z.optional(z.string()) 512 + }), { 513 + prop: 'Hello World!' 514 + }) 515 + }) 516 + }); 517 + 518 + export const zCallWithDefaultOptionalParametersData = z.object({ 519 + body: z.optional(z.never()), 520 + path: z.optional(z.never()), 521 + query: z.optional(z.object({ 522 + parameterString: z._default(z.optional(z.string()), 'Hello World!'), 523 + parameterNumber: z._default(z.optional(z.number()), 123), 524 + parameterBoolean: z._default(z.optional(z.boolean()), true), 525 + parameterEnum: z.optional(z.enum([ 526 + 'Success', 527 + 'Warning', 528 + 'Error' 529 + ])) 530 + })) 531 + }); 532 + 533 + export const zCallToTestOrderOfParamsData = z.object({ 534 + body: z.optional(z.never()), 535 + path: z.optional(z.never()), 536 + query: z.object({ 537 + parameterOptionalStringWithDefault: z._default(z.optional(z.string()), 'Hello World!'), 538 + parameterOptionalStringWithEmptyDefault: z._default(z.optional(z.string()), ''), 539 + parameterOptionalStringWithNoDefault: z.optional(z.string()), 540 + parameterStringWithDefault: z._default(z.string(), 'Hello World!'), 541 + parameterStringWithEmptyDefault: z._default(z.string(), ''), 542 + parameterStringWithNoDefault: z.string(), 543 + parameterStringNullableWithNoDefault: z.optional(z.union([ 544 + z.string(), 545 + z.null() 546 + ])), 547 + parameterStringNullableWithDefault: z._default(z.optional(z.union([ 548 + z.string(), 549 + z.null() 550 + ])), null) 551 + }) 552 + }); 553 + 554 + export const zDuplicateNameData = z.object({ 555 + body: z.optional(z.never()), 556 + path: z.optional(z.never()), 557 + query: z.optional(z.never()) 558 + }); 559 + 560 + export const zDuplicateName2Data = z.object({ 561 + body: z.optional(z.never()), 562 + path: z.optional(z.never()), 563 + query: z.optional(z.never()) 564 + }); 565 + 566 + export const zDuplicateName3Data = z.object({ 567 + body: z.optional(z.never()), 568 + path: z.optional(z.never()), 569 + query: z.optional(z.never()) 570 + }); 571 + 572 + export const zDuplicateName4Data = z.object({ 573 + body: z.optional(z.never()), 574 + path: z.optional(z.never()), 575 + query: z.optional(z.never()) 576 + }); 577 + 578 + export const zCallWithNoContentResponseData = z.object({ 579 + body: z.optional(z.never()), 580 + path: z.optional(z.never()), 581 + query: z.optional(z.never()) 582 + }); 583 + 584 + export const zCallWithResponseAndNoContentResponseData = z.object({ 585 + body: z.optional(z.never()), 586 + path: z.optional(z.never()), 587 + query: z.optional(z.never()) 588 + }); 589 + 590 + export const zCallWithResponseAndNoContentResponseResponse = z.union([ 591 + z.number(), 592 + z.unknown() 593 + ]); 594 + 595 + export const zDummyAData = z.object({ 596 + body: z.optional(z.never()), 597 + path: z.optional(z.never()), 598 + query: z.optional(z.never()) 599 + }); 600 + 601 + export const zDummyBData = z.object({ 602 + body: z.optional(z.never()), 603 + path: z.optional(z.never()), 604 + query: z.optional(z.never()) 605 + }); 606 + 607 + export const zCallWithResponseData = z.object({ 608 + body: z.optional(z.never()), 609 + path: z.optional(z.never()), 610 + query: z.optional(z.never()) 611 + }); 612 + 613 + /** 614 + * Message for default response 615 + */ 616 + export const zCallWithResponseResponse = zModelWithString; 617 + 618 + export const zCallWithDuplicateResponsesData = z.object({ 619 + body: z.optional(z.never()), 620 + path: z.optional(z.never()), 621 + query: z.optional(z.never()) 622 + }); 623 + 624 + /** 625 + * Message for 201 response 626 + */ 627 + export const zCallWithDuplicateResponsesResponse = zModelWithString; 628 + 629 + export const zCallWithResponsesData = z.object({ 630 + body: z.optional(z.never()), 631 + path: z.optional(z.never()), 632 + query: z.optional(z.never()) 633 + }); 634 + 635 + export const zCallWithResponsesResponse = z.union([ 636 + z.object({ 637 + '@namespace.string': z.optional(z.readonly(z.string())), 638 + '@namespace.integer': z.optional(z.readonly(z.int())), 639 + value: z.optional(z.readonly(z.array(zModelWithString))) 640 + }), 641 + zModelThatExtends, 642 + zModelThatExtendsExtends 643 + ]); 644 + 645 + export const zCollectionFormatData = z.object({ 646 + body: z.optional(z.never()), 647 + path: z.optional(z.never()), 648 + query: z.object({ 649 + parameterArrayCSV: z.array(z.string()), 650 + parameterArraySSV: z.array(z.string()), 651 + parameterArrayTSV: z.array(z.string()), 652 + parameterArrayPipes: z.array(z.string()), 653 + parameterArrayMulti: z.array(z.string()) 654 + }) 655 + }); 656 + 657 + export const zTypesData = z.object({ 658 + body: z.optional(z.never()), 659 + path: z.optional(z.object({ 660 + id: z.optional(z.int()) 661 + })), 662 + query: z.object({ 663 + parameterNumber: z._default(z.number(), 123), 664 + parameterString: z._default(z.string(), 'default'), 665 + parameterBoolean: z._default(z.boolean(), true), 666 + parameterArray: z.array(z.string()), 667 + parameterDictionary: z.object({}), 668 + parameterEnum: z.enum([ 669 + 'Success', 670 + 'Warning', 671 + 'Error' 672 + ]) 673 + }) 674 + }); 675 + 676 + export const zTypesResponse = z.union([ 677 + z.number(), 678 + z.string(), 679 + z.boolean(), 680 + z.object({}) 681 + ]); 682 + 683 + export const zComplexTypesData = z.object({ 684 + body: z.optional(z.never()), 685 + path: z.optional(z.never()), 686 + query: z.object({ 687 + parameterObject: z.object({ 688 + first: z.optional(z.object({ 689 + second: z.optional(z.object({ 690 + third: z.optional(z.string()) 691 + })) 692 + })) 693 + }), 694 + parameterReference: z.object({ 695 + prop: z.optional(z.string()) 696 + }) 697 + }) 698 + }); 699 + 700 + /** 701 + * Successful response 702 + */ 703 + export const zComplexTypesResponse = z.array(zModelWithString); 704 + 705 + export const zCallWithResultFromHeaderData = z.object({ 706 + body: z.optional(z.never()), 707 + path: z.optional(z.never()), 708 + query: z.optional(z.never()) 709 + }); 710 + 711 + export const zTestErrorCodeData = z.object({ 712 + body: z.optional(z.never()), 713 + path: z.optional(z.never()), 714 + query: z.object({ 715 + status: z.string() 716 + }) 717 + }); 718 + 719 + export const zNonAsciiæøåÆøÅöôêÊ字符串Data = z.object({ 720 + body: z.optional(z.never()), 721 + path: z.optional(z.never()), 722 + query: z.object({ 723 + 'nonAsciiParamæøåÆØÅöôêÊ': z.int() 724 + }) 725 + }); 726 + 727 + /** 728 + * Successful response 729 + */ 730 + export const zNonAsciiæøåÆøÅöôêÊ字符串Response = zNonAsciiStringæøåÆøÅöôêÊ字符串; 731 + 732 + export const zPostApiVbyApiVersionBodyData = z.object({ 733 + body: zParameterActivityParams, 734 + path: z.optional(z.never()), 735 + query: z.optional(z.never()) 736 + }); 737 + 738 + /** 739 + * OK 740 + */ 741 + export const zPostApiVbyApiVersionBodyResponse = zResponsePostActivityResponse;
+24
packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/mini/type-format-zod/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import * as z from 'zod/v4-mini'; 4 + 5 + export const zFoo = z.object({ 6 + bar: z.optional(z.int()), 7 + foo: z._default(z.coerce.bigint(), BigInt(0)), 8 + id: z.string() 9 + }); 10 + 11 + export const zBar = z.object({ 12 + foo: z.int() 13 + }); 14 + 15 + export const zPostFooData = z.object({ 16 + body: z.optional(z.never()), 17 + path: z.optional(z.never()), 18 + query: z.optional(z.never()) 19 + }); 20 + 21 + /** 22 + * OK 23 + */ 24 + export const zPostFooResponse = zFoo;
+741
packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/v3/default/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod'; 4 + 5 + /** 6 + * Testing multiline comments in string: First line 7 + * Second line 8 + * 9 + * Fourth line 10 + */ 11 + export const zCommentWithBreaks = z.number().int(); 12 + 13 + /** 14 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 15 + */ 16 + export const zCommentWithBackticks = z.number().int(); 17 + 18 + /** 19 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 20 + */ 21 + export const zCommentWithBackticksAndQuotes = z.number().int(); 22 + 23 + /** 24 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 25 + */ 26 + export const zCommentWithSlashes = z.number().int(); 27 + 28 + /** 29 + * Testing expression placeholders in string: ${expression} should work 30 + */ 31 + export const zCommentWithExpressionPlaceholders = z.number().int(); 32 + 33 + /** 34 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 35 + */ 36 + export const zCommentWithQuotes = z.number().int(); 37 + 38 + /** 39 + * Testing reserved characters in string: * inline * and ** inline ** should work 40 + */ 41 + export const zCommentWithReservedCharacters = z.number().int(); 42 + 43 + /** 44 + * This is a simple number 45 + */ 46 + export const zSimpleInteger = z.number().int(); 47 + 48 + /** 49 + * This is a simple boolean 50 + */ 51 + export const zSimpleBoolean = z.boolean(); 52 + 53 + /** 54 + * This is a simple string 55 + */ 56 + export const zSimpleString = z.string(); 57 + 58 + /** 59 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 60 + */ 61 + export const zNonAsciiStringæøåÆøÅöôêÊ字符串 = z.string(); 62 + 63 + /** 64 + * This is a simple file 65 + */ 66 + export const zSimpleFile = z.string(); 67 + 68 + /** 69 + * This is a model with one string property 70 + */ 71 + export const zModelWithString = z.object({ 72 + prop: z.string().optional() 73 + }); 74 + 75 + export const zSimpleReference = zModelWithString; 76 + 77 + /** 78 + * This is a simple string 79 + */ 80 + export const zSimpleStringWithPattern = z.string().max(64).regex(/^[a-zA-Z0-9_]*$/); 81 + 82 + /** 83 + * This is a simple enum with strings 84 + */ 85 + export const zEnumWithStrings = z.enum([ 86 + 'Success', 87 + 'Warning', 88 + 'Error', 89 + "'Single Quote'", 90 + '"Double Quotes"', 91 + 'Non-ascii: øæåôöØÆÅÔÖ字符串' 92 + ]); 93 + 94 + /** 95 + * This is a simple enum with numbers 96 + */ 97 + export const zEnumWithNumbers = z.unknown(); 98 + 99 + /** 100 + * Success=1,Warning=2,Error=3 101 + */ 102 + export const zEnumFromDescription = z.number(); 103 + 104 + /** 105 + * This is a simple enum with numbers 106 + */ 107 + export const zEnumWithExtensions = z.unknown(); 108 + 109 + /** 110 + * This is a simple array with numbers 111 + */ 112 + export const zArrayWithNumbers = z.array(z.number().int()); 113 + 114 + /** 115 + * This is a simple array with booleans 116 + */ 117 + export const zArrayWithBooleans = z.array(z.boolean()); 118 + 119 + /** 120 + * This is a simple array with strings 121 + */ 122 + export const zArrayWithStrings = z.array(z.string()); 123 + 124 + /** 125 + * This is a simple array with references 126 + */ 127 + export const zArrayWithReferences = z.array(zModelWithString); 128 + 129 + /** 130 + * This is a simple array containing an array 131 + */ 132 + export const zArrayWithArray = z.array(z.array(zModelWithString)); 133 + 134 + /** 135 + * This is a simple array with properties 136 + */ 137 + export const zArrayWithProperties = z.array(z.object({ 138 + foo: z.string().optional(), 139 + bar: z.string().optional() 140 + })); 141 + 142 + /** 143 + * This is a string dictionary 144 + */ 145 + export const zDictionaryWithString = z.object({}); 146 + 147 + /** 148 + * This is a string reference 149 + */ 150 + export const zDictionaryWithReference = z.object({}); 151 + 152 + /** 153 + * This is a complex dictionary 154 + */ 155 + export const zDictionaryWithArray = z.object({}); 156 + 157 + /** 158 + * This is a string dictionary 159 + */ 160 + export const zDictionaryWithDictionary = z.record(z.object({})); 161 + 162 + /** 163 + * This is a complex dictionary 164 + */ 165 + export const zDictionaryWithProperties = z.record(z.object({ 166 + foo: z.string().optional(), 167 + bar: z.string().optional() 168 + })); 169 + 170 + /** 171 + * This is a type-only model that defines Date as a string 172 + */ 173 + export const zDate = z.string(); 174 + 175 + /** 176 + * This is a model with one number property 177 + */ 178 + export const zModelWithInteger = z.object({ 179 + prop: z.number().int().optional() 180 + }); 181 + 182 + /** 183 + * This is a model with one boolean property 184 + */ 185 + export const zModelWithBoolean = z.object({ 186 + prop: z.boolean().optional() 187 + }); 188 + 189 + /** 190 + * This is a model with one string property 191 + */ 192 + export const zModelWithStringError = z.object({ 193 + prop: z.string().optional() 194 + }); 195 + 196 + /** 197 + * This is a model with one string property 198 + */ 199 + export const zModelWithNullableString = z.object({ 200 + nullableProp: z.union([ 201 + z.string(), 202 + z.null() 203 + ]).optional(), 204 + nullableRequiredProp: z.union([ 205 + z.string(), 206 + z.null() 207 + ]) 208 + }); 209 + 210 + /** 211 + * This is a model with one enum 212 + */ 213 + export const zModelWithEnum = z.object({ 214 + test: z.enum([ 215 + 'Success', 216 + 'Warning', 217 + 'Error', 218 + 'ØÆÅ字符串' 219 + ]).optional(), 220 + statusCode: z.enum([ 221 + '100', 222 + '200 FOO', 223 + '300 FOO_BAR', 224 + '400 foo-bar', 225 + '500 foo.bar', 226 + '600 foo&bar' 227 + ]).optional(), 228 + bool: z.unknown().optional() 229 + }); 230 + 231 + /** 232 + * This is a model with one enum 233 + */ 234 + export const zModelWithEnumFromDescription = z.object({ 235 + test: z.number().int().optional() 236 + }); 237 + 238 + /** 239 + * This is a model with nested enums 240 + */ 241 + export const zModelWithNestedEnums = z.object({ 242 + dictionaryWithEnum: z.object({}).optional(), 243 + dictionaryWithEnumFromDescription: z.object({}).optional(), 244 + arrayWithEnum: z.array(z.enum([ 245 + 'Success', 246 + 'Warning', 247 + 'Error' 248 + ])).optional(), 249 + arrayWithDescription: z.array(z.number().int()).optional() 250 + }); 251 + 252 + /** 253 + * This is a model with one nested property 254 + */ 255 + export const zModelWithProperties = z.object({ 256 + required: z.string(), 257 + requiredAndReadOnly: z.string().readonly(), 258 + string: z.string().optional(), 259 + number: z.number().optional(), 260 + boolean: z.boolean().optional(), 261 + reference: zModelWithString.optional(), 262 + 'property with space': z.string().optional(), 263 + default: z.string().optional(), 264 + try: z.string().optional(), 265 + '@namespace.string': z.string().readonly().optional(), 266 + '@namespace.integer': z.number().int().readonly().optional() 267 + }); 268 + 269 + /** 270 + * This is a model with one property containing a reference 271 + */ 272 + export const zModelWithReference = z.object({ 273 + prop: zModelWithProperties.optional() 274 + }); 275 + 276 + /** 277 + * This is a model with one property containing an array 278 + */ 279 + export const zModelWithArray = z.object({ 280 + prop: z.array(zModelWithString).optional(), 281 + propWithFile: z.array(z.string()).optional(), 282 + propWithNumber: z.array(z.number()).optional() 283 + }); 284 + 285 + /** 286 + * This is a model with one property containing a dictionary 287 + */ 288 + export const zModelWithDictionary = z.object({ 289 + prop: z.object({}).optional() 290 + }); 291 + 292 + /** 293 + * This is a model with one property containing a circular reference 294 + */ 295 + export const zModelWithCircularReference: z.AnyZodObject = z.object({ 296 + prop: z.lazy(() => { 297 + return zModelWithCircularReference; 298 + }).optional() 299 + }); 300 + 301 + /** 302 + * This is a model with one nested property 303 + */ 304 + export const zModelWithNestedProperties = z.object({ 305 + first: z.object({ 306 + second: z.object({ 307 + third: z.string().readonly() 308 + }).readonly() 309 + }).readonly() 310 + }); 311 + 312 + /** 313 + * This is a model with duplicated properties 314 + */ 315 + export const zModelWithDuplicateProperties = z.object({ 316 + prop: zModelWithString.optional() 317 + }); 318 + 319 + /** 320 + * This is a model with ordered properties 321 + */ 322 + export const zModelWithOrderedProperties = z.object({ 323 + zebra: z.string().optional(), 324 + apple: z.string().optional(), 325 + hawaii: z.string().optional() 326 + }); 327 + 328 + /** 329 + * This is a model with duplicated imports 330 + */ 331 + export const zModelWithDuplicateImports = z.object({ 332 + propA: zModelWithString.optional(), 333 + propB: zModelWithString.optional(), 334 + propC: zModelWithString.optional() 335 + }); 336 + 337 + /** 338 + * This is a model that extends another model 339 + */ 340 + export const zModelThatExtends = zModelWithString.and(z.object({ 341 + propExtendsA: z.string().optional(), 342 + propExtendsB: zModelWithString.optional() 343 + })); 344 + 345 + /** 346 + * This is a model that extends another model 347 + */ 348 + export const zModelThatExtendsExtends = zModelWithString.and(zModelThatExtends).and(z.object({ 349 + propExtendsC: z.string().optional(), 350 + propExtendsD: zModelWithString.optional() 351 + })); 352 + 353 + export const zDefault = z.object({ 354 + name: z.string().optional() 355 + }); 356 + 357 + /** 358 + * This is a model that contains a some patterns 359 + */ 360 + export const zModelWithPattern = z.object({ 361 + key: z.string().max(64).regex(/^[a-zA-Z0-9_]*$/), 362 + name: z.string().max(255), 363 + enabled: z.boolean().readonly().optional(), 364 + modified: z.string().datetime().readonly().optional(), 365 + id: z.string().regex(/^\d{2}-\d{3}-\d{4}$/).optional(), 366 + text: z.string().regex(/^\w+$/).optional(), 367 + patternWithSingleQuotes: z.string().regex(/^[a-zA-Z0-9']*$/).optional(), 368 + patternWithNewline: z.string().regex(/aaa\nbbb/).optional(), 369 + patternWithBacktick: z.string().regex(/aaa`bbb/).optional() 370 + }); 371 + 372 + export const zParameterActivityParams = z.object({ 373 + description: z.string().optional(), 374 + graduate_id: z.number().int().optional(), 375 + organization_id: z.number().int().optional(), 376 + parent_activity: z.number().int().optional(), 377 + post_id: z.number().int().optional() 378 + }); 379 + 380 + export const zResponsePostActivityResponse = z.object({ 381 + description: z.string().optional(), 382 + graduate_id: z.number().int().optional(), 383 + organization_id: z.number().int().optional(), 384 + parent_activity_id: z.number().int().optional(), 385 + post_id: z.number().int().optional() 386 + }); 387 + 388 + export const zFailureFailure = z.object({ 389 + error: z.string().optional(), 390 + message: z.string().optional(), 391 + reference_code: z.string().optional() 392 + }); 393 + 394 + export const zServiceWithEmptyTagData = z.object({ 395 + body: z.never().optional(), 396 + path: z.never().optional(), 397 + query: z.never().optional() 398 + }); 399 + 400 + export const zPatchApiVbyApiVersionNoTagData = z.object({ 401 + body: z.never().optional(), 402 + path: z.never().optional(), 403 + query: z.never().optional() 404 + }); 405 + 406 + export const zFooWowData = z.object({ 407 + body: z.never().optional(), 408 + path: z.never().optional(), 409 + query: z.never().optional() 410 + }); 411 + 412 + export const zDeleteCallWithoutParametersAndResponseData = z.object({ 413 + body: z.never().optional(), 414 + path: z.never().optional(), 415 + query: z.never().optional() 416 + }); 417 + 418 + export const zGetCallWithoutParametersAndResponseData = z.object({ 419 + body: z.never().optional(), 420 + path: z.never().optional(), 421 + query: z.never().optional() 422 + }); 423 + 424 + export const zHeadCallWithoutParametersAndResponseData = z.object({ 425 + body: z.never().optional(), 426 + path: z.never().optional(), 427 + query: z.never().optional() 428 + }); 429 + 430 + export const zOptionsCallWithoutParametersAndResponseData = z.object({ 431 + body: z.never().optional(), 432 + path: z.never().optional(), 433 + query: z.never().optional() 434 + }); 435 + 436 + export const zPatchCallWithoutParametersAndResponseData = z.object({ 437 + body: z.never().optional(), 438 + path: z.never().optional(), 439 + query: z.never().optional() 440 + }); 441 + 442 + export const zPostCallWithoutParametersAndResponseData = z.object({ 443 + body: z.never().optional(), 444 + path: z.never().optional(), 445 + query: z.never().optional() 446 + }); 447 + 448 + export const zPutCallWithoutParametersAndResponseData = z.object({ 449 + body: z.never().optional(), 450 + path: z.never().optional(), 451 + query: z.never().optional() 452 + }); 453 + 454 + export const zCallWithDescriptionsData = z.object({ 455 + body: z.never().optional(), 456 + path: z.never().optional(), 457 + query: z.object({ 458 + parameterWithBreaks: z.string().optional(), 459 + parameterWithBackticks: z.string().optional(), 460 + parameterWithSlashes: z.string().optional(), 461 + parameterWithExpressionPlaceholders: z.string().optional(), 462 + parameterWithQuotes: z.string().optional(), 463 + parameterWithReservedCharacters: z.string().optional() 464 + }).optional() 465 + }); 466 + 467 + export const zCallWithParametersData = z.object({ 468 + body: z.never().optional(), 469 + path: z.object({ 470 + parameterPath: z.string(), 471 + 'api-version': z.string() 472 + }), 473 + query: z.object({ 474 + parameterQuery: z.string() 475 + }), 476 + headers: z.object({ 477 + parameterHeader: z.string() 478 + }) 479 + }); 480 + 481 + export const zCallWithWeirdParameterNamesData = z.object({ 482 + body: z.never().optional(), 483 + path: z.object({ 484 + 'parameter.path.1': z.string().optional(), 485 + 'parameter-path-2': z.string().optional(), 486 + 'PARAMETER-PATH-3': z.string().optional(), 487 + 'api-version': z.string() 488 + }), 489 + query: z.object({ 490 + default: z.string().optional(), 491 + 'parameter-query': z.string() 492 + }), 493 + headers: z.object({ 494 + 'parameter.header': z.string() 495 + }) 496 + }); 497 + 498 + export const zCallWithDefaultParametersData = z.object({ 499 + body: z.never().optional(), 500 + path: z.never().optional(), 501 + query: z.object({ 502 + parameterString: z.string().default('Hello World!'), 503 + parameterNumber: z.number().default(123), 504 + parameterBoolean: z.boolean().default(true), 505 + parameterEnum: z.enum([ 506 + 'Success', 507 + 'Warning', 508 + 'Error' 509 + ]), 510 + parameterModel: z.object({ 511 + prop: z.string().optional() 512 + }).default({ 513 + prop: 'Hello World!' 514 + }) 515 + }) 516 + }); 517 + 518 + export const zCallWithDefaultOptionalParametersData = z.object({ 519 + body: z.never().optional(), 520 + path: z.never().optional(), 521 + query: z.object({ 522 + parameterString: z.string().optional().default('Hello World!'), 523 + parameterNumber: z.number().optional().default(123), 524 + parameterBoolean: z.boolean().optional().default(true), 525 + parameterEnum: z.enum([ 526 + 'Success', 527 + 'Warning', 528 + 'Error' 529 + ]).optional() 530 + }).optional() 531 + }); 532 + 533 + export const zCallToTestOrderOfParamsData = z.object({ 534 + body: z.never().optional(), 535 + path: z.never().optional(), 536 + query: z.object({ 537 + parameterOptionalStringWithDefault: z.string().optional().default('Hello World!'), 538 + parameterOptionalStringWithEmptyDefault: z.string().optional().default(''), 539 + parameterOptionalStringWithNoDefault: z.string().optional(), 540 + parameterStringWithDefault: z.string().default('Hello World!'), 541 + parameterStringWithEmptyDefault: z.string().default(''), 542 + parameterStringWithNoDefault: z.string(), 543 + parameterStringNullableWithNoDefault: z.union([ 544 + z.string(), 545 + z.null() 546 + ]).optional(), 547 + parameterStringNullableWithDefault: z.union([ 548 + z.string(), 549 + z.null() 550 + ]).optional().default(null) 551 + }) 552 + }); 553 + 554 + export const zDuplicateNameData = z.object({ 555 + body: z.never().optional(), 556 + path: z.never().optional(), 557 + query: z.never().optional() 558 + }); 559 + 560 + export const zDuplicateName2Data = z.object({ 561 + body: z.never().optional(), 562 + path: z.never().optional(), 563 + query: z.never().optional() 564 + }); 565 + 566 + export const zDuplicateName3Data = z.object({ 567 + body: z.never().optional(), 568 + path: z.never().optional(), 569 + query: z.never().optional() 570 + }); 571 + 572 + export const zDuplicateName4Data = z.object({ 573 + body: z.never().optional(), 574 + path: z.never().optional(), 575 + query: z.never().optional() 576 + }); 577 + 578 + export const zCallWithNoContentResponseData = z.object({ 579 + body: z.never().optional(), 580 + path: z.never().optional(), 581 + query: z.never().optional() 582 + }); 583 + 584 + export const zCallWithResponseAndNoContentResponseData = z.object({ 585 + body: z.never().optional(), 586 + path: z.never().optional(), 587 + query: z.never().optional() 588 + }); 589 + 590 + export const zCallWithResponseAndNoContentResponseResponse = z.union([ 591 + z.number(), 592 + z.unknown() 593 + ]); 594 + 595 + export const zDummyAData = z.object({ 596 + body: z.never().optional(), 597 + path: z.never().optional(), 598 + query: z.never().optional() 599 + }); 600 + 601 + export const zDummyBData = z.object({ 602 + body: z.never().optional(), 603 + path: z.never().optional(), 604 + query: z.never().optional() 605 + }); 606 + 607 + export const zCallWithResponseData = z.object({ 608 + body: z.never().optional(), 609 + path: z.never().optional(), 610 + query: z.never().optional() 611 + }); 612 + 613 + /** 614 + * Message for default response 615 + */ 616 + export const zCallWithResponseResponse = zModelWithString; 617 + 618 + export const zCallWithDuplicateResponsesData = z.object({ 619 + body: z.never().optional(), 620 + path: z.never().optional(), 621 + query: z.never().optional() 622 + }); 623 + 624 + /** 625 + * Message for 201 response 626 + */ 627 + export const zCallWithDuplicateResponsesResponse = zModelWithString; 628 + 629 + export const zCallWithResponsesData = z.object({ 630 + body: z.never().optional(), 631 + path: z.never().optional(), 632 + query: z.never().optional() 633 + }); 634 + 635 + export const zCallWithResponsesResponse = z.union([ 636 + z.object({ 637 + '@namespace.string': z.string().readonly().optional(), 638 + '@namespace.integer': z.number().int().readonly().optional(), 639 + value: z.array(zModelWithString).readonly().optional() 640 + }), 641 + zModelThatExtends, 642 + zModelThatExtendsExtends 643 + ]); 644 + 645 + export const zCollectionFormatData = z.object({ 646 + body: z.never().optional(), 647 + path: z.never().optional(), 648 + query: z.object({ 649 + parameterArrayCSV: z.array(z.string()), 650 + parameterArraySSV: z.array(z.string()), 651 + parameterArrayTSV: z.array(z.string()), 652 + parameterArrayPipes: z.array(z.string()), 653 + parameterArrayMulti: z.array(z.string()) 654 + }) 655 + }); 656 + 657 + export const zTypesData = z.object({ 658 + body: z.never().optional(), 659 + path: z.object({ 660 + id: z.number().int().optional() 661 + }).optional(), 662 + query: z.object({ 663 + parameterNumber: z.number().default(123), 664 + parameterString: z.string().default('default'), 665 + parameterBoolean: z.boolean().default(true), 666 + parameterArray: z.array(z.string()), 667 + parameterDictionary: z.object({}), 668 + parameterEnum: z.enum([ 669 + 'Success', 670 + 'Warning', 671 + 'Error' 672 + ]) 673 + }) 674 + }); 675 + 676 + export const zTypesResponse = z.union([ 677 + z.number(), 678 + z.string(), 679 + z.boolean(), 680 + z.object({}) 681 + ]); 682 + 683 + export const zComplexTypesData = z.object({ 684 + body: z.never().optional(), 685 + path: z.never().optional(), 686 + query: z.object({ 687 + parameterObject: z.object({ 688 + first: z.object({ 689 + second: z.object({ 690 + third: z.string().optional() 691 + }).optional() 692 + }).optional() 693 + }), 694 + parameterReference: z.object({ 695 + prop: z.string().optional() 696 + }) 697 + }) 698 + }); 699 + 700 + /** 701 + * Successful response 702 + */ 703 + export const zComplexTypesResponse = z.array(zModelWithString); 704 + 705 + export const zCallWithResultFromHeaderData = z.object({ 706 + body: z.never().optional(), 707 + path: z.never().optional(), 708 + query: z.never().optional() 709 + }); 710 + 711 + export const zTestErrorCodeData = z.object({ 712 + body: z.never().optional(), 713 + path: z.never().optional(), 714 + query: z.object({ 715 + status: z.string() 716 + }) 717 + }); 718 + 719 + export const zNonAsciiæøåÆøÅöôêÊ字符串Data = z.object({ 720 + body: z.never().optional(), 721 + path: z.never().optional(), 722 + query: z.object({ 723 + 'nonAsciiParamæøåÆØÅöôêÊ': z.number().int() 724 + }) 725 + }); 726 + 727 + /** 728 + * Successful response 729 + */ 730 + export const zNonAsciiæøåÆøÅöôêÊ字符串Response = zNonAsciiStringæøåÆøÅöôêÊ字符串; 731 + 732 + export const zPostApiVbyApiVersionBodyData = z.object({ 733 + body: zParameterActivityParams, 734 + path: z.never().optional(), 735 + query: z.never().optional() 736 + }); 737 + 738 + /** 739 + * OK 740 + */ 741 + export const zPostApiVbyApiVersionBodyResponse = zResponsePostActivityResponse;
+24
packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/v3/type-format-zod/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod'; 4 + 5 + export const zFoo = z.object({ 6 + bar: z.number().int().optional(), 7 + foo: z.coerce.bigint().default(BigInt(0)), 8 + id: z.string() 9 + }); 10 + 11 + export const zBar = z.object({ 12 + foo: z.number().int() 13 + }); 14 + 15 + export const zPostFooData = z.object({ 16 + body: z.never().optional(), 17 + path: z.never().optional(), 18 + query: z.never().optional() 19 + }); 20 + 21 + /** 22 + * OK 23 + */ 24 + export const zPostFooResponse = zFoo;
+741
packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/v4/default/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod/v4'; 4 + 5 + /** 6 + * Testing multiline comments in string: First line 7 + * Second line 8 + * 9 + * Fourth line 10 + */ 11 + export const zCommentWithBreaks = z.int(); 12 + 13 + /** 14 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 15 + */ 16 + export const zCommentWithBackticks = z.int(); 17 + 18 + /** 19 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 20 + */ 21 + export const zCommentWithBackticksAndQuotes = z.int(); 22 + 23 + /** 24 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 25 + */ 26 + export const zCommentWithSlashes = z.int(); 27 + 28 + /** 29 + * Testing expression placeholders in string: ${expression} should work 30 + */ 31 + export const zCommentWithExpressionPlaceholders = z.int(); 32 + 33 + /** 34 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 35 + */ 36 + export const zCommentWithQuotes = z.int(); 37 + 38 + /** 39 + * Testing reserved characters in string: * inline * and ** inline ** should work 40 + */ 41 + export const zCommentWithReservedCharacters = z.int(); 42 + 43 + /** 44 + * This is a simple number 45 + */ 46 + export const zSimpleInteger = z.int(); 47 + 48 + /** 49 + * This is a simple boolean 50 + */ 51 + export const zSimpleBoolean = z.boolean(); 52 + 53 + /** 54 + * This is a simple string 55 + */ 56 + export const zSimpleString = z.string(); 57 + 58 + /** 59 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 60 + */ 61 + export const zNonAsciiStringæøåÆøÅöôêÊ字符串 = z.string(); 62 + 63 + /** 64 + * This is a simple file 65 + */ 66 + export const zSimpleFile = z.string(); 67 + 68 + /** 69 + * This is a model with one string property 70 + */ 71 + export const zModelWithString = z.object({ 72 + prop: z.optional(z.string()) 73 + }); 74 + 75 + export const zSimpleReference = zModelWithString; 76 + 77 + /** 78 + * This is a simple string 79 + */ 80 + export const zSimpleStringWithPattern = z.string().max(64).regex(/^[a-zA-Z0-9_]*$/); 81 + 82 + /** 83 + * This is a simple enum with strings 84 + */ 85 + export const zEnumWithStrings = z.enum([ 86 + 'Success', 87 + 'Warning', 88 + 'Error', 89 + "'Single Quote'", 90 + '"Double Quotes"', 91 + 'Non-ascii: øæåôöØÆÅÔÖ字符串' 92 + ]); 93 + 94 + /** 95 + * This is a simple enum with numbers 96 + */ 97 + export const zEnumWithNumbers = z.unknown(); 98 + 99 + /** 100 + * Success=1,Warning=2,Error=3 101 + */ 102 + export const zEnumFromDescription = z.number(); 103 + 104 + /** 105 + * This is a simple enum with numbers 106 + */ 107 + export const zEnumWithExtensions = z.unknown(); 108 + 109 + /** 110 + * This is a simple array with numbers 111 + */ 112 + export const zArrayWithNumbers = z.array(z.int()); 113 + 114 + /** 115 + * This is a simple array with booleans 116 + */ 117 + export const zArrayWithBooleans = z.array(z.boolean()); 118 + 119 + /** 120 + * This is a simple array with strings 121 + */ 122 + export const zArrayWithStrings = z.array(z.string()); 123 + 124 + /** 125 + * This is a simple array with references 126 + */ 127 + export const zArrayWithReferences = z.array(zModelWithString); 128 + 129 + /** 130 + * This is a simple array containing an array 131 + */ 132 + export const zArrayWithArray = z.array(z.array(zModelWithString)); 133 + 134 + /** 135 + * This is a simple array with properties 136 + */ 137 + export const zArrayWithProperties = z.array(z.object({ 138 + foo: z.optional(z.string()), 139 + bar: z.optional(z.string()) 140 + })); 141 + 142 + /** 143 + * This is a string dictionary 144 + */ 145 + export const zDictionaryWithString = z.object({}); 146 + 147 + /** 148 + * This is a string reference 149 + */ 150 + export const zDictionaryWithReference = z.object({}); 151 + 152 + /** 153 + * This is a complex dictionary 154 + */ 155 + export const zDictionaryWithArray = z.object({}); 156 + 157 + /** 158 + * This is a string dictionary 159 + */ 160 + export const zDictionaryWithDictionary = z.record(z.string(), z.object({})); 161 + 162 + /** 163 + * This is a complex dictionary 164 + */ 165 + export const zDictionaryWithProperties = z.record(z.string(), z.object({ 166 + foo: z.optional(z.string()), 167 + bar: z.optional(z.string()) 168 + })); 169 + 170 + /** 171 + * This is a type-only model that defines Date as a string 172 + */ 173 + export const zDate = z.string(); 174 + 175 + /** 176 + * This is a model with one number property 177 + */ 178 + export const zModelWithInteger = z.object({ 179 + prop: z.optional(z.int()) 180 + }); 181 + 182 + /** 183 + * This is a model with one boolean property 184 + */ 185 + export const zModelWithBoolean = z.object({ 186 + prop: z.optional(z.boolean()) 187 + }); 188 + 189 + /** 190 + * This is a model with one string property 191 + */ 192 + export const zModelWithStringError = z.object({ 193 + prop: z.optional(z.string()) 194 + }); 195 + 196 + /** 197 + * This is a model with one string property 198 + */ 199 + export const zModelWithNullableString = z.object({ 200 + nullableProp: z.optional(z.union([ 201 + z.string(), 202 + z.null() 203 + ])), 204 + nullableRequiredProp: z.union([ 205 + z.string(), 206 + z.null() 207 + ]) 208 + }); 209 + 210 + /** 211 + * This is a model with one enum 212 + */ 213 + export const zModelWithEnum = z.object({ 214 + test: z.optional(z.enum([ 215 + 'Success', 216 + 'Warning', 217 + 'Error', 218 + 'ØÆÅ字符串' 219 + ])), 220 + statusCode: z.optional(z.enum([ 221 + '100', 222 + '200 FOO', 223 + '300 FOO_BAR', 224 + '400 foo-bar', 225 + '500 foo.bar', 226 + '600 foo&bar' 227 + ])), 228 + bool: z.optional(z.unknown()) 229 + }); 230 + 231 + /** 232 + * This is a model with one enum 233 + */ 234 + export const zModelWithEnumFromDescription = z.object({ 235 + test: z.optional(z.int()) 236 + }); 237 + 238 + /** 239 + * This is a model with nested enums 240 + */ 241 + export const zModelWithNestedEnums = z.object({ 242 + dictionaryWithEnum: z.optional(z.object({})), 243 + dictionaryWithEnumFromDescription: z.optional(z.object({})), 244 + arrayWithEnum: z.optional(z.array(z.enum([ 245 + 'Success', 246 + 'Warning', 247 + 'Error' 248 + ]))), 249 + arrayWithDescription: z.optional(z.array(z.int())) 250 + }); 251 + 252 + /** 253 + * This is a model with one nested property 254 + */ 255 + export const zModelWithProperties = z.object({ 256 + required: z.string(), 257 + requiredAndReadOnly: z.string().readonly(), 258 + string: z.optional(z.string()), 259 + number: z.optional(z.number()), 260 + boolean: z.optional(z.boolean()), 261 + reference: z.optional(zModelWithString), 262 + 'property with space': z.optional(z.string()), 263 + default: z.optional(z.string()), 264 + try: z.optional(z.string()), 265 + '@namespace.string': z.optional(z.string().readonly()), 266 + '@namespace.integer': z.optional(z.int().readonly()) 267 + }); 268 + 269 + /** 270 + * This is a model with one property containing a reference 271 + */ 272 + export const zModelWithReference = z.object({ 273 + prop: z.optional(zModelWithProperties) 274 + }); 275 + 276 + /** 277 + * This is a model with one property containing an array 278 + */ 279 + export const zModelWithArray = z.object({ 280 + prop: z.optional(z.array(zModelWithString)), 281 + propWithFile: z.optional(z.array(z.string())), 282 + propWithNumber: z.optional(z.array(z.number())) 283 + }); 284 + 285 + /** 286 + * This is a model with one property containing a dictionary 287 + */ 288 + export const zModelWithDictionary = z.object({ 289 + prop: z.optional(z.object({})) 290 + }); 291 + 292 + /** 293 + * This is a model with one property containing a circular reference 294 + */ 295 + export const zModelWithCircularReference = z.object({ 296 + prop: z.optional(z.lazy(() => { 297 + return zModelWithCircularReference; 298 + })) 299 + }); 300 + 301 + /** 302 + * This is a model with one nested property 303 + */ 304 + export const zModelWithNestedProperties = z.object({ 305 + first: z.object({ 306 + second: z.object({ 307 + third: z.string().readonly() 308 + }).readonly() 309 + }).readonly() 310 + }); 311 + 312 + /** 313 + * This is a model with duplicated properties 314 + */ 315 + export const zModelWithDuplicateProperties = z.object({ 316 + prop: z.optional(zModelWithString) 317 + }); 318 + 319 + /** 320 + * This is a model with ordered properties 321 + */ 322 + export const zModelWithOrderedProperties = z.object({ 323 + zebra: z.optional(z.string()), 324 + apple: z.optional(z.string()), 325 + hawaii: z.optional(z.string()) 326 + }); 327 + 328 + /** 329 + * This is a model with duplicated imports 330 + */ 331 + export const zModelWithDuplicateImports = z.object({ 332 + propA: z.optional(zModelWithString), 333 + propB: z.optional(zModelWithString), 334 + propC: z.optional(zModelWithString) 335 + }); 336 + 337 + /** 338 + * This is a model that extends another model 339 + */ 340 + export const zModelThatExtends = zModelWithString.and(z.object({ 341 + propExtendsA: z.optional(z.string()), 342 + propExtendsB: z.optional(zModelWithString) 343 + })); 344 + 345 + /** 346 + * This is a model that extends another model 347 + */ 348 + export const zModelThatExtendsExtends = zModelWithString.and(zModelThatExtends).and(z.object({ 349 + propExtendsC: z.optional(z.string()), 350 + propExtendsD: z.optional(zModelWithString) 351 + })); 352 + 353 + export const zDefault = z.object({ 354 + name: z.optional(z.string()) 355 + }); 356 + 357 + /** 358 + * This is a model that contains a some patterns 359 + */ 360 + export const zModelWithPattern = z.object({ 361 + key: z.string().max(64).regex(/^[a-zA-Z0-9_]*$/), 362 + name: z.string().max(255), 363 + enabled: z.optional(z.boolean().readonly()), 364 + modified: z.optional(z.iso.datetime().readonly()), 365 + id: z.optional(z.string().regex(/^\d{2}-\d{3}-\d{4}$/)), 366 + text: z.optional(z.string().regex(/^\w+$/)), 367 + patternWithSingleQuotes: z.optional(z.string().regex(/^[a-zA-Z0-9']*$/)), 368 + patternWithNewline: z.optional(z.string().regex(/aaa\nbbb/)), 369 + patternWithBacktick: z.optional(z.string().regex(/aaa`bbb/)) 370 + }); 371 + 372 + export const zParameterActivityParams = z.object({ 373 + description: z.optional(z.string()), 374 + graduate_id: z.optional(z.int()), 375 + organization_id: z.optional(z.int()), 376 + parent_activity: z.optional(z.int()), 377 + post_id: z.optional(z.int()) 378 + }); 379 + 380 + export const zResponsePostActivityResponse = z.object({ 381 + description: z.optional(z.string()), 382 + graduate_id: z.optional(z.int()), 383 + organization_id: z.optional(z.int()), 384 + parent_activity_id: z.optional(z.int()), 385 + post_id: z.optional(z.int()) 386 + }); 387 + 388 + export const zFailureFailure = z.object({ 389 + error: z.optional(z.string()), 390 + message: z.optional(z.string()), 391 + reference_code: z.optional(z.string()) 392 + }); 393 + 394 + export const zServiceWithEmptyTagData = z.object({ 395 + body: z.optional(z.never()), 396 + path: z.optional(z.never()), 397 + query: z.optional(z.never()) 398 + }); 399 + 400 + export const zPatchApiVbyApiVersionNoTagData = z.object({ 401 + body: z.optional(z.never()), 402 + path: z.optional(z.never()), 403 + query: z.optional(z.never()) 404 + }); 405 + 406 + export const zFooWowData = z.object({ 407 + body: z.optional(z.never()), 408 + path: z.optional(z.never()), 409 + query: z.optional(z.never()) 410 + }); 411 + 412 + export const zDeleteCallWithoutParametersAndResponseData = z.object({ 413 + body: z.optional(z.never()), 414 + path: z.optional(z.never()), 415 + query: z.optional(z.never()) 416 + }); 417 + 418 + export const zGetCallWithoutParametersAndResponseData = z.object({ 419 + body: z.optional(z.never()), 420 + path: z.optional(z.never()), 421 + query: z.optional(z.never()) 422 + }); 423 + 424 + export const zHeadCallWithoutParametersAndResponseData = z.object({ 425 + body: z.optional(z.never()), 426 + path: z.optional(z.never()), 427 + query: z.optional(z.never()) 428 + }); 429 + 430 + export const zOptionsCallWithoutParametersAndResponseData = z.object({ 431 + body: z.optional(z.never()), 432 + path: z.optional(z.never()), 433 + query: z.optional(z.never()) 434 + }); 435 + 436 + export const zPatchCallWithoutParametersAndResponseData = z.object({ 437 + body: z.optional(z.never()), 438 + path: z.optional(z.never()), 439 + query: z.optional(z.never()) 440 + }); 441 + 442 + export const zPostCallWithoutParametersAndResponseData = z.object({ 443 + body: z.optional(z.never()), 444 + path: z.optional(z.never()), 445 + query: z.optional(z.never()) 446 + }); 447 + 448 + export const zPutCallWithoutParametersAndResponseData = z.object({ 449 + body: z.optional(z.never()), 450 + path: z.optional(z.never()), 451 + query: z.optional(z.never()) 452 + }); 453 + 454 + export const zCallWithDescriptionsData = z.object({ 455 + body: z.optional(z.never()), 456 + path: z.optional(z.never()), 457 + query: z.optional(z.object({ 458 + parameterWithBreaks: z.optional(z.string()), 459 + parameterWithBackticks: z.optional(z.string()), 460 + parameterWithSlashes: z.optional(z.string()), 461 + parameterWithExpressionPlaceholders: z.optional(z.string()), 462 + parameterWithQuotes: z.optional(z.string()), 463 + parameterWithReservedCharacters: z.optional(z.string()) 464 + })) 465 + }); 466 + 467 + export const zCallWithParametersData = z.object({ 468 + body: z.optional(z.never()), 469 + path: z.object({ 470 + parameterPath: z.string(), 471 + 'api-version': z.string() 472 + }), 473 + query: z.object({ 474 + parameterQuery: z.string() 475 + }), 476 + headers: z.object({ 477 + parameterHeader: z.string() 478 + }) 479 + }); 480 + 481 + export const zCallWithWeirdParameterNamesData = z.object({ 482 + body: z.optional(z.never()), 483 + path: z.object({ 484 + 'parameter.path.1': z.optional(z.string()), 485 + 'parameter-path-2': z.optional(z.string()), 486 + 'PARAMETER-PATH-3': z.optional(z.string()), 487 + 'api-version': z.string() 488 + }), 489 + query: z.object({ 490 + default: z.optional(z.string()), 491 + 'parameter-query': z.string() 492 + }), 493 + headers: z.object({ 494 + 'parameter.header': z.string() 495 + }) 496 + }); 497 + 498 + export const zCallWithDefaultParametersData = z.object({ 499 + body: z.optional(z.never()), 500 + path: z.optional(z.never()), 501 + query: z.object({ 502 + parameterString: z.string().default('Hello World!'), 503 + parameterNumber: z.number().default(123), 504 + parameterBoolean: z.boolean().default(true), 505 + parameterEnum: z.enum([ 506 + 'Success', 507 + 'Warning', 508 + 'Error' 509 + ]), 510 + parameterModel: z.object({ 511 + prop: z.optional(z.string()) 512 + }).default({ 513 + prop: 'Hello World!' 514 + }) 515 + }) 516 + }); 517 + 518 + export const zCallWithDefaultOptionalParametersData = z.object({ 519 + body: z.optional(z.never()), 520 + path: z.optional(z.never()), 521 + query: z.optional(z.object({ 522 + parameterString: z.optional(z.string()).default('Hello World!'), 523 + parameterNumber: z.optional(z.number()).default(123), 524 + parameterBoolean: z.optional(z.boolean()).default(true), 525 + parameterEnum: z.optional(z.enum([ 526 + 'Success', 527 + 'Warning', 528 + 'Error' 529 + ])) 530 + })) 531 + }); 532 + 533 + export const zCallToTestOrderOfParamsData = z.object({ 534 + body: z.optional(z.never()), 535 + path: z.optional(z.never()), 536 + query: z.object({ 537 + parameterOptionalStringWithDefault: z.optional(z.string()).default('Hello World!'), 538 + parameterOptionalStringWithEmptyDefault: z.optional(z.string()).default(''), 539 + parameterOptionalStringWithNoDefault: z.optional(z.string()), 540 + parameterStringWithDefault: z.string().default('Hello World!'), 541 + parameterStringWithEmptyDefault: z.string().default(''), 542 + parameterStringWithNoDefault: z.string(), 543 + parameterStringNullableWithNoDefault: z.optional(z.union([ 544 + z.string(), 545 + z.null() 546 + ])), 547 + parameterStringNullableWithDefault: z.optional(z.union([ 548 + z.string(), 549 + z.null() 550 + ])).default(null) 551 + }) 552 + }); 553 + 554 + export const zDuplicateNameData = z.object({ 555 + body: z.optional(z.never()), 556 + path: z.optional(z.never()), 557 + query: z.optional(z.never()) 558 + }); 559 + 560 + export const zDuplicateName2Data = z.object({ 561 + body: z.optional(z.never()), 562 + path: z.optional(z.never()), 563 + query: z.optional(z.never()) 564 + }); 565 + 566 + export const zDuplicateName3Data = z.object({ 567 + body: z.optional(z.never()), 568 + path: z.optional(z.never()), 569 + query: z.optional(z.never()) 570 + }); 571 + 572 + export const zDuplicateName4Data = z.object({ 573 + body: z.optional(z.never()), 574 + path: z.optional(z.never()), 575 + query: z.optional(z.never()) 576 + }); 577 + 578 + export const zCallWithNoContentResponseData = z.object({ 579 + body: z.optional(z.never()), 580 + path: z.optional(z.never()), 581 + query: z.optional(z.never()) 582 + }); 583 + 584 + export const zCallWithResponseAndNoContentResponseData = z.object({ 585 + body: z.optional(z.never()), 586 + path: z.optional(z.never()), 587 + query: z.optional(z.never()) 588 + }); 589 + 590 + export const zCallWithResponseAndNoContentResponseResponse = z.union([ 591 + z.number(), 592 + z.unknown() 593 + ]); 594 + 595 + export const zDummyAData = z.object({ 596 + body: z.optional(z.never()), 597 + path: z.optional(z.never()), 598 + query: z.optional(z.never()) 599 + }); 600 + 601 + export const zDummyBData = z.object({ 602 + body: z.optional(z.never()), 603 + path: z.optional(z.never()), 604 + query: z.optional(z.never()) 605 + }); 606 + 607 + export const zCallWithResponseData = z.object({ 608 + body: z.optional(z.never()), 609 + path: z.optional(z.never()), 610 + query: z.optional(z.never()) 611 + }); 612 + 613 + /** 614 + * Message for default response 615 + */ 616 + export const zCallWithResponseResponse = zModelWithString; 617 + 618 + export const zCallWithDuplicateResponsesData = z.object({ 619 + body: z.optional(z.never()), 620 + path: z.optional(z.never()), 621 + query: z.optional(z.never()) 622 + }); 623 + 624 + /** 625 + * Message for 201 response 626 + */ 627 + export const zCallWithDuplicateResponsesResponse = zModelWithString; 628 + 629 + export const zCallWithResponsesData = z.object({ 630 + body: z.optional(z.never()), 631 + path: z.optional(z.never()), 632 + query: z.optional(z.never()) 633 + }); 634 + 635 + export const zCallWithResponsesResponse = z.union([ 636 + z.object({ 637 + '@namespace.string': z.optional(z.string().readonly()), 638 + '@namespace.integer': z.optional(z.int().readonly()), 639 + value: z.optional(z.array(zModelWithString).readonly()) 640 + }), 641 + zModelThatExtends, 642 + zModelThatExtendsExtends 643 + ]); 644 + 645 + export const zCollectionFormatData = z.object({ 646 + body: z.optional(z.never()), 647 + path: z.optional(z.never()), 648 + query: z.object({ 649 + parameterArrayCSV: z.array(z.string()), 650 + parameterArraySSV: z.array(z.string()), 651 + parameterArrayTSV: z.array(z.string()), 652 + parameterArrayPipes: z.array(z.string()), 653 + parameterArrayMulti: z.array(z.string()) 654 + }) 655 + }); 656 + 657 + export const zTypesData = z.object({ 658 + body: z.optional(z.never()), 659 + path: z.optional(z.object({ 660 + id: z.optional(z.int()) 661 + })), 662 + query: z.object({ 663 + parameterNumber: z.number().default(123), 664 + parameterString: z.string().default('default'), 665 + parameterBoolean: z.boolean().default(true), 666 + parameterArray: z.array(z.string()), 667 + parameterDictionary: z.object({}), 668 + parameterEnum: z.enum([ 669 + 'Success', 670 + 'Warning', 671 + 'Error' 672 + ]) 673 + }) 674 + }); 675 + 676 + export const zTypesResponse = z.union([ 677 + z.number(), 678 + z.string(), 679 + z.boolean(), 680 + z.object({}) 681 + ]); 682 + 683 + export const zComplexTypesData = z.object({ 684 + body: z.optional(z.never()), 685 + path: z.optional(z.never()), 686 + query: z.object({ 687 + parameterObject: z.object({ 688 + first: z.optional(z.object({ 689 + second: z.optional(z.object({ 690 + third: z.optional(z.string()) 691 + })) 692 + })) 693 + }), 694 + parameterReference: z.object({ 695 + prop: z.optional(z.string()) 696 + }) 697 + }) 698 + }); 699 + 700 + /** 701 + * Successful response 702 + */ 703 + export const zComplexTypesResponse = z.array(zModelWithString); 704 + 705 + export const zCallWithResultFromHeaderData = z.object({ 706 + body: z.optional(z.never()), 707 + path: z.optional(z.never()), 708 + query: z.optional(z.never()) 709 + }); 710 + 711 + export const zTestErrorCodeData = z.object({ 712 + body: z.optional(z.never()), 713 + path: z.optional(z.never()), 714 + query: z.object({ 715 + status: z.string() 716 + }) 717 + }); 718 + 719 + export const zNonAsciiæøåÆøÅöôêÊ字符串Data = z.object({ 720 + body: z.optional(z.never()), 721 + path: z.optional(z.never()), 722 + query: z.object({ 723 + 'nonAsciiParamæøåÆØÅöôêÊ': z.int() 724 + }) 725 + }); 726 + 727 + /** 728 + * Successful response 729 + */ 730 + export const zNonAsciiæøåÆøÅöôêÊ字符串Response = zNonAsciiStringæøåÆøÅöôêÊ字符串; 731 + 732 + export const zPostApiVbyApiVersionBodyData = z.object({ 733 + body: zParameterActivityParams, 734 + path: z.optional(z.never()), 735 + query: z.optional(z.never()) 736 + }); 737 + 738 + /** 739 + * OK 740 + */ 741 + export const zPostApiVbyApiVersionBodyResponse = zResponsePostActivityResponse;
+24
packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/v4/type-format-zod/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod/v4'; 4 + 5 + export const zFoo = z.object({ 6 + bar: z.optional(z.int()), 7 + foo: z.coerce.bigint().default(BigInt(0)), 8 + id: z.string() 9 + }); 10 + 11 + export const zBar = z.object({ 12 + foo: z.int() 13 + }); 14 + 15 + export const zPostFooData = z.object({ 16 + body: z.optional(z.never()), 17 + path: z.optional(z.never()), 18 + query: z.optional(z.never()) 19 + }); 20 + 21 + /** 22 + * OK 23 + */ 24 + export const zPostFooResponse = zFoo;
+9
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/array-items-one-of-length-1/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import * as z from 'zod/v4-mini'; 4 + 5 + export const zBar = z.string(); 6 + 7 + export const zFoo = z.object({ 8 + foo: z.optional(z.array(zBar).min(1).max(2147483647)) 9 + });
+1984
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/default/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import * as z from 'zod/v4-mini'; 4 + 5 + /** 6 + * Model with number-only name 7 + */ 8 + export const z400 = z.string(); 9 + 10 + /** 11 + * Testing multiline comments in string: First line 12 + * Second line 13 + * 14 + * Fourth line 15 + */ 16 + export const zCamelCaseCommentWithBreaks = z.int(); 17 + 18 + /** 19 + * Testing multiline comments in string: First line 20 + * Second line 21 + * 22 + * Fourth line 23 + */ 24 + export const zCommentWithBreaks = z.int(); 25 + 26 + /** 27 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 28 + */ 29 + export const zCommentWithBackticks = z.int(); 30 + 31 + /** 32 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 33 + */ 34 + export const zCommentWithBackticksAndQuotes = z.int(); 35 + 36 + /** 37 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 38 + */ 39 + export const zCommentWithSlashes = z.int(); 40 + 41 + /** 42 + * Testing expression placeholders in string: ${expression} should work 43 + */ 44 + export const zCommentWithExpressionPlaceholders = z.int(); 45 + 46 + /** 47 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 48 + */ 49 + export const zCommentWithQuotes = z.int(); 50 + 51 + /** 52 + * Testing reserved characters in string: * inline * and ** inline ** should work 53 + */ 54 + export const zCommentWithReservedCharacters = z.int(); 55 + 56 + /** 57 + * This is a simple number 58 + */ 59 + export const zSimpleInteger = z.int(); 60 + 61 + /** 62 + * This is a simple boolean 63 + */ 64 + export const zSimpleBoolean = z.boolean(); 65 + 66 + /** 67 + * This is a simple string 68 + */ 69 + export const zSimpleString = z.string(); 70 + 71 + /** 72 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 73 + */ 74 + export const zNonAsciiStringæøåÆøÅöôêÊ字符串 = z.string(); 75 + 76 + /** 77 + * This is a simple file 78 + */ 79 + export const zSimpleFile = z.string(); 80 + 81 + /** 82 + * This is a model with one string property 83 + */ 84 + export const zModelWithString = z.object({ 85 + prop: z.optional(z.string()) 86 + }); 87 + 88 + /** 89 + * This is a simple reference 90 + */ 91 + export const zSimpleReference = zModelWithString; 92 + 93 + /** 94 + * This is a simple string 95 + */ 96 + export const zSimpleStringWithPattern = z.union([ 97 + z.string().check(z.maxLength(64), z.regex(/^[a-zA-Z0-9_]*$/)), 98 + z.null() 99 + ]); 100 + 101 + /** 102 + * This is a simple enum with strings 103 + */ 104 + export const zEnumWithStrings = z.enum([ 105 + 'Success', 106 + 'Warning', 107 + 'Error', 108 + "'Single Quote'", 109 + '"Double Quotes"', 110 + 'Non-ascii: øæåôöØÆÅÔÖ字符串' 111 + ]); 112 + 113 + export const zEnumWithReplacedCharacters = z.enum([ 114 + "'Single Quote'", 115 + '"Double Quotes"', 116 + 'øæåôöØÆÅÔÖ字符串', 117 + '' 118 + ]); 119 + 120 + /** 121 + * This is a simple enum with numbers 122 + */ 123 + export const zEnumWithNumbers = z.unknown(); 124 + 125 + /** 126 + * Success=1,Warning=2,Error=3 127 + */ 128 + export const zEnumFromDescription = z.number(); 129 + 130 + /** 131 + * This is a simple enum with numbers 132 + */ 133 + export const zEnumWithExtensions = z.unknown(); 134 + 135 + export const zEnumWithXEnumNames = z.unknown(); 136 + 137 + /** 138 + * This is a simple array with numbers 139 + */ 140 + export const zArrayWithNumbers = z.array(z.int()); 141 + 142 + /** 143 + * This is a simple array with booleans 144 + */ 145 + export const zArrayWithBooleans = z.array(z.boolean()); 146 + 147 + /** 148 + * This is a simple array with strings 149 + */ 150 + export const zArrayWithStrings = z._default(z.array(z.string()), ['test']); 151 + 152 + /** 153 + * This is a simple array with references 154 + */ 155 + export const zArrayWithReferences = z.array(zModelWithString); 156 + 157 + /** 158 + * This is a simple array containing an array 159 + */ 160 + export const zArrayWithArray = z.array(z.array(zModelWithString)); 161 + 162 + /** 163 + * This is a simple array with properties 164 + */ 165 + export const zArrayWithProperties = z.array(z.object({ 166 + '16x16': z.optional(zCamelCaseCommentWithBreaks), 167 + bar: z.optional(z.string()) 168 + })); 169 + 170 + /** 171 + * This is a simple array with any of properties 172 + */ 173 + export const zArrayWithAnyOfProperties = z.array(z.union([ 174 + z.object({ 175 + foo: z._default(z.optional(z.string()), 'test') 176 + }), 177 + z.object({ 178 + bar: z.optional(z.string()) 179 + }) 180 + ])); 181 + 182 + export const zAnyOfAnyAndNull = z.object({ 183 + data: z.optional(z.unknown()) 184 + }); 185 + 186 + /** 187 + * This is a simple array with any of properties 188 + */ 189 + export const zAnyOfArrays = z.object({ 190 + results: z.optional(z.array(z.union([ 191 + z.object({ 192 + foo: z.optional(z.string()) 193 + }), 194 + z.object({ 195 + bar: z.optional(z.string()) 196 + }) 197 + ]))) 198 + }); 199 + 200 + /** 201 + * This is a string dictionary 202 + */ 203 + export const zDictionaryWithString = z.object({}); 204 + 205 + export const zDictionaryWithPropertiesAndAdditionalProperties = z.object({ 206 + foo: z.optional(z.number()), 207 + bar: z.optional(z.boolean()) 208 + }); 209 + 210 + /** 211 + * This is a string reference 212 + */ 213 + export const zDictionaryWithReference = z.object({}); 214 + 215 + /** 216 + * This is a complex dictionary 217 + */ 218 + export const zDictionaryWithArray = z.object({}); 219 + 220 + /** 221 + * This is a string dictionary 222 + */ 223 + export const zDictionaryWithDictionary = z.record(z.string(), z.object({})); 224 + 225 + /** 226 + * This is a complex dictionary 227 + */ 228 + export const zDictionaryWithProperties = z.record(z.string(), z.object({ 229 + foo: z.optional(z.string()), 230 + bar: z.optional(z.string()) 231 + })); 232 + 233 + /** 234 + * This is a model with one number property 235 + */ 236 + export const zModelWithInteger = z.object({ 237 + prop: z.optional(z.int()) 238 + }); 239 + 240 + /** 241 + * This is a model with one boolean property 242 + */ 243 + export const zModelWithBoolean = z.object({ 244 + prop: z.optional(z.boolean()) 245 + }); 246 + 247 + /** 248 + * This is a model with one string property 249 + */ 250 + export const zModelWithStringError = z.object({ 251 + prop: z.optional(z.string()) 252 + }); 253 + 254 + /** 255 + * `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) 256 + */ 257 + export const zModelFromZendesk = z.string(); 258 + 259 + /** 260 + * This is a model with one string property 261 + */ 262 + export const zModelWithNullableString = z.object({ 263 + nullableProp1: z.optional(z.union([ 264 + z.string(), 265 + z.null() 266 + ])), 267 + nullableRequiredProp1: z.union([ 268 + z.string(), 269 + z.null() 270 + ]), 271 + nullableProp2: z.optional(z.union([ 272 + z.string(), 273 + z.null() 274 + ])), 275 + nullableRequiredProp2: z.union([ 276 + z.string(), 277 + z.null() 278 + ]), 279 + 'foo_bar-enum': z.optional(z.enum([ 280 + 'Success', 281 + 'Warning', 282 + 'Error', 283 + 'ØÆÅ字符串' 284 + ])) 285 + }); 286 + 287 + /** 288 + * This is a model with one enum 289 + */ 290 + export const zModelWithEnum = z.object({ 291 + 'foo_bar-enum': z.optional(z.enum([ 292 + 'Success', 293 + 'Warning', 294 + 'Error', 295 + 'ØÆÅ字符串' 296 + ])), 297 + statusCode: z.optional(z.enum([ 298 + '100', 299 + '200 FOO', 300 + '300 FOO_BAR', 301 + '400 foo-bar', 302 + '500 foo.bar', 303 + '600 foo&bar' 304 + ])), 305 + bool: z.optional(z.unknown()) 306 + }); 307 + 308 + /** 309 + * This is a model with one enum with escaped name 310 + */ 311 + export const zModelWithEnumWithHyphen = z.object({ 312 + 'foo-bar-baz-qux': z.optional(z.enum([ 313 + '3.0' 314 + ])) 315 + }); 316 + 317 + /** 318 + * This is a model with one enum 319 + */ 320 + export const zModelWithEnumFromDescription = z.object({ 321 + test: z.optional(z.int()) 322 + }); 323 + 324 + /** 325 + * This is a model with nested enums 326 + */ 327 + export const zModelWithNestedEnums = z.object({ 328 + dictionaryWithEnum: z.optional(z.object({})), 329 + dictionaryWithEnumFromDescription: z.optional(z.object({})), 330 + arrayWithEnum: z.optional(z.array(z.enum([ 331 + 'Success', 332 + 'Warning', 333 + 'Error' 334 + ]))), 335 + arrayWithDescription: z.optional(z.array(z.int())), 336 + 'foo_bar-enum': z.optional(z.enum([ 337 + 'Success', 338 + 'Warning', 339 + 'Error', 340 + 'ØÆÅ字符串' 341 + ])) 342 + }); 343 + 344 + /** 345 + * This is a model with one nested property 346 + */ 347 + export const zModelWithProperties = z.object({ 348 + required: z.string(), 349 + requiredAndReadOnly: z.readonly(z.string()), 350 + requiredAndNullable: z.union([ 351 + z.string(), 352 + z.null() 353 + ]), 354 + string: z.optional(z.string()), 355 + number: z.optional(z.number()), 356 + boolean: z.optional(z.boolean()), 357 + reference: z.optional(zModelWithString), 358 + 'property with space': z.optional(z.string()), 359 + default: z.optional(z.string()), 360 + try: z.optional(z.string()), 361 + '@namespace.string': z.optional(z.readonly(z.string())), 362 + '@namespace.integer': z.optional(z.readonly(z.int())) 363 + }); 364 + 365 + /** 366 + * This is a model with one property containing a reference 367 + */ 368 + export const zModelWithReference = z.object({ 369 + prop: z.optional(zModelWithProperties) 370 + }); 371 + 372 + export const zModelWithReadOnlyAndWriteOnly = z.object({ 373 + foo: z.string(), 374 + bar: z.readonly(z.string()) 375 + }); 376 + 377 + /** 378 + * This is a model with one property containing an array 379 + */ 380 + export const zModelWithArrayReadOnlyAndWriteOnly = z.object({ 381 + prop: z.optional(z.array(zModelWithReadOnlyAndWriteOnly)), 382 + propWithFile: z.optional(z.array(z.string())), 383 + propWithNumber: z.optional(z.array(z.number())) 384 + }); 385 + 386 + /** 387 + * This is a model with one property containing an array 388 + */ 389 + export const zModelWithArray = z.object({ 390 + prop: z.optional(z.array(zModelWithString)), 391 + propWithFile: z.optional(z.array(z.string())), 392 + propWithNumber: z.optional(z.array(z.number())) 393 + }); 394 + 395 + /** 396 + * This is a model with one property containing a dictionary 397 + */ 398 + export const zModelWithDictionary = z.object({ 399 + prop: z.optional(z.object({})) 400 + }); 401 + 402 + /** 403 + * This is a deprecated model with a deprecated property 404 + * @deprecated 405 + */ 406 + export const zDeprecatedModel = z.object({ 407 + prop: z.optional(z.string()) 408 + }); 409 + 410 + /** 411 + * This is a model with one property containing a circular reference 412 + */ 413 + export const zModelWithCircularReference = z.object({ 414 + prop: z.optional(z.lazy(() => { 415 + return zModelWithCircularReference; 416 + })) 417 + }); 418 + 419 + /** 420 + * This is a model with one property with a 'one of' relationship 421 + */ 422 + export const zCompositionWithOneOf = z.object({ 423 + propA: z.optional(z.union([ 424 + zModelWithString, 425 + zModelWithEnum, 426 + zModelWithArray, 427 + zModelWithDictionary 428 + ])) 429 + }); 430 + 431 + /** 432 + * This is a model with one property with a 'one of' relationship where the options are not $ref 433 + */ 434 + export const zCompositionWithOneOfAnonymous = z.object({ 435 + propA: z.optional(z.union([ 436 + z.object({ 437 + propA: z.optional(z.string()) 438 + }), 439 + z.string(), 440 + z.int() 441 + ])) 442 + }); 443 + 444 + /** 445 + * Circle 446 + */ 447 + export const zModelCircle = z.object({ 448 + kind: z.string(), 449 + radius: z.optional(z.number()) 450 + }); 451 + 452 + /** 453 + * Square 454 + */ 455 + export const zModelSquare = z.object({ 456 + kind: z.string(), 457 + sideLength: z.optional(z.number()) 458 + }); 459 + 460 + /** 461 + * This is a model with one property with a 'one of' relationship where the options are not $ref 462 + */ 463 + export const zCompositionWithOneOfDiscriminator = z.union([ 464 + z.intersection(z.object({ 465 + kind: z.literal('circle') 466 + }), zModelCircle), 467 + z.intersection(z.object({ 468 + kind: z.literal('square') 469 + }), zModelSquare) 470 + ]); 471 + 472 + /** 473 + * This is a model with one property with a 'any of' relationship 474 + */ 475 + export const zCompositionWithAnyOf = z.object({ 476 + propA: z.optional(z.union([ 477 + zModelWithString, 478 + zModelWithEnum, 479 + zModelWithArray, 480 + zModelWithDictionary 481 + ])) 482 + }); 483 + 484 + /** 485 + * This is a model with one property with a 'any of' relationship where the options are not $ref 486 + */ 487 + export const zCompositionWithAnyOfAnonymous = z.object({ 488 + propA: z.optional(z.union([ 489 + z.object({ 490 + propA: z.optional(z.string()) 491 + }), 492 + z.string(), 493 + z.int() 494 + ])) 495 + }); 496 + 497 + /** 498 + * This is a model with nested 'any of' property with a type null 499 + */ 500 + export const zCompositionWithNestedAnyAndTypeNull = z.object({ 501 + propA: z.optional(z.union([ 502 + z.array(z.union([ 503 + zModelWithDictionary, 504 + z.null() 505 + ])), 506 + z.array(z.union([ 507 + zModelWithArray, 508 + z.null() 509 + ])) 510 + ])) 511 + }); 512 + 513 + export const z3eNum1Период = z.enum([ 514 + 'Bird', 515 + 'Dog' 516 + ]); 517 + 518 + export const zConstValue = z.enum([ 519 + 'ConstValue' 520 + ]); 521 + 522 + /** 523 + * This is a model with one property with a 'any of' relationship where the options are not $ref 524 + */ 525 + export const zCompositionWithNestedAnyOfAndNull = z.object({ 526 + propA: z.optional(z.union([ 527 + z.array(z.union([ 528 + z3eNum1Период, 529 + zConstValue 530 + ])), 531 + z.null() 532 + ])) 533 + }); 534 + 535 + /** 536 + * This is a model with one property with a 'one of' relationship 537 + */ 538 + export const zCompositionWithOneOfAndNullable = z.object({ 539 + propA: z.optional(z.union([ 540 + z.object({ 541 + boolean: z.optional(z.boolean()) 542 + }), 543 + zModelWithEnum, 544 + zModelWithArray, 545 + zModelWithDictionary, 546 + z.null() 547 + ])) 548 + }); 549 + 550 + /** 551 + * This is a model that contains a simple dictionary within composition 552 + */ 553 + export const zCompositionWithOneOfAndSimpleDictionary = z.object({ 554 + propA: z.optional(z.union([ 555 + z.boolean(), 556 + z.object({}) 557 + ])) 558 + }); 559 + 560 + /** 561 + * This is a model that contains a dictionary of simple arrays within composition 562 + */ 563 + export const zCompositionWithOneOfAndSimpleArrayDictionary = z.object({ 564 + propA: z.optional(z.union([ 565 + z.boolean(), 566 + z.object({}) 567 + ])) 568 + }); 569 + 570 + /** 571 + * This is a model that contains a dictionary of complex arrays (composited) within composition 572 + */ 573 + export const zCompositionWithOneOfAndComplexArrayDictionary = z.object({ 574 + propA: z.optional(z.union([ 575 + z.boolean(), 576 + z.object({}) 577 + ])) 578 + }); 579 + 580 + /** 581 + * This is a model with one property with a 'all of' relationship 582 + */ 583 + export const zCompositionWithAllOfAndNullable = z.object({ 584 + propA: z.optional(z.union([ 585 + z.intersection(z.intersection(z.intersection(z.object({ 586 + boolean: z.optional(z.boolean()) 587 + }), zModelWithEnum), zModelWithArray), zModelWithDictionary), 588 + z.null() 589 + ])) 590 + }); 591 + 592 + /** 593 + * This is a model with one property with a 'any of' relationship 594 + */ 595 + export const zCompositionWithAnyOfAndNullable = z.object({ 596 + propA: z.optional(z.union([ 597 + z.object({ 598 + boolean: z.optional(z.boolean()) 599 + }), 600 + zModelWithEnum, 601 + zModelWithArray, 602 + zModelWithDictionary, 603 + z.null() 604 + ])) 605 + }); 606 + 607 + /** 608 + * This is a base model with two simple optional properties 609 + */ 610 + export const zCompositionBaseModel = z.object({ 611 + firstName: z.optional(z.string()), 612 + lastname: z.optional(z.string()) 613 + }); 614 + 615 + /** 616 + * This is a model that extends the base model 617 + */ 618 + export const zCompositionExtendedModel = z.intersection(zCompositionBaseModel, z.object({ 619 + age: z.number(), 620 + firstName: z.string(), 621 + lastname: z.string() 622 + })); 623 + 624 + /** 625 + * This is a model with one nested property 626 + */ 627 + export const zModelWithNestedProperties = z.object({ 628 + first: z.readonly(z.union([ 629 + z.readonly(z.object({ 630 + second: z.readonly(z.union([ 631 + z.readonly(z.object({ 632 + third: z.readonly(z.union([ 633 + z.readonly(z.string()), 634 + z.null() 635 + ])) 636 + })), 637 + z.null() 638 + ])) 639 + })), 640 + z.null() 641 + ])) 642 + }); 643 + 644 + /** 645 + * This is a model with duplicated properties 646 + */ 647 + export const zModelWithDuplicateProperties = z.object({ 648 + prop: z.optional(zModelWithString) 649 + }); 650 + 651 + /** 652 + * This is a model with ordered properties 653 + */ 654 + export const zModelWithOrderedProperties = z.object({ 655 + zebra: z.optional(z.string()), 656 + apple: z.optional(z.string()), 657 + hawaii: z.optional(z.string()) 658 + }); 659 + 660 + /** 661 + * This is a model with duplicated imports 662 + */ 663 + export const zModelWithDuplicateImports = z.object({ 664 + propA: z.optional(zModelWithString), 665 + propB: z.optional(zModelWithString), 666 + propC: z.optional(zModelWithString) 667 + }); 668 + 669 + /** 670 + * This is a model that extends another model 671 + */ 672 + export const zModelThatExtends = z.intersection(zModelWithString, z.object({ 673 + propExtendsA: z.optional(z.string()), 674 + propExtendsB: z.optional(zModelWithString) 675 + })); 676 + 677 + /** 678 + * This is a model that extends another model 679 + */ 680 + export const zModelThatExtendsExtends = z.intersection(z.intersection(zModelWithString, zModelThatExtends), z.object({ 681 + propExtendsC: z.optional(z.string()), 682 + propExtendsD: z.optional(zModelWithString) 683 + })); 684 + 685 + /** 686 + * This is a model that contains a some patterns 687 + */ 688 + export const zModelWithPattern = z.object({ 689 + key: z.string().check(z.maxLength(64), z.regex(/^[a-zA-Z0-9_]*$/)), 690 + name: z.string().check(z.maxLength(255)), 691 + enabled: z.optional(z.readonly(z.boolean())), 692 + modified: z.optional(z.readonly(z.iso.datetime())), 693 + id: z.optional(z.string().check(z.regex(/^\d{2}-\d{3}-\d{4}$/))), 694 + text: z.optional(z.string().check(z.regex(/^\w+$/))), 695 + patternWithSingleQuotes: z.optional(z.string().check(z.regex(/^[a-zA-Z0-9']*$/))), 696 + patternWithNewline: z.optional(z.string().check(z.regex(/aaa\nbbb/))), 697 + patternWithBacktick: z.optional(z.string().check(z.regex(/aaa`bbb/))) 698 + }); 699 + 700 + export const zFile = z.object({ 701 + id: z.optional(z.readonly(z.string().check(z.minLength(1)))), 702 + updated_at: z.optional(z.readonly(z.iso.datetime())), 703 + created_at: z.optional(z.readonly(z.iso.datetime())), 704 + mime: z.string().check(z.minLength(1), z.maxLength(24)), 705 + file: z.optional(z.readonly(z.url())) 706 + }); 707 + 708 + export const zDefault = z.object({ 709 + name: z.optional(z.string()) 710 + }); 711 + 712 + export const zPageable = z.object({ 713 + page: z._default(z.optional(z.int().check(z.gte(0))), 0), 714 + size: z.optional(z.int().check(z.gte(1))), 715 + sort: z.optional(z.array(z.string())) 716 + }); 717 + 718 + /** 719 + * This is a free-form object without additionalProperties. 720 + */ 721 + export const zFreeFormObjectWithoutAdditionalProperties = z.object({}); 722 + 723 + /** 724 + * This is a free-form object with additionalProperties: true. 725 + */ 726 + export const zFreeFormObjectWithAdditionalPropertiesEqTrue = z.object({}); 727 + 728 + /** 729 + * This is a free-form object with additionalProperties: {}. 730 + */ 731 + export const zFreeFormObjectWithAdditionalPropertiesEqEmptyObject = z.object({}); 732 + 733 + export const zModelWithConst = z.object({ 734 + String: z.optional(z.enum([ 735 + 'String' 736 + ])), 737 + number: z.optional(z.unknown()), 738 + null: z.optional(z.unknown()), 739 + withType: z.optional(z.enum([ 740 + 'Some string' 741 + ])) 742 + }); 743 + 744 + /** 745 + * This is a model with one property and additionalProperties: true 746 + */ 747 + export const zModelWithAdditionalPropertiesEqTrue = z.object({ 748 + prop: z.optional(z.string()) 749 + }); 750 + 751 + export const zNestedAnyOfArraysNullable = z.object({ 752 + nullableArray: z.optional(z.union([ 753 + z.array(z.union([ 754 + z.string(), 755 + z.boolean() 756 + ])), 757 + z.null() 758 + ])) 759 + }); 760 + 761 + /** 762 + * This is a reusable parameter 763 + */ 764 + export const zSimpleParameter = z.unknown(); 765 + 766 + export const zCompositionWithOneOfAndProperties = z.intersection(z.union([ 767 + z.object({ 768 + foo: zSimpleParameter 769 + }), 770 + z.object({ 771 + bar: zNonAsciiStringæøåÆøÅöôêÊ字符串 772 + }) 773 + ]), z.object({ 774 + baz: z.union([ 775 + z.int().check(z.gte(0)), 776 + z.null() 777 + ]), 778 + qux: z.int().check(z.gte(0)) 779 + })); 780 + 781 + /** 782 + * An object that can be null 783 + */ 784 + export const zNullableObject = z._default(z.union([ 785 + z.object({ 786 + foo: z.optional(z.string()) 787 + }), 788 + z.null() 789 + ]), null); 790 + 791 + /** 792 + * Some % character 793 + */ 794 + export const zCharactersInDescription = z.string(); 795 + 796 + export const zModelWithNullableObject = z.object({ 797 + data: z.optional(zNullableObject) 798 + }); 799 + 800 + export const zModelWithOneOfEnum = z.union([ 801 + z.object({ 802 + foo: z.enum([ 803 + 'Bar' 804 + ]) 805 + }), 806 + z.object({ 807 + foo: z.enum([ 808 + 'Baz' 809 + ]) 810 + }), 811 + z.object({ 812 + foo: z.enum([ 813 + 'Qux' 814 + ]) 815 + }), 816 + z.object({ 817 + content: z.iso.datetime(), 818 + foo: z.enum([ 819 + 'Quux' 820 + ]) 821 + }), 822 + z.object({ 823 + content: z.tuple([ 824 + z.iso.datetime(), 825 + z.iso.datetime() 826 + ]), 827 + foo: z.enum([ 828 + 'Corge' 829 + ]) 830 + }) 831 + ]); 832 + 833 + export const zModelWithNestedArrayEnumsDataFoo = z.enum([ 834 + 'foo', 835 + 'bar' 836 + ]); 837 + 838 + export const zModelWithNestedArrayEnumsDataBar = z.enum([ 839 + 'baz', 840 + 'qux' 841 + ]); 842 + 843 + export const zModelWithNestedArrayEnumsData = z.object({ 844 + foo: z.optional(z.array(zModelWithNestedArrayEnumsDataFoo)), 845 + bar: z.optional(z.array(zModelWithNestedArrayEnumsDataBar)) 846 + }); 847 + 848 + export const zModelWithNestedArrayEnums = z.object({ 849 + array_strings: z.optional(z.array(z.string())), 850 + data: z.optional(zModelWithNestedArrayEnumsData) 851 + }); 852 + 853 + export const zModelWithNestedCompositionEnums = z.object({ 854 + foo: z.optional(zModelWithNestedArrayEnumsDataFoo) 855 + }); 856 + 857 + export const zModelWithConstantSizeArray = z.tuple([ 858 + z.number(), 859 + z.number() 860 + ]); 861 + 862 + export const zModelWithAnyOfConstantSizeArray = z.tuple([ 863 + z.union([ 864 + z.number(), 865 + z.string() 866 + ]), 867 + z.union([ 868 + z.number(), 869 + z.string() 870 + ]), 871 + z.union([ 872 + z.number(), 873 + z.string() 874 + ]) 875 + ]); 876 + 877 + export const zModelWithPrefixItemsConstantSizeArray = z.array(z.union([ 878 + zModelWithInteger, 879 + z.number(), 880 + z.string() 881 + ])); 882 + 883 + export const zModelWithAnyOfConstantSizeArrayNullable = z.tuple([ 884 + z.union([ 885 + z.number(), 886 + z.null(), 887 + z.string() 888 + ]), 889 + z.union([ 890 + z.number(), 891 + z.null(), 892 + z.string() 893 + ]), 894 + z.union([ 895 + z.number(), 896 + z.null(), 897 + z.string() 898 + ]) 899 + ]); 900 + 901 + /** 902 + * Model with restricted keyword name 903 + */ 904 + export const zImport = z.string(); 905 + 906 + export const zModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = z.tuple([ 907 + z.union([ 908 + z.number(), 909 + zImport 910 + ]), 911 + z.union([ 912 + z.number(), 913 + zImport 914 + ]) 915 + ]); 916 + 917 + export const zModelWithAnyOfConstantSizeArrayAndIntersect = z.tuple([ 918 + z.intersection(z.number(), z.string()), 919 + z.intersection(z.number(), z.string()) 920 + ]); 921 + 922 + export const zModelWithNumericEnumUnion = z.object({ 923 + value: z.optional(z.unknown()) 924 + }); 925 + 926 + /** 927 + * Some description with `back ticks` 928 + */ 929 + export const zModelWithBackticksInDescription = z.object({ 930 + template: z.optional(z.string()) 931 + }); 932 + 933 + export const zModelWithOneOfAndProperties = z.intersection(z.union([ 934 + zSimpleParameter, 935 + zNonAsciiStringæøåÆøÅöôêÊ字符串 936 + ]), z.object({ 937 + baz: z.union([ 938 + z.int().check(z.gte(0)), 939 + z.null() 940 + ]), 941 + qux: z.int().check(z.gte(0)) 942 + })); 943 + 944 + /** 945 + * Model used to test deduplication strategy (unused) 946 + */ 947 + export const zParameterSimpleParameterUnused = z.string(); 948 + 949 + /** 950 + * Model used to test deduplication strategy 951 + */ 952 + export const zPostServiceWithEmptyTagResponse = z.string(); 953 + 954 + /** 955 + * Model used to test deduplication strategy 956 + */ 957 + export const zPostServiceWithEmptyTagResponse2 = z.string(); 958 + 959 + /** 960 + * Model used to test deduplication strategy 961 + */ 962 + export const zDeleteFooData = z.string(); 963 + 964 + /** 965 + * Model used to test deduplication strategy 966 + */ 967 + export const zDeleteFooData2 = z.string(); 968 + 969 + export const zSchemaWithFormRestrictedKeys = z.object({ 970 + description: z.optional(z.string()), 971 + 'x-enum-descriptions': z.optional(z.string()), 972 + 'x-enum-varnames': z.optional(z.string()), 973 + 'x-enumNames': z.optional(z.string()), 974 + title: z.optional(z.string()), 975 + object: z.optional(z.object({ 976 + description: z.optional(z.string()), 977 + 'x-enum-descriptions': z.optional(z.string()), 978 + 'x-enum-varnames': z.optional(z.string()), 979 + 'x-enumNames': z.optional(z.string()), 980 + title: z.optional(z.string()) 981 + })), 982 + array: z.optional(z.array(z.object({ 983 + description: z.optional(z.string()), 984 + 'x-enum-descriptions': z.optional(z.string()), 985 + 'x-enum-varnames': z.optional(z.string()), 986 + 'x-enumNames': z.optional(z.string()), 987 + title: z.optional(z.string()) 988 + }))) 989 + }); 990 + 991 + /** 992 + * This schema was giving PascalCase transformations a hard time 993 + */ 994 + export const zIoK8sApimachineryPkgApisMetaV1Preconditions = z.object({ 995 + resourceVersion: z.optional(z.string()), 996 + uid: z.optional(z.string()) 997 + }); 998 + 999 + /** 1000 + * This schema was giving PascalCase transformations a hard time 1001 + */ 1002 + export const zIoK8sApimachineryPkgApisMetaV1DeleteOptions = z.object({ 1003 + preconditions: z.optional(zIoK8sApimachineryPkgApisMetaV1Preconditions) 1004 + }); 1005 + 1006 + export const zAdditionalPropertiesUnknownIssue = z.object({}); 1007 + 1008 + export const zAdditionalPropertiesUnknownIssue2 = z.object({}); 1009 + 1010 + export const zAdditionalPropertiesUnknownIssue3 = z.intersection(z.string(), z.object({ 1011 + entries: z.object({}) 1012 + })); 1013 + 1014 + export const zAdditionalPropertiesIntegerIssue = z.object({ 1015 + value: z.int() 1016 + }); 1017 + 1018 + export const zGenericSchemaDuplicateIssue1SystemBoolean = z.object({ 1019 + item: z.optional(z.boolean()), 1020 + error: z.optional(z.union([ 1021 + z.string(), 1022 + z.null() 1023 + ])), 1024 + hasError: z.optional(z.readonly(z.boolean())), 1025 + data: z.optional(z.object({})) 1026 + }); 1027 + 1028 + export const zGenericSchemaDuplicateIssue1SystemString = z.object({ 1029 + item: z.optional(z.union([ 1030 + z.string(), 1031 + z.null() 1032 + ])), 1033 + error: z.optional(z.union([ 1034 + z.string(), 1035 + z.null() 1036 + ])), 1037 + hasError: z.optional(z.readonly(z.boolean())) 1038 + }); 1039 + 1040 + export const zOneOfAllOfIssue = z.union([ 1041 + z.intersection(z.union([ 1042 + zConstValue, 1043 + zGenericSchemaDuplicateIssue1SystemBoolean 1044 + ]), z3eNum1Период), 1045 + zGenericSchemaDuplicateIssue1SystemString 1046 + ]); 1047 + 1048 + /** 1049 + * Model with number-only name 1050 + */ 1051 + export const z400Writable = z.string(); 1052 + 1053 + /** 1054 + * Testing multiline comments in string: First line 1055 + * Second line 1056 + * 1057 + * Fourth line 1058 + */ 1059 + export const zCamelCaseCommentWithBreaksWritable = z.int(); 1060 + 1061 + /** 1062 + * Testing multiline comments in string: First line 1063 + * Second line 1064 + * 1065 + * Fourth line 1066 + */ 1067 + export const zCommentWithBreaksWritable = z.int(); 1068 + 1069 + /** 1070 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1071 + */ 1072 + export const zCommentWithBackticksWritable = z.int(); 1073 + 1074 + /** 1075 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 1076 + */ 1077 + export const zCommentWithBackticksAndQuotesWritable = z.int(); 1078 + 1079 + /** 1080 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1081 + */ 1082 + export const zCommentWithSlashesWritable = z.int(); 1083 + 1084 + /** 1085 + * Testing expression placeholders in string: ${expression} should work 1086 + */ 1087 + export const zCommentWithExpressionPlaceholdersWritable = z.int(); 1088 + 1089 + /** 1090 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1091 + */ 1092 + export const zCommentWithQuotesWritable = z.int(); 1093 + 1094 + /** 1095 + * Testing reserved characters in string: * inline * and ** inline ** should work 1096 + */ 1097 + export const zCommentWithReservedCharactersWritable = z.int(); 1098 + 1099 + /** 1100 + * This is a simple number 1101 + */ 1102 + export const zSimpleIntegerWritable = z.int(); 1103 + 1104 + /** 1105 + * This is a simple boolean 1106 + */ 1107 + export const zSimpleBooleanWritable = z.boolean(); 1108 + 1109 + /** 1110 + * This is a simple string 1111 + */ 1112 + export const zSimpleStringWritable = z.string(); 1113 + 1114 + /** 1115 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 1116 + */ 1117 + export const zNonAsciiStringæøåÆøÅöôêÊ字符串Writable = z.string(); 1118 + 1119 + /** 1120 + * This is a simple file 1121 + */ 1122 + export const zSimpleFileWritable = z.string(); 1123 + 1124 + /** 1125 + * This is a simple string 1126 + */ 1127 + export const zSimpleStringWithPatternWritable = z.union([ 1128 + z.string().check(z.maxLength(64), z.regex(/^[a-zA-Z0-9_]*$/)), 1129 + z.null() 1130 + ]); 1131 + 1132 + /** 1133 + * This is a simple enum with strings 1134 + */ 1135 + export const zEnumWithStringsWritable = z.enum([ 1136 + 'Success', 1137 + 'Warning', 1138 + 'Error', 1139 + "'Single Quote'", 1140 + '"Double Quotes"', 1141 + 'Non-ascii: øæåôöØÆÅÔÖ字符串' 1142 + ]); 1143 + 1144 + export const zEnumWithReplacedCharactersWritable = z.enum([ 1145 + "'Single Quote'", 1146 + '"Double Quotes"', 1147 + 'øæåôöØÆÅÔÖ字符串', 1148 + '' 1149 + ]); 1150 + 1151 + /** 1152 + * This is a simple enum with numbers 1153 + */ 1154 + export const zEnumWithNumbersWritable = z.unknown(); 1155 + 1156 + /** 1157 + * Success=1,Warning=2,Error=3 1158 + */ 1159 + export const zEnumFromDescriptionWritable = z.number(); 1160 + 1161 + /** 1162 + * This is a simple enum with numbers 1163 + */ 1164 + export const zEnumWithExtensionsWritable = z.unknown(); 1165 + 1166 + export const zEnumWithXEnumNamesWritable = z.unknown(); 1167 + 1168 + /** 1169 + * This is a simple array with numbers 1170 + */ 1171 + export const zArrayWithNumbersWritable = z.array(z.int()); 1172 + 1173 + /** 1174 + * This is a simple array with booleans 1175 + */ 1176 + export const zArrayWithBooleansWritable = z.array(z.boolean()); 1177 + 1178 + /** 1179 + * This is a simple array with strings 1180 + */ 1181 + export const zArrayWithStringsWritable = z._default(z.array(z.string()), ['test']); 1182 + 1183 + /** 1184 + * This is a string dictionary 1185 + */ 1186 + export const zDictionaryWithStringWritable = z.object({}); 1187 + 1188 + /** 1189 + * This is a string dictionary 1190 + */ 1191 + export const zDictionaryWithDictionaryWritable = z.record(z.string(), z.object({})); 1192 + 1193 + /** 1194 + * `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) 1195 + */ 1196 + export const zModelFromZendeskWritable = z.string(); 1197 + 1198 + export const zModelWithReadOnlyAndWriteOnlyWritable = z.object({ 1199 + foo: z.string(), 1200 + baz: z.string() 1201 + }); 1202 + 1203 + /** 1204 + * This is a model with one property containing an array 1205 + */ 1206 + export const zModelWithArrayReadOnlyAndWriteOnlyWritable = z.object({ 1207 + prop: z.optional(z.array(zModelWithReadOnlyAndWriteOnlyWritable)), 1208 + propWithFile: z.optional(z.array(z.string())), 1209 + propWithNumber: z.optional(z.array(z.number())) 1210 + }); 1211 + 1212 + export const z3eNum1ПериодWritable = z.enum([ 1213 + 'Bird', 1214 + 'Dog' 1215 + ]); 1216 + 1217 + export const zConstValueWritable = z.enum([ 1218 + 'ConstValue' 1219 + ]); 1220 + 1221 + /** 1222 + * This is a free-form object without additionalProperties. 1223 + */ 1224 + export const zFreeFormObjectWithoutAdditionalPropertiesWritable = z.object({}); 1225 + 1226 + /** 1227 + * This is a free-form object with additionalProperties: true. 1228 + */ 1229 + export const zFreeFormObjectWithAdditionalPropertiesEqTrueWritable = z.object({}); 1230 + 1231 + /** 1232 + * This is a free-form object with additionalProperties: {}. 1233 + */ 1234 + export const zFreeFormObjectWithAdditionalPropertiesEqEmptyObjectWritable = z.object({}); 1235 + 1236 + /** 1237 + * Some % character 1238 + */ 1239 + export const zCharactersInDescriptionWritable = z.string(); 1240 + 1241 + export const zModelWithNestedArrayEnumsDataFooWritable = z.enum([ 1242 + 'foo', 1243 + 'bar' 1244 + ]); 1245 + 1246 + export const zModelWithNestedArrayEnumsDataBarWritable = z.enum([ 1247 + 'baz', 1248 + 'qux' 1249 + ]); 1250 + 1251 + export const zModelWithConstantSizeArrayWritable = z.tuple([ 1252 + z.number(), 1253 + z.number() 1254 + ]); 1255 + 1256 + export const zModelWithAnyOfConstantSizeArrayWritable = z.tuple([ 1257 + z.union([ 1258 + z.number(), 1259 + z.string() 1260 + ]), 1261 + z.union([ 1262 + z.number(), 1263 + z.string() 1264 + ]), 1265 + z.union([ 1266 + z.number(), 1267 + z.string() 1268 + ]) 1269 + ]); 1270 + 1271 + export const zModelWithAnyOfConstantSizeArrayNullableWritable = z.tuple([ 1272 + z.union([ 1273 + z.number(), 1274 + z.null(), 1275 + z.string() 1276 + ]), 1277 + z.union([ 1278 + z.number(), 1279 + z.null(), 1280 + z.string() 1281 + ]), 1282 + z.union([ 1283 + z.number(), 1284 + z.null(), 1285 + z.string() 1286 + ]) 1287 + ]); 1288 + 1289 + /** 1290 + * Model with restricted keyword name 1291 + */ 1292 + export const zImportWritable = z.string(); 1293 + 1294 + export const zModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = z.tuple([ 1295 + z.union([ 1296 + z.number(), 1297 + zImportWritable 1298 + ]), 1299 + z.union([ 1300 + z.number(), 1301 + zImportWritable 1302 + ]) 1303 + ]); 1304 + 1305 + export const zModelWithAnyOfConstantSizeArrayAndIntersectWritable = z.tuple([ 1306 + z.intersection(z.number(), z.string()), 1307 + z.intersection(z.number(), z.string()) 1308 + ]); 1309 + 1310 + /** 1311 + * Model used to test deduplication strategy (unused) 1312 + */ 1313 + export const zParameterSimpleParameterUnusedWritable = z.string(); 1314 + 1315 + /** 1316 + * Model used to test deduplication strategy 1317 + */ 1318 + export const zPostServiceWithEmptyTagResponseWritable = z.string(); 1319 + 1320 + /** 1321 + * Model used to test deduplication strategy 1322 + */ 1323 + export const zPostServiceWithEmptyTagResponse2Writable = z.string(); 1324 + 1325 + /** 1326 + * Model used to test deduplication strategy 1327 + */ 1328 + export const zDeleteFooDataWritable = z.string(); 1329 + 1330 + /** 1331 + * Model used to test deduplication strategy 1332 + */ 1333 + export const zDeleteFooData2Writable = z.string(); 1334 + 1335 + export const zAdditionalPropertiesUnknownIssueWritable = z.object({}); 1336 + 1337 + export const zAdditionalPropertiesUnknownIssue2Writable = z.object({}); 1338 + 1339 + export const zOneOfAllOfIssueWritable = z.union([ 1340 + z.intersection(z.union([ 1341 + zConstValueWritable, 1342 + zGenericSchemaDuplicateIssue1SystemBoolean 1343 + ]), z3eNum1Период), 1344 + zGenericSchemaDuplicateIssue1SystemString 1345 + ]); 1346 + 1347 + /** 1348 + * Parameter with illegal characters 1349 + */ 1350 + export const zXFooBar = zModelWithString; 1351 + 1352 + export const zSimpleRequestBody = zModelWithString; 1353 + 1354 + export const zSimpleFormData = zModelWithString; 1355 + 1356 + export const zExportData = z.object({ 1357 + body: z.optional(z.never()), 1358 + path: z.optional(z.never()), 1359 + query: z.optional(z.never()) 1360 + }); 1361 + 1362 + export const zPatchApiVbyApiVersionNoTagData = z.object({ 1363 + body: z.optional(z.never()), 1364 + path: z.optional(z.never()), 1365 + query: z.optional(z.never()) 1366 + }); 1367 + 1368 + export const zImportData = z.object({ 1369 + body: z.union([ 1370 + zModelWithReadOnlyAndWriteOnlyWritable, 1371 + zModelWithArrayReadOnlyAndWriteOnlyWritable 1372 + ]), 1373 + path: z.optional(z.never()), 1374 + query: z.optional(z.never()) 1375 + }); 1376 + 1377 + export const zImportResponse = z.union([ 1378 + zModelFromZendesk, 1379 + zModelWithReadOnlyAndWriteOnly 1380 + ]); 1381 + 1382 + export const zFooWowData = z.object({ 1383 + body: z.optional(z.never()), 1384 + path: z.optional(z.never()), 1385 + query: z.optional(z.never()) 1386 + }); 1387 + 1388 + export const zApiVVersionODataControllerCountData = z.object({ 1389 + body: z.optional(z.never()), 1390 + path: z.optional(z.never()), 1391 + query: z.optional(z.never()) 1392 + }); 1393 + 1394 + /** 1395 + * Success 1396 + */ 1397 + export const zApiVVersionODataControllerCountResponse = zModelFromZendesk; 1398 + 1399 + export const zGetApiVbyApiVersionSimpleOperationData = z.object({ 1400 + body: z.optional(z.never()), 1401 + path: z.object({ 1402 + foo_param: z.string() 1403 + }), 1404 + query: z.optional(z.never()) 1405 + }); 1406 + 1407 + /** 1408 + * Response is a simple number 1409 + */ 1410 + export const zGetApiVbyApiVersionSimpleOperationResponse = z.number(); 1411 + 1412 + export const zDeleteCallWithoutParametersAndResponseData = z.object({ 1413 + body: z.optional(z.never()), 1414 + path: z.optional(z.never()), 1415 + query: z.optional(z.never()) 1416 + }); 1417 + 1418 + export const zGetCallWithoutParametersAndResponseData = z.object({ 1419 + body: z.optional(z.never()), 1420 + path: z.optional(z.never()), 1421 + query: z.optional(z.never()) 1422 + }); 1423 + 1424 + export const zHeadCallWithoutParametersAndResponseData = z.object({ 1425 + body: z.optional(z.never()), 1426 + path: z.optional(z.never()), 1427 + query: z.optional(z.never()) 1428 + }); 1429 + 1430 + export const zOptionsCallWithoutParametersAndResponseData = z.object({ 1431 + body: z.optional(z.never()), 1432 + path: z.optional(z.never()), 1433 + query: z.optional(z.never()) 1434 + }); 1435 + 1436 + export const zPatchCallWithoutParametersAndResponseData = z.object({ 1437 + body: z.optional(z.never()), 1438 + path: z.optional(z.never()), 1439 + query: z.optional(z.never()) 1440 + }); 1441 + 1442 + export const zPostCallWithoutParametersAndResponseData = z.object({ 1443 + body: z.optional(z.never()), 1444 + path: z.optional(z.never()), 1445 + query: z.optional(z.never()) 1446 + }); 1447 + 1448 + export const zPutCallWithoutParametersAndResponseData = z.object({ 1449 + body: z.optional(z.never()), 1450 + path: z.optional(z.never()), 1451 + query: z.optional(z.never()) 1452 + }); 1453 + 1454 + export const zDeleteFooData3 = z.object({ 1455 + body: z.optional(z.never()), 1456 + path: z.object({ 1457 + foo_param: z.string(), 1458 + BarParam: z.string() 1459 + }), 1460 + query: z.optional(z.never()), 1461 + headers: z.object({ 1462 + 'x-Foo-Bar': zModelWithString 1463 + }) 1464 + }); 1465 + 1466 + export const zCallWithDescriptionsData = z.object({ 1467 + body: z.optional(z.never()), 1468 + path: z.optional(z.never()), 1469 + query: z.optional(z.object({ 1470 + parameterWithBreaks: z.optional(z.string()), 1471 + parameterWithBackticks: z.optional(z.string()), 1472 + parameterWithSlashes: z.optional(z.string()), 1473 + parameterWithExpressionPlaceholders: z.optional(z.string()), 1474 + parameterWithQuotes: z.optional(z.string()), 1475 + parameterWithReservedCharacters: z.optional(z.string()) 1476 + })) 1477 + }); 1478 + 1479 + export const zDeprecatedCallData = z.object({ 1480 + body: z.optional(z.never()), 1481 + path: z.optional(z.never()), 1482 + query: z.optional(z.never()), 1483 + headers: z.object({ 1484 + parameter: z.union([ 1485 + zDeprecatedModel, 1486 + z.null() 1487 + ]) 1488 + }) 1489 + }); 1490 + 1491 + export const zCallWithParametersData = z.object({ 1492 + body: z.union([ 1493 + z.object({}), 1494 + z.null() 1495 + ]), 1496 + path: z.object({ 1497 + parameterPath: z.union([ 1498 + z.string(), 1499 + z.null() 1500 + ]), 1501 + 'api-version': z.union([ 1502 + z.string(), 1503 + z.null() 1504 + ]) 1505 + }), 1506 + query: z.object({ 1507 + foo_ref_enum: z.optional(zModelWithNestedArrayEnumsDataFooWritable), 1508 + foo_all_of_enum: zModelWithNestedArrayEnumsDataFooWritable, 1509 + cursor: z.union([ 1510 + z.string(), 1511 + z.null() 1512 + ]) 1513 + }), 1514 + headers: z.object({ 1515 + parameterHeader: z.union([ 1516 + z.string(), 1517 + z.null() 1518 + ]) 1519 + }) 1520 + }); 1521 + 1522 + export const zCallWithWeirdParameterNamesData = z.object({ 1523 + body: z.union([ 1524 + zModelWithString, 1525 + z.null() 1526 + ]), 1527 + path: z.object({ 1528 + 'parameter.path.1': z.optional(z.string()), 1529 + 'parameter-path-2': z.optional(z.string()), 1530 + 'PARAMETER-PATH-3': z.optional(z.string()), 1531 + 'api-version': z.union([ 1532 + z.string(), 1533 + z.null() 1534 + ]) 1535 + }), 1536 + query: z.object({ 1537 + default: z.optional(z.string()), 1538 + 'parameter-query': z.union([ 1539 + z.string(), 1540 + z.null() 1541 + ]) 1542 + }), 1543 + headers: z.object({ 1544 + 'parameter.header': z.union([ 1545 + z.string(), 1546 + z.null() 1547 + ]) 1548 + }) 1549 + }); 1550 + 1551 + export const zGetCallWithOptionalParamData = z.object({ 1552 + body: zModelWithOneOfEnum, 1553 + path: z.optional(z.never()), 1554 + query: z.optional(z.object({ 1555 + page: z.optional(z.number()) 1556 + })) 1557 + }); 1558 + 1559 + export const zPostCallWithOptionalParamData = z.object({ 1560 + body: z.optional(z.object({ 1561 + offset: z.optional(z.union([ 1562 + z.number(), 1563 + z.null() 1564 + ])) 1565 + })), 1566 + path: z.optional(z.never()), 1567 + query: z.object({ 1568 + parameter: zPageable 1569 + }) 1570 + }); 1571 + 1572 + export const zPostCallWithOptionalParamResponse = z.union([ 1573 + z.number(), 1574 + z.void() 1575 + ]); 1576 + 1577 + export const zPostApiVbyApiVersionRequestBodyData = z.object({ 1578 + body: z.optional(zSimpleRequestBody), 1579 + path: z.optional(z.never()), 1580 + query: z.optional(z.object({ 1581 + parameter: z.optional(z.string()) 1582 + })) 1583 + }); 1584 + 1585 + export const zPostApiVbyApiVersionFormDataData = z.object({ 1586 + body: z.optional(zSimpleFormData), 1587 + path: z.optional(z.never()), 1588 + query: z.optional(z.object({ 1589 + parameter: z.optional(z.string()) 1590 + })) 1591 + }); 1592 + 1593 + export const zCallWithDefaultParametersData = z.object({ 1594 + body: z.optional(z.never()), 1595 + path: z.optional(z.never()), 1596 + query: z.optional(z.object({ 1597 + parameterString: z._default(z.optional(z.union([ 1598 + z._default(z.string(), 'Hello World!'), 1599 + z.null() 1600 + ])), 'Hello World!'), 1601 + parameterNumber: z._default(z.optional(z.union([ 1602 + z._default(z.number(), 123), 1603 + z.null() 1604 + ])), 123), 1605 + parameterBoolean: z._default(z.optional(z.union([ 1606 + z._default(z.boolean(), true), 1607 + z.null() 1608 + ])), true), 1609 + parameterEnum: z.optional(z.enum([ 1610 + 'Success', 1611 + 'Warning', 1612 + 'Error' 1613 + ])), 1614 + parameterModel: z.optional(z.union([ 1615 + zModelWithString, 1616 + z.null() 1617 + ])) 1618 + })) 1619 + }); 1620 + 1621 + export const zCallWithDefaultOptionalParametersData = z.object({ 1622 + body: z.optional(z.never()), 1623 + path: z.optional(z.never()), 1624 + query: z.optional(z.object({ 1625 + parameterString: z._default(z.optional(z.string()), 'Hello World!'), 1626 + parameterNumber: z._default(z.optional(z.number()), 123), 1627 + parameterBoolean: z._default(z.optional(z.boolean()), true), 1628 + parameterEnum: z.optional(z.enum([ 1629 + 'Success', 1630 + 'Warning', 1631 + 'Error' 1632 + ])), 1633 + parameterModel: z.optional(zModelWithString) 1634 + })) 1635 + }); 1636 + 1637 + export const zCallToTestOrderOfParamsData = z.object({ 1638 + body: z.optional(z.never()), 1639 + path: z.optional(z.never()), 1640 + query: z.object({ 1641 + parameterOptionalStringWithDefault: z._default(z.optional(z.string()), 'Hello World!'), 1642 + parameterOptionalStringWithEmptyDefault: z._default(z.optional(z.string()), ''), 1643 + parameterOptionalStringWithNoDefault: z.optional(z.string()), 1644 + parameterStringWithDefault: z._default(z.string(), 'Hello World!'), 1645 + parameterStringWithEmptyDefault: z._default(z.string(), ''), 1646 + parameterStringWithNoDefault: z.string(), 1647 + parameterStringNullableWithNoDefault: z.optional(z.union([ 1648 + z.string(), 1649 + z.null() 1650 + ])), 1651 + parameterStringNullableWithDefault: z._default(z.optional(z.union([ 1652 + z.string(), 1653 + z.null() 1654 + ])), null) 1655 + }) 1656 + }); 1657 + 1658 + export const zDuplicateNameData = z.object({ 1659 + body: z.optional(z.never()), 1660 + path: z.optional(z.never()), 1661 + query: z.optional(z.never()) 1662 + }); 1663 + 1664 + export const zDuplicateName2Data = z.object({ 1665 + body: z.optional(z.never()), 1666 + path: z.optional(z.never()), 1667 + query: z.optional(z.never()) 1668 + }); 1669 + 1670 + export const zDuplicateName3Data = z.object({ 1671 + body: z.optional(z.never()), 1672 + path: z.optional(z.never()), 1673 + query: z.optional(z.never()) 1674 + }); 1675 + 1676 + export const zDuplicateName4Data = z.object({ 1677 + body: z.optional(z.never()), 1678 + path: z.optional(z.never()), 1679 + query: z.optional(z.never()) 1680 + }); 1681 + 1682 + export const zCallWithNoContentResponseData = z.object({ 1683 + body: z.optional(z.never()), 1684 + path: z.optional(z.never()), 1685 + query: z.optional(z.never()) 1686 + }); 1687 + 1688 + /** 1689 + * Success 1690 + */ 1691 + export const zCallWithNoContentResponseResponse = z.void(); 1692 + 1693 + export const zCallWithResponseAndNoContentResponseData = z.object({ 1694 + body: z.optional(z.never()), 1695 + path: z.optional(z.never()), 1696 + query: z.optional(z.never()) 1697 + }); 1698 + 1699 + export const zCallWithResponseAndNoContentResponseResponse = z.union([ 1700 + z.number(), 1701 + z.void() 1702 + ]); 1703 + 1704 + export const zDummyAData = z.object({ 1705 + body: z.optional(z.never()), 1706 + path: z.optional(z.never()), 1707 + query: z.optional(z.never()) 1708 + }); 1709 + 1710 + export const zDummyAResponse = z400; 1711 + 1712 + export const zDummyBData = z.object({ 1713 + body: z.optional(z.never()), 1714 + path: z.optional(z.never()), 1715 + query: z.optional(z.never()) 1716 + }); 1717 + 1718 + /** 1719 + * Success 1720 + */ 1721 + export const zDummyBResponse = z.void(); 1722 + 1723 + export const zCallWithResponseData = z.object({ 1724 + body: z.optional(z.never()), 1725 + path: z.optional(z.never()), 1726 + query: z.optional(z.never()) 1727 + }); 1728 + 1729 + export const zCallWithResponseResponse = zImport; 1730 + 1731 + export const zCallWithDuplicateResponsesData = z.object({ 1732 + body: z.optional(z.never()), 1733 + path: z.optional(z.never()), 1734 + query: z.optional(z.never()) 1735 + }); 1736 + 1737 + export const zCallWithDuplicateResponsesResponse = z.union([ 1738 + z.intersection(zModelWithBoolean, zModelWithInteger), 1739 + zModelWithString 1740 + ]); 1741 + 1742 + export const zCallWithResponsesData = z.object({ 1743 + body: z.optional(z.never()), 1744 + path: z.optional(z.never()), 1745 + query: z.optional(z.never()) 1746 + }); 1747 + 1748 + export const zCallWithResponsesResponse = z.union([ 1749 + z.object({ 1750 + '@namespace.string': z.optional(z.readonly(z.string())), 1751 + '@namespace.integer': z.optional(z.readonly(z.int())), 1752 + value: z.optional(z.readonly(z.array(zModelWithString))) 1753 + }), 1754 + zModelThatExtends, 1755 + zModelThatExtendsExtends 1756 + ]); 1757 + 1758 + export const zCollectionFormatData = z.object({ 1759 + body: z.optional(z.never()), 1760 + path: z.optional(z.never()), 1761 + query: z.object({ 1762 + parameterArrayCSV: z.union([ 1763 + z.array(z.string()), 1764 + z.null() 1765 + ]), 1766 + parameterArraySSV: z.union([ 1767 + z.array(z.string()), 1768 + z.null() 1769 + ]), 1770 + parameterArrayTSV: z.union([ 1771 + z.array(z.string()), 1772 + z.null() 1773 + ]), 1774 + parameterArrayPipes: z.union([ 1775 + z.array(z.string()), 1776 + z.null() 1777 + ]), 1778 + parameterArrayMulti: z.union([ 1779 + z.array(z.string()), 1780 + z.null() 1781 + ]) 1782 + }) 1783 + }); 1784 + 1785 + export const zTypesData = z.object({ 1786 + body: z.optional(z.never()), 1787 + path: z.optional(z.object({ 1788 + id: z.optional(z.int()) 1789 + })), 1790 + query: z.object({ 1791 + parameterNumber: z._default(z.number(), 123), 1792 + parameterString: z._default(z.union([ 1793 + z._default(z.string(), 'default'), 1794 + z.null() 1795 + ]), 'default'), 1796 + parameterBoolean: z._default(z.union([ 1797 + z._default(z.boolean(), true), 1798 + z.null() 1799 + ]), true), 1800 + parameterObject: z._default(z.union([ 1801 + z.object({}), 1802 + z.null() 1803 + ]), null), 1804 + parameterArray: z.union([ 1805 + z.array(z.string()), 1806 + z.null() 1807 + ]), 1808 + parameterDictionary: z.union([ 1809 + z.object({}), 1810 + z.null() 1811 + ]), 1812 + parameterEnum: z.enum([ 1813 + 'Success', 1814 + 'Warning', 1815 + 'Error' 1816 + ]) 1817 + }) 1818 + }); 1819 + 1820 + export const zTypesResponse = z.union([ 1821 + z.number(), 1822 + z.string(), 1823 + z.boolean(), 1824 + z.object({}) 1825 + ]); 1826 + 1827 + export const zUploadFileData = z.object({ 1828 + body: z.string(), 1829 + path: z.object({ 1830 + 'api-version': z.union([ 1831 + z.string(), 1832 + z.null() 1833 + ]) 1834 + }), 1835 + query: z.optional(z.never()) 1836 + }); 1837 + 1838 + export const zUploadFileResponse = z.boolean(); 1839 + 1840 + export const zFileResponseData = z.object({ 1841 + body: z.optional(z.never()), 1842 + path: z.object({ 1843 + id: z.string(), 1844 + 'api-version': z.string() 1845 + }), 1846 + query: z.optional(z.never()) 1847 + }); 1848 + 1849 + /** 1850 + * Success 1851 + */ 1852 + export const zFileResponseResponse = z.string(); 1853 + 1854 + export const zComplexTypesData = z.object({ 1855 + body: z.optional(z.never()), 1856 + path: z.optional(z.never()), 1857 + query: z.object({ 1858 + parameterObject: z.object({ 1859 + first: z.optional(z.object({ 1860 + second: z.optional(z.object({ 1861 + third: z.optional(z.string()) 1862 + })) 1863 + })) 1864 + }), 1865 + parameterReference: zModelWithString 1866 + }) 1867 + }); 1868 + 1869 + /** 1870 + * Successful response 1871 + */ 1872 + export const zComplexTypesResponse = z.array(zModelWithString); 1873 + 1874 + export const zMultipartResponseData = z.object({ 1875 + body: z.optional(z.never()), 1876 + path: z.optional(z.never()), 1877 + query: z.optional(z.never()) 1878 + }); 1879 + 1880 + /** 1881 + * OK 1882 + */ 1883 + export const zMultipartResponseResponse = z.object({ 1884 + file: z.optional(z.string()), 1885 + metadata: z.optional(z.object({ 1886 + foo: z.optional(z.string()), 1887 + bar: z.optional(z.string()) 1888 + })) 1889 + }); 1890 + 1891 + export const zMultipartRequestData = z.object({ 1892 + body: z.optional(z.object({ 1893 + content: z.optional(z.string()), 1894 + data: z.optional(z.union([ 1895 + zModelWithString, 1896 + z.null() 1897 + ])) 1898 + })), 1899 + path: z.optional(z.never()), 1900 + query: z.optional(z.never()) 1901 + }); 1902 + 1903 + export const zComplexParamsData = z.object({ 1904 + body: z.optional(z.object({ 1905 + key: z.readonly(z.union([ 1906 + z.readonly(z.string().check(z.maxLength(64), z.regex(/^[a-zA-Z0-9_]*$/))), 1907 + z.null() 1908 + ])), 1909 + name: z.union([ 1910 + z.string().check(z.maxLength(255)), 1911 + z.null() 1912 + ]), 1913 + enabled: z._default(z.optional(z.boolean()), true), 1914 + type: z.enum([ 1915 + 'Monkey', 1916 + 'Horse', 1917 + 'Bird' 1918 + ]), 1919 + listOfModels: z.optional(z.union([ 1920 + z.array(zModelWithString), 1921 + z.null() 1922 + ])), 1923 + listOfStrings: z.optional(z.union([ 1924 + z.array(z.string()), 1925 + z.null() 1926 + ])), 1927 + parameters: z.union([ 1928 + zModelWithString, 1929 + zModelWithEnum, 1930 + zModelWithArray, 1931 + zModelWithDictionary 1932 + ]), 1933 + user: z.optional(z.readonly(z.object({ 1934 + id: z.optional(z.readonly(z.int())), 1935 + name: z.optional(z.readonly(z.union([ 1936 + z.readonly(z.string()), 1937 + z.null() 1938 + ]))) 1939 + }))) 1940 + })), 1941 + path: z.object({ 1942 + id: z.int(), 1943 + 'api-version': z.string() 1944 + }), 1945 + query: z.optional(z.never()) 1946 + }); 1947 + 1948 + /** 1949 + * Success 1950 + */ 1951 + export const zComplexParamsResponse = zModelWithString; 1952 + 1953 + export const zCallWithResultFromHeaderData = z.object({ 1954 + body: z.optional(z.never()), 1955 + path: z.optional(z.never()), 1956 + query: z.optional(z.never()) 1957 + }); 1958 + 1959 + export const zTestErrorCodeData = z.object({ 1960 + body: z.optional(z.never()), 1961 + path: z.optional(z.never()), 1962 + query: z.object({ 1963 + status: z.int() 1964 + }) 1965 + }); 1966 + 1967 + export const zNonAsciiæøåÆøÅöôêÊ字符串Data = z.object({ 1968 + body: z.optional(z.never()), 1969 + path: z.optional(z.never()), 1970 + query: z.object({ 1971 + 'nonAsciiParamæøåÆØÅöôêÊ': z.int() 1972 + }) 1973 + }); 1974 + 1975 + /** 1976 + * Successful response 1977 + */ 1978 + export const zNonAsciiæøåÆøÅöôêÊ字符串Response = z.array(zNonAsciiStringæøåÆøÅöôêÊ字符串); 1979 + 1980 + export const zPutWithFormUrlEncodedData = z.object({ 1981 + body: zArrayWithStringsWritable, 1982 + path: z.optional(z.never()), 1983 + query: z.optional(z.never()) 1984 + });
+18
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/enum-null/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import * as z from 'zod/v4-mini'; 4 + 5 + export const zFoo = z.enum([ 6 + 'foo', 7 + 'bar' 8 + ]).nullable(); 9 + 10 + export const zBar = z.enum([ 11 + 'foo', 12 + 'bar' 13 + ]); 14 + 15 + export const zBaz = z.enum([ 16 + 'foo', 17 + 'bar' 18 + ]);
+24
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/type-format-zod/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import * as z from 'zod/v4-mini'; 4 + 5 + export const zFoo = z.object({ 6 + bar: z.optional(z.int()), 7 + foo: z._default(z.coerce.bigint(), BigInt(0)), 8 + id: z.string() 9 + }); 10 + 11 + export const zBar = z.object({ 12 + foo: z.int() 13 + }); 14 + 15 + export const zPostFooData = z.object({ 16 + body: z.optional(z.never()), 17 + path: z.optional(z.never()), 18 + query: z.optional(z.never()) 19 + }); 20 + 21 + /** 22 + * OK 23 + */ 24 + export const zPostFooResponse = zFoo;
+23
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/validators/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import * as z from 'zod/v4-mini'; 4 + 5 + export const zBar = z.object({ 6 + foo: z.optional(z.lazy(() => { 7 + return zFoo; 8 + })) 9 + }); 10 + 11 + export const zFoo = z._default(z.union([ 12 + z.object({ 13 + foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), 14 + bar: z.optional(zBar), 15 + baz: z.optional(z.array(z.lazy(() => { 16 + return zFoo; 17 + }))), 18 + qux: z._default(z.optional(z.int().check(z.gt(0))), 0) 19 + }), 20 + z.null() 21 + ]), null); 22 + 23 + export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz');
+9
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v3/array-items-one-of-length-1/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod'; 4 + 5 + export const zBar = z.string(); 6 + 7 + export const zFoo = z.object({ 8 + foo: z.array(zBar).min(1).max(2147483647).optional() 9 + });
+1984
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v3/default/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod'; 4 + 5 + /** 6 + * Model with number-only name 7 + */ 8 + export const z400 = z.string(); 9 + 10 + /** 11 + * Testing multiline comments in string: First line 12 + * Second line 13 + * 14 + * Fourth line 15 + */ 16 + export const zCamelCaseCommentWithBreaks = z.number().int(); 17 + 18 + /** 19 + * Testing multiline comments in string: First line 20 + * Second line 21 + * 22 + * Fourth line 23 + */ 24 + export const zCommentWithBreaks = z.number().int(); 25 + 26 + /** 27 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 28 + */ 29 + export const zCommentWithBackticks = z.number().int(); 30 + 31 + /** 32 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 33 + */ 34 + export const zCommentWithBackticksAndQuotes = z.number().int(); 35 + 36 + /** 37 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 38 + */ 39 + export const zCommentWithSlashes = z.number().int(); 40 + 41 + /** 42 + * Testing expression placeholders in string: ${expression} should work 43 + */ 44 + export const zCommentWithExpressionPlaceholders = z.number().int(); 45 + 46 + /** 47 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 48 + */ 49 + export const zCommentWithQuotes = z.number().int(); 50 + 51 + /** 52 + * Testing reserved characters in string: * inline * and ** inline ** should work 53 + */ 54 + export const zCommentWithReservedCharacters = z.number().int(); 55 + 56 + /** 57 + * This is a simple number 58 + */ 59 + export const zSimpleInteger = z.number().int(); 60 + 61 + /** 62 + * This is a simple boolean 63 + */ 64 + export const zSimpleBoolean = z.boolean(); 65 + 66 + /** 67 + * This is a simple string 68 + */ 69 + export const zSimpleString = z.string(); 70 + 71 + /** 72 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 73 + */ 74 + export const zNonAsciiStringæøåÆøÅöôêÊ字符串 = z.string(); 75 + 76 + /** 77 + * This is a simple file 78 + */ 79 + export const zSimpleFile = z.string(); 80 + 81 + /** 82 + * This is a model with one string property 83 + */ 84 + export const zModelWithString = z.object({ 85 + prop: z.string().optional() 86 + }); 87 + 88 + /** 89 + * This is a simple reference 90 + */ 91 + export const zSimpleReference = zModelWithString; 92 + 93 + /** 94 + * This is a simple string 95 + */ 96 + export const zSimpleStringWithPattern = z.union([ 97 + z.string().max(64).regex(/^[a-zA-Z0-9_]*$/), 98 + z.null() 99 + ]); 100 + 101 + /** 102 + * This is a simple enum with strings 103 + */ 104 + export const zEnumWithStrings = z.enum([ 105 + 'Success', 106 + 'Warning', 107 + 'Error', 108 + "'Single Quote'", 109 + '"Double Quotes"', 110 + 'Non-ascii: øæåôöØÆÅÔÖ字符串' 111 + ]); 112 + 113 + export const zEnumWithReplacedCharacters = z.enum([ 114 + "'Single Quote'", 115 + '"Double Quotes"', 116 + 'øæåôöØÆÅÔÖ字符串', 117 + '' 118 + ]); 119 + 120 + /** 121 + * This is a simple enum with numbers 122 + */ 123 + export const zEnumWithNumbers = z.unknown(); 124 + 125 + /** 126 + * Success=1,Warning=2,Error=3 127 + */ 128 + export const zEnumFromDescription = z.number(); 129 + 130 + /** 131 + * This is a simple enum with numbers 132 + */ 133 + export const zEnumWithExtensions = z.unknown(); 134 + 135 + export const zEnumWithXEnumNames = z.unknown(); 136 + 137 + /** 138 + * This is a simple array with numbers 139 + */ 140 + export const zArrayWithNumbers = z.array(z.number().int()); 141 + 142 + /** 143 + * This is a simple array with booleans 144 + */ 145 + export const zArrayWithBooleans = z.array(z.boolean()); 146 + 147 + /** 148 + * This is a simple array with strings 149 + */ 150 + export const zArrayWithStrings = z.array(z.string()).default(['test']); 151 + 152 + /** 153 + * This is a simple array with references 154 + */ 155 + export const zArrayWithReferences = z.array(zModelWithString); 156 + 157 + /** 158 + * This is a simple array containing an array 159 + */ 160 + export const zArrayWithArray = z.array(z.array(zModelWithString)); 161 + 162 + /** 163 + * This is a simple array with properties 164 + */ 165 + export const zArrayWithProperties = z.array(z.object({ 166 + '16x16': zCamelCaseCommentWithBreaks.optional(), 167 + bar: z.string().optional() 168 + })); 169 + 170 + /** 171 + * This is a simple array with any of properties 172 + */ 173 + export const zArrayWithAnyOfProperties = z.array(z.union([ 174 + z.object({ 175 + foo: z.string().optional().default('test') 176 + }), 177 + z.object({ 178 + bar: z.string().optional() 179 + }) 180 + ])); 181 + 182 + export const zAnyOfAnyAndNull = z.object({ 183 + data: z.unknown().optional() 184 + }); 185 + 186 + /** 187 + * This is a simple array with any of properties 188 + */ 189 + export const zAnyOfArrays = z.object({ 190 + results: z.array(z.union([ 191 + z.object({ 192 + foo: z.string().optional() 193 + }), 194 + z.object({ 195 + bar: z.string().optional() 196 + }) 197 + ])).optional() 198 + }); 199 + 200 + /** 201 + * This is a string dictionary 202 + */ 203 + export const zDictionaryWithString = z.object({}); 204 + 205 + export const zDictionaryWithPropertiesAndAdditionalProperties = z.object({ 206 + foo: z.number().optional(), 207 + bar: z.boolean().optional() 208 + }); 209 + 210 + /** 211 + * This is a string reference 212 + */ 213 + export const zDictionaryWithReference = z.object({}); 214 + 215 + /** 216 + * This is a complex dictionary 217 + */ 218 + export const zDictionaryWithArray = z.object({}); 219 + 220 + /** 221 + * This is a string dictionary 222 + */ 223 + export const zDictionaryWithDictionary = z.record(z.object({})); 224 + 225 + /** 226 + * This is a complex dictionary 227 + */ 228 + export const zDictionaryWithProperties = z.record(z.object({ 229 + foo: z.string().optional(), 230 + bar: z.string().optional() 231 + })); 232 + 233 + /** 234 + * This is a model with one number property 235 + */ 236 + export const zModelWithInteger = z.object({ 237 + prop: z.number().int().optional() 238 + }); 239 + 240 + /** 241 + * This is a model with one boolean property 242 + */ 243 + export const zModelWithBoolean = z.object({ 244 + prop: z.boolean().optional() 245 + }); 246 + 247 + /** 248 + * This is a model with one string property 249 + */ 250 + export const zModelWithStringError = z.object({ 251 + prop: z.string().optional() 252 + }); 253 + 254 + /** 255 + * `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) 256 + */ 257 + export const zModelFromZendesk = z.string(); 258 + 259 + /** 260 + * This is a model with one string property 261 + */ 262 + export const zModelWithNullableString = z.object({ 263 + nullableProp1: z.union([ 264 + z.string(), 265 + z.null() 266 + ]).optional(), 267 + nullableRequiredProp1: z.union([ 268 + z.string(), 269 + z.null() 270 + ]), 271 + nullableProp2: z.union([ 272 + z.string(), 273 + z.null() 274 + ]).optional(), 275 + nullableRequiredProp2: z.union([ 276 + z.string(), 277 + z.null() 278 + ]), 279 + 'foo_bar-enum': z.enum([ 280 + 'Success', 281 + 'Warning', 282 + 'Error', 283 + 'ØÆÅ字符串' 284 + ]).optional() 285 + }); 286 + 287 + /** 288 + * This is a model with one enum 289 + */ 290 + export const zModelWithEnum = z.object({ 291 + 'foo_bar-enum': z.enum([ 292 + 'Success', 293 + 'Warning', 294 + 'Error', 295 + 'ØÆÅ字符串' 296 + ]).optional(), 297 + statusCode: z.enum([ 298 + '100', 299 + '200 FOO', 300 + '300 FOO_BAR', 301 + '400 foo-bar', 302 + '500 foo.bar', 303 + '600 foo&bar' 304 + ]).optional(), 305 + bool: z.unknown().optional() 306 + }); 307 + 308 + /** 309 + * This is a model with one enum with escaped name 310 + */ 311 + export const zModelWithEnumWithHyphen = z.object({ 312 + 'foo-bar-baz-qux': z.enum([ 313 + '3.0' 314 + ]).optional() 315 + }); 316 + 317 + /** 318 + * This is a model with one enum 319 + */ 320 + export const zModelWithEnumFromDescription = z.object({ 321 + test: z.number().int().optional() 322 + }); 323 + 324 + /** 325 + * This is a model with nested enums 326 + */ 327 + export const zModelWithNestedEnums = z.object({ 328 + dictionaryWithEnum: z.object({}).optional(), 329 + dictionaryWithEnumFromDescription: z.object({}).optional(), 330 + arrayWithEnum: z.array(z.enum([ 331 + 'Success', 332 + 'Warning', 333 + 'Error' 334 + ])).optional(), 335 + arrayWithDescription: z.array(z.number().int()).optional(), 336 + 'foo_bar-enum': z.enum([ 337 + 'Success', 338 + 'Warning', 339 + 'Error', 340 + 'ØÆÅ字符串' 341 + ]).optional() 342 + }); 343 + 344 + /** 345 + * This is a model with one nested property 346 + */ 347 + export const zModelWithProperties = z.object({ 348 + required: z.string(), 349 + requiredAndReadOnly: z.string().readonly(), 350 + requiredAndNullable: z.union([ 351 + z.string(), 352 + z.null() 353 + ]), 354 + string: z.string().optional(), 355 + number: z.number().optional(), 356 + boolean: z.boolean().optional(), 357 + reference: zModelWithString.optional(), 358 + 'property with space': z.string().optional(), 359 + default: z.string().optional(), 360 + try: z.string().optional(), 361 + '@namespace.string': z.string().readonly().optional(), 362 + '@namespace.integer': z.number().int().readonly().optional() 363 + }); 364 + 365 + /** 366 + * This is a model with one property containing a reference 367 + */ 368 + export const zModelWithReference = z.object({ 369 + prop: zModelWithProperties.optional() 370 + }); 371 + 372 + export const zModelWithReadOnlyAndWriteOnly = z.object({ 373 + foo: z.string(), 374 + bar: z.string().readonly() 375 + }); 376 + 377 + /** 378 + * This is a model with one property containing an array 379 + */ 380 + export const zModelWithArrayReadOnlyAndWriteOnly = z.object({ 381 + prop: z.array(zModelWithReadOnlyAndWriteOnly).optional(), 382 + propWithFile: z.array(z.string()).optional(), 383 + propWithNumber: z.array(z.number()).optional() 384 + }); 385 + 386 + /** 387 + * This is a model with one property containing an array 388 + */ 389 + export const zModelWithArray = z.object({ 390 + prop: z.array(zModelWithString).optional(), 391 + propWithFile: z.array(z.string()).optional(), 392 + propWithNumber: z.array(z.number()).optional() 393 + }); 394 + 395 + /** 396 + * This is a model with one property containing a dictionary 397 + */ 398 + export const zModelWithDictionary = z.object({ 399 + prop: z.object({}).optional() 400 + }); 401 + 402 + /** 403 + * This is a deprecated model with a deprecated property 404 + * @deprecated 405 + */ 406 + export const zDeprecatedModel = z.object({ 407 + prop: z.string().optional() 408 + }); 409 + 410 + /** 411 + * This is a model with one property containing a circular reference 412 + */ 413 + export const zModelWithCircularReference: z.AnyZodObject = z.object({ 414 + prop: z.lazy(() => { 415 + return zModelWithCircularReference; 416 + }).optional() 417 + }); 418 + 419 + /** 420 + * This is a model with one property with a 'one of' relationship 421 + */ 422 + export const zCompositionWithOneOf = z.object({ 423 + propA: z.union([ 424 + zModelWithString, 425 + zModelWithEnum, 426 + zModelWithArray, 427 + zModelWithDictionary 428 + ]).optional() 429 + }); 430 + 431 + /** 432 + * This is a model with one property with a 'one of' relationship where the options are not $ref 433 + */ 434 + export const zCompositionWithOneOfAnonymous = z.object({ 435 + propA: z.union([ 436 + z.object({ 437 + propA: z.string().optional() 438 + }), 439 + z.string(), 440 + z.number().int() 441 + ]).optional() 442 + }); 443 + 444 + /** 445 + * Circle 446 + */ 447 + export const zModelCircle = z.object({ 448 + kind: z.string(), 449 + radius: z.number().optional() 450 + }); 451 + 452 + /** 453 + * Square 454 + */ 455 + export const zModelSquare = z.object({ 456 + kind: z.string(), 457 + sideLength: z.number().optional() 458 + }); 459 + 460 + /** 461 + * This is a model with one property with a 'one of' relationship where the options are not $ref 462 + */ 463 + export const zCompositionWithOneOfDiscriminator = z.union([ 464 + z.object({ 465 + kind: z.literal('circle') 466 + }).and(zModelCircle), 467 + z.object({ 468 + kind: z.literal('square') 469 + }).and(zModelSquare) 470 + ]); 471 + 472 + /** 473 + * This is a model with one property with a 'any of' relationship 474 + */ 475 + export const zCompositionWithAnyOf = z.object({ 476 + propA: z.union([ 477 + zModelWithString, 478 + zModelWithEnum, 479 + zModelWithArray, 480 + zModelWithDictionary 481 + ]).optional() 482 + }); 483 + 484 + /** 485 + * This is a model with one property with a 'any of' relationship where the options are not $ref 486 + */ 487 + export const zCompositionWithAnyOfAnonymous = z.object({ 488 + propA: z.union([ 489 + z.object({ 490 + propA: z.string().optional() 491 + }), 492 + z.string(), 493 + z.number().int() 494 + ]).optional() 495 + }); 496 + 497 + /** 498 + * This is a model with nested 'any of' property with a type null 499 + */ 500 + export const zCompositionWithNestedAnyAndTypeNull = z.object({ 501 + propA: z.union([ 502 + z.array(z.union([ 503 + zModelWithDictionary, 504 + z.null() 505 + ])), 506 + z.array(z.union([ 507 + zModelWithArray, 508 + z.null() 509 + ])) 510 + ]).optional() 511 + }); 512 + 513 + export const z3eNum1Период = z.enum([ 514 + 'Bird', 515 + 'Dog' 516 + ]); 517 + 518 + export const zConstValue = z.enum([ 519 + 'ConstValue' 520 + ]); 521 + 522 + /** 523 + * This is a model with one property with a 'any of' relationship where the options are not $ref 524 + */ 525 + export const zCompositionWithNestedAnyOfAndNull = z.object({ 526 + propA: z.union([ 527 + z.array(z.union([ 528 + z3eNum1Период, 529 + zConstValue 530 + ])), 531 + z.null() 532 + ]).optional() 533 + }); 534 + 535 + /** 536 + * This is a model with one property with a 'one of' relationship 537 + */ 538 + export const zCompositionWithOneOfAndNullable = z.object({ 539 + propA: z.union([ 540 + z.object({ 541 + boolean: z.boolean().optional() 542 + }), 543 + zModelWithEnum, 544 + zModelWithArray, 545 + zModelWithDictionary, 546 + z.null() 547 + ]).optional() 548 + }); 549 + 550 + /** 551 + * This is a model that contains a simple dictionary within composition 552 + */ 553 + export const zCompositionWithOneOfAndSimpleDictionary = z.object({ 554 + propA: z.union([ 555 + z.boolean(), 556 + z.object({}) 557 + ]).optional() 558 + }); 559 + 560 + /** 561 + * This is a model that contains a dictionary of simple arrays within composition 562 + */ 563 + export const zCompositionWithOneOfAndSimpleArrayDictionary = z.object({ 564 + propA: z.union([ 565 + z.boolean(), 566 + z.object({}) 567 + ]).optional() 568 + }); 569 + 570 + /** 571 + * This is a model that contains a dictionary of complex arrays (composited) within composition 572 + */ 573 + export const zCompositionWithOneOfAndComplexArrayDictionary = z.object({ 574 + propA: z.union([ 575 + z.boolean(), 576 + z.object({}) 577 + ]).optional() 578 + }); 579 + 580 + /** 581 + * This is a model with one property with a 'all of' relationship 582 + */ 583 + export const zCompositionWithAllOfAndNullable = z.object({ 584 + propA: z.union([ 585 + z.object({ 586 + boolean: z.boolean().optional() 587 + }).and(zModelWithEnum).and(zModelWithArray).and(zModelWithDictionary), 588 + z.null() 589 + ]).optional() 590 + }); 591 + 592 + /** 593 + * This is a model with one property with a 'any of' relationship 594 + */ 595 + export const zCompositionWithAnyOfAndNullable = z.object({ 596 + propA: z.union([ 597 + z.object({ 598 + boolean: z.boolean().optional() 599 + }), 600 + zModelWithEnum, 601 + zModelWithArray, 602 + zModelWithDictionary, 603 + z.null() 604 + ]).optional() 605 + }); 606 + 607 + /** 608 + * This is a base model with two simple optional properties 609 + */ 610 + export const zCompositionBaseModel = z.object({ 611 + firstName: z.string().optional(), 612 + lastname: z.string().optional() 613 + }); 614 + 615 + /** 616 + * This is a model that extends the base model 617 + */ 618 + export const zCompositionExtendedModel = zCompositionBaseModel.and(z.object({ 619 + age: z.number(), 620 + firstName: z.string(), 621 + lastname: z.string() 622 + })); 623 + 624 + /** 625 + * This is a model with one nested property 626 + */ 627 + export const zModelWithNestedProperties = z.object({ 628 + first: z.union([ 629 + z.object({ 630 + second: z.union([ 631 + z.object({ 632 + third: z.union([ 633 + z.string().readonly(), 634 + z.null() 635 + ]).readonly() 636 + }).readonly(), 637 + z.null() 638 + ]).readonly() 639 + }).readonly(), 640 + z.null() 641 + ]).readonly() 642 + }); 643 + 644 + /** 645 + * This is a model with duplicated properties 646 + */ 647 + export const zModelWithDuplicateProperties = z.object({ 648 + prop: zModelWithString.optional() 649 + }); 650 + 651 + /** 652 + * This is a model with ordered properties 653 + */ 654 + export const zModelWithOrderedProperties = z.object({ 655 + zebra: z.string().optional(), 656 + apple: z.string().optional(), 657 + hawaii: z.string().optional() 658 + }); 659 + 660 + /** 661 + * This is a model with duplicated imports 662 + */ 663 + export const zModelWithDuplicateImports = z.object({ 664 + propA: zModelWithString.optional(), 665 + propB: zModelWithString.optional(), 666 + propC: zModelWithString.optional() 667 + }); 668 + 669 + /** 670 + * This is a model that extends another model 671 + */ 672 + export const zModelThatExtends = zModelWithString.and(z.object({ 673 + propExtendsA: z.string().optional(), 674 + propExtendsB: zModelWithString.optional() 675 + })); 676 + 677 + /** 678 + * This is a model that extends another model 679 + */ 680 + export const zModelThatExtendsExtends = zModelWithString.and(zModelThatExtends).and(z.object({ 681 + propExtendsC: z.string().optional(), 682 + propExtendsD: zModelWithString.optional() 683 + })); 684 + 685 + /** 686 + * This is a model that contains a some patterns 687 + */ 688 + export const zModelWithPattern = z.object({ 689 + key: z.string().max(64).regex(/^[a-zA-Z0-9_]*$/), 690 + name: z.string().max(255), 691 + enabled: z.boolean().readonly().optional(), 692 + modified: z.string().datetime().readonly().optional(), 693 + id: z.string().regex(/^\d{2}-\d{3}-\d{4}$/).optional(), 694 + text: z.string().regex(/^\w+$/).optional(), 695 + patternWithSingleQuotes: z.string().regex(/^[a-zA-Z0-9']*$/).optional(), 696 + patternWithNewline: z.string().regex(/aaa\nbbb/).optional(), 697 + patternWithBacktick: z.string().regex(/aaa`bbb/).optional() 698 + }); 699 + 700 + export const zFile = z.object({ 701 + id: z.string().min(1).readonly().optional(), 702 + updated_at: z.string().datetime().readonly().optional(), 703 + created_at: z.string().datetime().readonly().optional(), 704 + mime: z.string().min(1).max(24), 705 + file: z.string().url().readonly().optional() 706 + }); 707 + 708 + export const zDefault = z.object({ 709 + name: z.string().optional() 710 + }); 711 + 712 + export const zPageable = z.object({ 713 + page: z.number().int().gte(0).optional().default(0), 714 + size: z.number().int().gte(1).optional(), 715 + sort: z.array(z.string()).optional() 716 + }); 717 + 718 + /** 719 + * This is a free-form object without additionalProperties. 720 + */ 721 + export const zFreeFormObjectWithoutAdditionalProperties = z.object({}); 722 + 723 + /** 724 + * This is a free-form object with additionalProperties: true. 725 + */ 726 + export const zFreeFormObjectWithAdditionalPropertiesEqTrue = z.object({}); 727 + 728 + /** 729 + * This is a free-form object with additionalProperties: {}. 730 + */ 731 + export const zFreeFormObjectWithAdditionalPropertiesEqEmptyObject = z.object({}); 732 + 733 + export const zModelWithConst = z.object({ 734 + String: z.enum([ 735 + 'String' 736 + ]).optional(), 737 + number: z.unknown().optional(), 738 + null: z.unknown().optional(), 739 + withType: z.enum([ 740 + 'Some string' 741 + ]).optional() 742 + }); 743 + 744 + /** 745 + * This is a model with one property and additionalProperties: true 746 + */ 747 + export const zModelWithAdditionalPropertiesEqTrue = z.object({ 748 + prop: z.string().optional() 749 + }); 750 + 751 + export const zNestedAnyOfArraysNullable = z.object({ 752 + nullableArray: z.union([ 753 + z.array(z.union([ 754 + z.string(), 755 + z.boolean() 756 + ])), 757 + z.null() 758 + ]).optional() 759 + }); 760 + 761 + /** 762 + * This is a reusable parameter 763 + */ 764 + export const zSimpleParameter = z.unknown(); 765 + 766 + export const zCompositionWithOneOfAndProperties = z.intersection(z.union([ 767 + z.object({ 768 + foo: zSimpleParameter 769 + }), 770 + z.object({ 771 + bar: zNonAsciiStringæøåÆøÅöôêÊ字符串 772 + }) 773 + ]), z.object({ 774 + baz: z.union([ 775 + z.number().int().gte(0), 776 + z.null() 777 + ]), 778 + qux: z.number().int().gte(0) 779 + })); 780 + 781 + /** 782 + * An object that can be null 783 + */ 784 + export const zNullableObject = z.union([ 785 + z.object({ 786 + foo: z.string().optional() 787 + }), 788 + z.null() 789 + ]).default(null); 790 + 791 + /** 792 + * Some % character 793 + */ 794 + export const zCharactersInDescription = z.string(); 795 + 796 + export const zModelWithNullableObject = z.object({ 797 + data: zNullableObject.optional() 798 + }); 799 + 800 + export const zModelWithOneOfEnum = z.union([ 801 + z.object({ 802 + foo: z.enum([ 803 + 'Bar' 804 + ]) 805 + }), 806 + z.object({ 807 + foo: z.enum([ 808 + 'Baz' 809 + ]) 810 + }), 811 + z.object({ 812 + foo: z.enum([ 813 + 'Qux' 814 + ]) 815 + }), 816 + z.object({ 817 + content: z.string().datetime(), 818 + foo: z.enum([ 819 + 'Quux' 820 + ]) 821 + }), 822 + z.object({ 823 + content: z.tuple([ 824 + z.string().datetime(), 825 + z.string().datetime() 826 + ]), 827 + foo: z.enum([ 828 + 'Corge' 829 + ]) 830 + }) 831 + ]); 832 + 833 + export const zModelWithNestedArrayEnumsDataFoo = z.enum([ 834 + 'foo', 835 + 'bar' 836 + ]); 837 + 838 + export const zModelWithNestedArrayEnumsDataBar = z.enum([ 839 + 'baz', 840 + 'qux' 841 + ]); 842 + 843 + export const zModelWithNestedArrayEnumsData = z.object({ 844 + foo: z.array(zModelWithNestedArrayEnumsDataFoo).optional(), 845 + bar: z.array(zModelWithNestedArrayEnumsDataBar).optional() 846 + }); 847 + 848 + export const zModelWithNestedArrayEnums = z.object({ 849 + array_strings: z.array(z.string()).optional(), 850 + data: zModelWithNestedArrayEnumsData.optional() 851 + }); 852 + 853 + export const zModelWithNestedCompositionEnums = z.object({ 854 + foo: zModelWithNestedArrayEnumsDataFoo.optional() 855 + }); 856 + 857 + export const zModelWithConstantSizeArray = z.tuple([ 858 + z.number(), 859 + z.number() 860 + ]); 861 + 862 + export const zModelWithAnyOfConstantSizeArray = z.tuple([ 863 + z.union([ 864 + z.number(), 865 + z.string() 866 + ]), 867 + z.union([ 868 + z.number(), 869 + z.string() 870 + ]), 871 + z.union([ 872 + z.number(), 873 + z.string() 874 + ]) 875 + ]); 876 + 877 + export const zModelWithPrefixItemsConstantSizeArray = z.array(z.union([ 878 + zModelWithInteger, 879 + z.number(), 880 + z.string() 881 + ])); 882 + 883 + export const zModelWithAnyOfConstantSizeArrayNullable = z.tuple([ 884 + z.union([ 885 + z.number(), 886 + z.null(), 887 + z.string() 888 + ]), 889 + z.union([ 890 + z.number(), 891 + z.null(), 892 + z.string() 893 + ]), 894 + z.union([ 895 + z.number(), 896 + z.null(), 897 + z.string() 898 + ]) 899 + ]); 900 + 901 + /** 902 + * Model with restricted keyword name 903 + */ 904 + export const zImport = z.string(); 905 + 906 + export const zModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = z.tuple([ 907 + z.union([ 908 + z.number(), 909 + zImport 910 + ]), 911 + z.union([ 912 + z.number(), 913 + zImport 914 + ]) 915 + ]); 916 + 917 + export const zModelWithAnyOfConstantSizeArrayAndIntersect = z.tuple([ 918 + z.intersection(z.number(), z.string()), 919 + z.intersection(z.number(), z.string()) 920 + ]); 921 + 922 + export const zModelWithNumericEnumUnion = z.object({ 923 + value: z.unknown().optional() 924 + }); 925 + 926 + /** 927 + * Some description with `back ticks` 928 + */ 929 + export const zModelWithBackticksInDescription = z.object({ 930 + template: z.string().optional() 931 + }); 932 + 933 + export const zModelWithOneOfAndProperties = z.intersection(z.union([ 934 + zSimpleParameter, 935 + zNonAsciiStringæøåÆøÅöôêÊ字符串 936 + ]), z.object({ 937 + baz: z.union([ 938 + z.number().int().gte(0), 939 + z.null() 940 + ]), 941 + qux: z.number().int().gte(0) 942 + })); 943 + 944 + /** 945 + * Model used to test deduplication strategy (unused) 946 + */ 947 + export const zParameterSimpleParameterUnused = z.string(); 948 + 949 + /** 950 + * Model used to test deduplication strategy 951 + */ 952 + export const zPostServiceWithEmptyTagResponse = z.string(); 953 + 954 + /** 955 + * Model used to test deduplication strategy 956 + */ 957 + export const zPostServiceWithEmptyTagResponse2 = z.string(); 958 + 959 + /** 960 + * Model used to test deduplication strategy 961 + */ 962 + export const zDeleteFooData = z.string(); 963 + 964 + /** 965 + * Model used to test deduplication strategy 966 + */ 967 + export const zDeleteFooData2 = z.string(); 968 + 969 + export const zSchemaWithFormRestrictedKeys = z.object({ 970 + description: z.string().optional(), 971 + 'x-enum-descriptions': z.string().optional(), 972 + 'x-enum-varnames': z.string().optional(), 973 + 'x-enumNames': z.string().optional(), 974 + title: z.string().optional(), 975 + object: z.object({ 976 + description: z.string().optional(), 977 + 'x-enum-descriptions': z.string().optional(), 978 + 'x-enum-varnames': z.string().optional(), 979 + 'x-enumNames': z.string().optional(), 980 + title: z.string().optional() 981 + }).optional(), 982 + array: z.array(z.object({ 983 + description: z.string().optional(), 984 + 'x-enum-descriptions': z.string().optional(), 985 + 'x-enum-varnames': z.string().optional(), 986 + 'x-enumNames': z.string().optional(), 987 + title: z.string().optional() 988 + })).optional() 989 + }); 990 + 991 + /** 992 + * This schema was giving PascalCase transformations a hard time 993 + */ 994 + export const zIoK8sApimachineryPkgApisMetaV1Preconditions = z.object({ 995 + resourceVersion: z.string().optional(), 996 + uid: z.string().optional() 997 + }); 998 + 999 + /** 1000 + * This schema was giving PascalCase transformations a hard time 1001 + */ 1002 + export const zIoK8sApimachineryPkgApisMetaV1DeleteOptions = z.object({ 1003 + preconditions: zIoK8sApimachineryPkgApisMetaV1Preconditions.optional() 1004 + }); 1005 + 1006 + export const zAdditionalPropertiesUnknownIssue = z.object({}); 1007 + 1008 + export const zAdditionalPropertiesUnknownIssue2 = z.object({}); 1009 + 1010 + export const zAdditionalPropertiesUnknownIssue3 = z.intersection(z.string(), z.object({ 1011 + entries: z.object({}) 1012 + })); 1013 + 1014 + export const zAdditionalPropertiesIntegerIssue = z.object({ 1015 + value: z.number().int() 1016 + }); 1017 + 1018 + export const zGenericSchemaDuplicateIssue1SystemBoolean = z.object({ 1019 + item: z.boolean().optional(), 1020 + error: z.union([ 1021 + z.string(), 1022 + z.null() 1023 + ]).optional(), 1024 + hasError: z.boolean().readonly().optional(), 1025 + data: z.object({}).optional() 1026 + }); 1027 + 1028 + export const zGenericSchemaDuplicateIssue1SystemString = z.object({ 1029 + item: z.union([ 1030 + z.string(), 1031 + z.null() 1032 + ]).optional(), 1033 + error: z.union([ 1034 + z.string(), 1035 + z.null() 1036 + ]).optional(), 1037 + hasError: z.boolean().readonly().optional() 1038 + }); 1039 + 1040 + export const zOneOfAllOfIssue = z.union([ 1041 + z.intersection(z.union([ 1042 + zConstValue, 1043 + zGenericSchemaDuplicateIssue1SystemBoolean 1044 + ]), z3eNum1Период), 1045 + zGenericSchemaDuplicateIssue1SystemString 1046 + ]); 1047 + 1048 + /** 1049 + * Model with number-only name 1050 + */ 1051 + export const z400Writable = z.string(); 1052 + 1053 + /** 1054 + * Testing multiline comments in string: First line 1055 + * Second line 1056 + * 1057 + * Fourth line 1058 + */ 1059 + export const zCamelCaseCommentWithBreaksWritable = z.number().int(); 1060 + 1061 + /** 1062 + * Testing multiline comments in string: First line 1063 + * Second line 1064 + * 1065 + * Fourth line 1066 + */ 1067 + export const zCommentWithBreaksWritable = z.number().int(); 1068 + 1069 + /** 1070 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1071 + */ 1072 + export const zCommentWithBackticksWritable = z.number().int(); 1073 + 1074 + /** 1075 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 1076 + */ 1077 + export const zCommentWithBackticksAndQuotesWritable = z.number().int(); 1078 + 1079 + /** 1080 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1081 + */ 1082 + export const zCommentWithSlashesWritable = z.number().int(); 1083 + 1084 + /** 1085 + * Testing expression placeholders in string: ${expression} should work 1086 + */ 1087 + export const zCommentWithExpressionPlaceholdersWritable = z.number().int(); 1088 + 1089 + /** 1090 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1091 + */ 1092 + export const zCommentWithQuotesWritable = z.number().int(); 1093 + 1094 + /** 1095 + * Testing reserved characters in string: * inline * and ** inline ** should work 1096 + */ 1097 + export const zCommentWithReservedCharactersWritable = z.number().int(); 1098 + 1099 + /** 1100 + * This is a simple number 1101 + */ 1102 + export const zSimpleIntegerWritable = z.number().int(); 1103 + 1104 + /** 1105 + * This is a simple boolean 1106 + */ 1107 + export const zSimpleBooleanWritable = z.boolean(); 1108 + 1109 + /** 1110 + * This is a simple string 1111 + */ 1112 + export const zSimpleStringWritable = z.string(); 1113 + 1114 + /** 1115 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 1116 + */ 1117 + export const zNonAsciiStringæøåÆøÅöôêÊ字符串Writable = z.string(); 1118 + 1119 + /** 1120 + * This is a simple file 1121 + */ 1122 + export const zSimpleFileWritable = z.string(); 1123 + 1124 + /** 1125 + * This is a simple string 1126 + */ 1127 + export const zSimpleStringWithPatternWritable = z.union([ 1128 + z.string().max(64).regex(/^[a-zA-Z0-9_]*$/), 1129 + z.null() 1130 + ]); 1131 + 1132 + /** 1133 + * This is a simple enum with strings 1134 + */ 1135 + export const zEnumWithStringsWritable = z.enum([ 1136 + 'Success', 1137 + 'Warning', 1138 + 'Error', 1139 + "'Single Quote'", 1140 + '"Double Quotes"', 1141 + 'Non-ascii: øæåôöØÆÅÔÖ字符串' 1142 + ]); 1143 + 1144 + export const zEnumWithReplacedCharactersWritable = z.enum([ 1145 + "'Single Quote'", 1146 + '"Double Quotes"', 1147 + 'øæåôöØÆÅÔÖ字符串', 1148 + '' 1149 + ]); 1150 + 1151 + /** 1152 + * This is a simple enum with numbers 1153 + */ 1154 + export const zEnumWithNumbersWritable = z.unknown(); 1155 + 1156 + /** 1157 + * Success=1,Warning=2,Error=3 1158 + */ 1159 + export const zEnumFromDescriptionWritable = z.number(); 1160 + 1161 + /** 1162 + * This is a simple enum with numbers 1163 + */ 1164 + export const zEnumWithExtensionsWritable = z.unknown(); 1165 + 1166 + export const zEnumWithXEnumNamesWritable = z.unknown(); 1167 + 1168 + /** 1169 + * This is a simple array with numbers 1170 + */ 1171 + export const zArrayWithNumbersWritable = z.array(z.number().int()); 1172 + 1173 + /** 1174 + * This is a simple array with booleans 1175 + */ 1176 + export const zArrayWithBooleansWritable = z.array(z.boolean()); 1177 + 1178 + /** 1179 + * This is a simple array with strings 1180 + */ 1181 + export const zArrayWithStringsWritable = z.array(z.string()).default(['test']); 1182 + 1183 + /** 1184 + * This is a string dictionary 1185 + */ 1186 + export const zDictionaryWithStringWritable = z.object({}); 1187 + 1188 + /** 1189 + * This is a string dictionary 1190 + */ 1191 + export const zDictionaryWithDictionaryWritable = z.record(z.object({})); 1192 + 1193 + /** 1194 + * `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) 1195 + */ 1196 + export const zModelFromZendeskWritable = z.string(); 1197 + 1198 + export const zModelWithReadOnlyAndWriteOnlyWritable = z.object({ 1199 + foo: z.string(), 1200 + baz: z.string() 1201 + }); 1202 + 1203 + /** 1204 + * This is a model with one property containing an array 1205 + */ 1206 + export const zModelWithArrayReadOnlyAndWriteOnlyWritable = z.object({ 1207 + prop: z.array(zModelWithReadOnlyAndWriteOnlyWritable).optional(), 1208 + propWithFile: z.array(z.string()).optional(), 1209 + propWithNumber: z.array(z.number()).optional() 1210 + }); 1211 + 1212 + export const z3eNum1ПериодWritable = z.enum([ 1213 + 'Bird', 1214 + 'Dog' 1215 + ]); 1216 + 1217 + export const zConstValueWritable = z.enum([ 1218 + 'ConstValue' 1219 + ]); 1220 + 1221 + /** 1222 + * This is a free-form object without additionalProperties. 1223 + */ 1224 + export const zFreeFormObjectWithoutAdditionalPropertiesWritable = z.object({}); 1225 + 1226 + /** 1227 + * This is a free-form object with additionalProperties: true. 1228 + */ 1229 + export const zFreeFormObjectWithAdditionalPropertiesEqTrueWritable = z.object({}); 1230 + 1231 + /** 1232 + * This is a free-form object with additionalProperties: {}. 1233 + */ 1234 + export const zFreeFormObjectWithAdditionalPropertiesEqEmptyObjectWritable = z.object({}); 1235 + 1236 + /** 1237 + * Some % character 1238 + */ 1239 + export const zCharactersInDescriptionWritable = z.string(); 1240 + 1241 + export const zModelWithNestedArrayEnumsDataFooWritable = z.enum([ 1242 + 'foo', 1243 + 'bar' 1244 + ]); 1245 + 1246 + export const zModelWithNestedArrayEnumsDataBarWritable = z.enum([ 1247 + 'baz', 1248 + 'qux' 1249 + ]); 1250 + 1251 + export const zModelWithConstantSizeArrayWritable = z.tuple([ 1252 + z.number(), 1253 + z.number() 1254 + ]); 1255 + 1256 + export const zModelWithAnyOfConstantSizeArrayWritable = z.tuple([ 1257 + z.union([ 1258 + z.number(), 1259 + z.string() 1260 + ]), 1261 + z.union([ 1262 + z.number(), 1263 + z.string() 1264 + ]), 1265 + z.union([ 1266 + z.number(), 1267 + z.string() 1268 + ]) 1269 + ]); 1270 + 1271 + export const zModelWithAnyOfConstantSizeArrayNullableWritable = z.tuple([ 1272 + z.union([ 1273 + z.number(), 1274 + z.null(), 1275 + z.string() 1276 + ]), 1277 + z.union([ 1278 + z.number(), 1279 + z.null(), 1280 + z.string() 1281 + ]), 1282 + z.union([ 1283 + z.number(), 1284 + z.null(), 1285 + z.string() 1286 + ]) 1287 + ]); 1288 + 1289 + /** 1290 + * Model with restricted keyword name 1291 + */ 1292 + export const zImportWritable = z.string(); 1293 + 1294 + export const zModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = z.tuple([ 1295 + z.union([ 1296 + z.number(), 1297 + zImportWritable 1298 + ]), 1299 + z.union([ 1300 + z.number(), 1301 + zImportWritable 1302 + ]) 1303 + ]); 1304 + 1305 + export const zModelWithAnyOfConstantSizeArrayAndIntersectWritable = z.tuple([ 1306 + z.intersection(z.number(), z.string()), 1307 + z.intersection(z.number(), z.string()) 1308 + ]); 1309 + 1310 + /** 1311 + * Model used to test deduplication strategy (unused) 1312 + */ 1313 + export const zParameterSimpleParameterUnusedWritable = z.string(); 1314 + 1315 + /** 1316 + * Model used to test deduplication strategy 1317 + */ 1318 + export const zPostServiceWithEmptyTagResponseWritable = z.string(); 1319 + 1320 + /** 1321 + * Model used to test deduplication strategy 1322 + */ 1323 + export const zPostServiceWithEmptyTagResponse2Writable = z.string(); 1324 + 1325 + /** 1326 + * Model used to test deduplication strategy 1327 + */ 1328 + export const zDeleteFooDataWritable = z.string(); 1329 + 1330 + /** 1331 + * Model used to test deduplication strategy 1332 + */ 1333 + export const zDeleteFooData2Writable = z.string(); 1334 + 1335 + export const zAdditionalPropertiesUnknownIssueWritable = z.object({}); 1336 + 1337 + export const zAdditionalPropertiesUnknownIssue2Writable = z.object({}); 1338 + 1339 + export const zOneOfAllOfIssueWritable = z.union([ 1340 + z.intersection(z.union([ 1341 + zConstValueWritable, 1342 + zGenericSchemaDuplicateIssue1SystemBoolean 1343 + ]), z3eNum1Период), 1344 + zGenericSchemaDuplicateIssue1SystemString 1345 + ]); 1346 + 1347 + /** 1348 + * Parameter with illegal characters 1349 + */ 1350 + export const zXFooBar = zModelWithString; 1351 + 1352 + export const zSimpleRequestBody = zModelWithString; 1353 + 1354 + export const zSimpleFormData = zModelWithString; 1355 + 1356 + export const zExportData = z.object({ 1357 + body: z.never().optional(), 1358 + path: z.never().optional(), 1359 + query: z.never().optional() 1360 + }); 1361 + 1362 + export const zPatchApiVbyApiVersionNoTagData = z.object({ 1363 + body: z.never().optional(), 1364 + path: z.never().optional(), 1365 + query: z.never().optional() 1366 + }); 1367 + 1368 + export const zImportData = z.object({ 1369 + body: z.union([ 1370 + zModelWithReadOnlyAndWriteOnlyWritable, 1371 + zModelWithArrayReadOnlyAndWriteOnlyWritable 1372 + ]), 1373 + path: z.never().optional(), 1374 + query: z.never().optional() 1375 + }); 1376 + 1377 + export const zImportResponse = z.union([ 1378 + zModelFromZendesk, 1379 + zModelWithReadOnlyAndWriteOnly 1380 + ]); 1381 + 1382 + export const zFooWowData = z.object({ 1383 + body: z.never().optional(), 1384 + path: z.never().optional(), 1385 + query: z.never().optional() 1386 + }); 1387 + 1388 + export const zApiVVersionODataControllerCountData = z.object({ 1389 + body: z.never().optional(), 1390 + path: z.never().optional(), 1391 + query: z.never().optional() 1392 + }); 1393 + 1394 + /** 1395 + * Success 1396 + */ 1397 + export const zApiVVersionODataControllerCountResponse = zModelFromZendesk; 1398 + 1399 + export const zGetApiVbyApiVersionSimpleOperationData = z.object({ 1400 + body: z.never().optional(), 1401 + path: z.object({ 1402 + foo_param: z.string() 1403 + }), 1404 + query: z.never().optional() 1405 + }); 1406 + 1407 + /** 1408 + * Response is a simple number 1409 + */ 1410 + export const zGetApiVbyApiVersionSimpleOperationResponse = z.number(); 1411 + 1412 + export const zDeleteCallWithoutParametersAndResponseData = z.object({ 1413 + body: z.never().optional(), 1414 + path: z.never().optional(), 1415 + query: z.never().optional() 1416 + }); 1417 + 1418 + export const zGetCallWithoutParametersAndResponseData = z.object({ 1419 + body: z.never().optional(), 1420 + path: z.never().optional(), 1421 + query: z.never().optional() 1422 + }); 1423 + 1424 + export const zHeadCallWithoutParametersAndResponseData = z.object({ 1425 + body: z.never().optional(), 1426 + path: z.never().optional(), 1427 + query: z.never().optional() 1428 + }); 1429 + 1430 + export const zOptionsCallWithoutParametersAndResponseData = z.object({ 1431 + body: z.never().optional(), 1432 + path: z.never().optional(), 1433 + query: z.never().optional() 1434 + }); 1435 + 1436 + export const zPatchCallWithoutParametersAndResponseData = z.object({ 1437 + body: z.never().optional(), 1438 + path: z.never().optional(), 1439 + query: z.never().optional() 1440 + }); 1441 + 1442 + export const zPostCallWithoutParametersAndResponseData = z.object({ 1443 + body: z.never().optional(), 1444 + path: z.never().optional(), 1445 + query: z.never().optional() 1446 + }); 1447 + 1448 + export const zPutCallWithoutParametersAndResponseData = z.object({ 1449 + body: z.never().optional(), 1450 + path: z.never().optional(), 1451 + query: z.never().optional() 1452 + }); 1453 + 1454 + export const zDeleteFooData3 = z.object({ 1455 + body: z.never().optional(), 1456 + path: z.object({ 1457 + foo_param: z.string(), 1458 + BarParam: z.string() 1459 + }), 1460 + query: z.never().optional(), 1461 + headers: z.object({ 1462 + 'x-Foo-Bar': zModelWithString 1463 + }) 1464 + }); 1465 + 1466 + export const zCallWithDescriptionsData = z.object({ 1467 + body: z.never().optional(), 1468 + path: z.never().optional(), 1469 + query: z.object({ 1470 + parameterWithBreaks: z.string().optional(), 1471 + parameterWithBackticks: z.string().optional(), 1472 + parameterWithSlashes: z.string().optional(), 1473 + parameterWithExpressionPlaceholders: z.string().optional(), 1474 + parameterWithQuotes: z.string().optional(), 1475 + parameterWithReservedCharacters: z.string().optional() 1476 + }).optional() 1477 + }); 1478 + 1479 + export const zDeprecatedCallData = z.object({ 1480 + body: z.never().optional(), 1481 + path: z.never().optional(), 1482 + query: z.never().optional(), 1483 + headers: z.object({ 1484 + parameter: z.union([ 1485 + zDeprecatedModel, 1486 + z.null() 1487 + ]) 1488 + }) 1489 + }); 1490 + 1491 + export const zCallWithParametersData = z.object({ 1492 + body: z.union([ 1493 + z.object({}), 1494 + z.null() 1495 + ]), 1496 + path: z.object({ 1497 + parameterPath: z.union([ 1498 + z.string(), 1499 + z.null() 1500 + ]), 1501 + 'api-version': z.union([ 1502 + z.string(), 1503 + z.null() 1504 + ]) 1505 + }), 1506 + query: z.object({ 1507 + foo_ref_enum: zModelWithNestedArrayEnumsDataFooWritable.optional(), 1508 + foo_all_of_enum: zModelWithNestedArrayEnumsDataFooWritable, 1509 + cursor: z.union([ 1510 + z.string(), 1511 + z.null() 1512 + ]) 1513 + }), 1514 + headers: z.object({ 1515 + parameterHeader: z.union([ 1516 + z.string(), 1517 + z.null() 1518 + ]) 1519 + }) 1520 + }); 1521 + 1522 + export const zCallWithWeirdParameterNamesData = z.object({ 1523 + body: z.union([ 1524 + zModelWithString, 1525 + z.null() 1526 + ]), 1527 + path: z.object({ 1528 + 'parameter.path.1': z.string().optional(), 1529 + 'parameter-path-2': z.string().optional(), 1530 + 'PARAMETER-PATH-3': z.string().optional(), 1531 + 'api-version': z.union([ 1532 + z.string(), 1533 + z.null() 1534 + ]) 1535 + }), 1536 + query: z.object({ 1537 + default: z.string().optional(), 1538 + 'parameter-query': z.union([ 1539 + z.string(), 1540 + z.null() 1541 + ]) 1542 + }), 1543 + headers: z.object({ 1544 + 'parameter.header': z.union([ 1545 + z.string(), 1546 + z.null() 1547 + ]) 1548 + }) 1549 + }); 1550 + 1551 + export const zGetCallWithOptionalParamData = z.object({ 1552 + body: zModelWithOneOfEnum, 1553 + path: z.never().optional(), 1554 + query: z.object({ 1555 + page: z.number().optional() 1556 + }).optional() 1557 + }); 1558 + 1559 + export const zPostCallWithOptionalParamData = z.object({ 1560 + body: z.object({ 1561 + offset: z.union([ 1562 + z.number(), 1563 + z.null() 1564 + ]).optional() 1565 + }).optional(), 1566 + path: z.never().optional(), 1567 + query: z.object({ 1568 + parameter: zPageable 1569 + }) 1570 + }); 1571 + 1572 + export const zPostCallWithOptionalParamResponse = z.union([ 1573 + z.number(), 1574 + z.void() 1575 + ]); 1576 + 1577 + export const zPostApiVbyApiVersionRequestBodyData = z.object({ 1578 + body: zSimpleRequestBody.optional(), 1579 + path: z.never().optional(), 1580 + query: z.object({ 1581 + parameter: z.string().optional() 1582 + }).optional() 1583 + }); 1584 + 1585 + export const zPostApiVbyApiVersionFormDataData = z.object({ 1586 + body: zSimpleFormData.optional(), 1587 + path: z.never().optional(), 1588 + query: z.object({ 1589 + parameter: z.string().optional() 1590 + }).optional() 1591 + }); 1592 + 1593 + export const zCallWithDefaultParametersData = z.object({ 1594 + body: z.never().optional(), 1595 + path: z.never().optional(), 1596 + query: z.object({ 1597 + parameterString: z.union([ 1598 + z.string().default('Hello World!'), 1599 + z.null() 1600 + ]).optional().default('Hello World!'), 1601 + parameterNumber: z.union([ 1602 + z.number().default(123), 1603 + z.null() 1604 + ]).optional().default(123), 1605 + parameterBoolean: z.union([ 1606 + z.boolean().default(true), 1607 + z.null() 1608 + ]).optional().default(true), 1609 + parameterEnum: z.enum([ 1610 + 'Success', 1611 + 'Warning', 1612 + 'Error' 1613 + ]).optional(), 1614 + parameterModel: z.union([ 1615 + zModelWithString, 1616 + z.null() 1617 + ]).optional() 1618 + }).optional() 1619 + }); 1620 + 1621 + export const zCallWithDefaultOptionalParametersData = z.object({ 1622 + body: z.never().optional(), 1623 + path: z.never().optional(), 1624 + query: z.object({ 1625 + parameterString: z.string().optional().default('Hello World!'), 1626 + parameterNumber: z.number().optional().default(123), 1627 + parameterBoolean: z.boolean().optional().default(true), 1628 + parameterEnum: z.enum([ 1629 + 'Success', 1630 + 'Warning', 1631 + 'Error' 1632 + ]).optional(), 1633 + parameterModel: zModelWithString.optional() 1634 + }).optional() 1635 + }); 1636 + 1637 + export const zCallToTestOrderOfParamsData = z.object({ 1638 + body: z.never().optional(), 1639 + path: z.never().optional(), 1640 + query: z.object({ 1641 + parameterOptionalStringWithDefault: z.string().optional().default('Hello World!'), 1642 + parameterOptionalStringWithEmptyDefault: z.string().optional().default(''), 1643 + parameterOptionalStringWithNoDefault: z.string().optional(), 1644 + parameterStringWithDefault: z.string().default('Hello World!'), 1645 + parameterStringWithEmptyDefault: z.string().default(''), 1646 + parameterStringWithNoDefault: z.string(), 1647 + parameterStringNullableWithNoDefault: z.union([ 1648 + z.string(), 1649 + z.null() 1650 + ]).optional(), 1651 + parameterStringNullableWithDefault: z.union([ 1652 + z.string(), 1653 + z.null() 1654 + ]).optional().default(null) 1655 + }) 1656 + }); 1657 + 1658 + export const zDuplicateNameData = z.object({ 1659 + body: z.never().optional(), 1660 + path: z.never().optional(), 1661 + query: z.never().optional() 1662 + }); 1663 + 1664 + export const zDuplicateName2Data = z.object({ 1665 + body: z.never().optional(), 1666 + path: z.never().optional(), 1667 + query: z.never().optional() 1668 + }); 1669 + 1670 + export const zDuplicateName3Data = z.object({ 1671 + body: z.never().optional(), 1672 + path: z.never().optional(), 1673 + query: z.never().optional() 1674 + }); 1675 + 1676 + export const zDuplicateName4Data = z.object({ 1677 + body: z.never().optional(), 1678 + path: z.never().optional(), 1679 + query: z.never().optional() 1680 + }); 1681 + 1682 + export const zCallWithNoContentResponseData = z.object({ 1683 + body: z.never().optional(), 1684 + path: z.never().optional(), 1685 + query: z.never().optional() 1686 + }); 1687 + 1688 + /** 1689 + * Success 1690 + */ 1691 + export const zCallWithNoContentResponseResponse = z.void(); 1692 + 1693 + export const zCallWithResponseAndNoContentResponseData = z.object({ 1694 + body: z.never().optional(), 1695 + path: z.never().optional(), 1696 + query: z.never().optional() 1697 + }); 1698 + 1699 + export const zCallWithResponseAndNoContentResponseResponse = z.union([ 1700 + z.number(), 1701 + z.void() 1702 + ]); 1703 + 1704 + export const zDummyAData = z.object({ 1705 + body: z.never().optional(), 1706 + path: z.never().optional(), 1707 + query: z.never().optional() 1708 + }); 1709 + 1710 + export const zDummyAResponse = z400; 1711 + 1712 + export const zDummyBData = z.object({ 1713 + body: z.never().optional(), 1714 + path: z.never().optional(), 1715 + query: z.never().optional() 1716 + }); 1717 + 1718 + /** 1719 + * Success 1720 + */ 1721 + export const zDummyBResponse = z.void(); 1722 + 1723 + export const zCallWithResponseData = z.object({ 1724 + body: z.never().optional(), 1725 + path: z.never().optional(), 1726 + query: z.never().optional() 1727 + }); 1728 + 1729 + export const zCallWithResponseResponse = zImport; 1730 + 1731 + export const zCallWithDuplicateResponsesData = z.object({ 1732 + body: z.never().optional(), 1733 + path: z.never().optional(), 1734 + query: z.never().optional() 1735 + }); 1736 + 1737 + export const zCallWithDuplicateResponsesResponse = z.union([ 1738 + zModelWithBoolean.and(zModelWithInteger), 1739 + zModelWithString 1740 + ]); 1741 + 1742 + export const zCallWithResponsesData = z.object({ 1743 + body: z.never().optional(), 1744 + path: z.never().optional(), 1745 + query: z.never().optional() 1746 + }); 1747 + 1748 + export const zCallWithResponsesResponse = z.union([ 1749 + z.object({ 1750 + '@namespace.string': z.string().readonly().optional(), 1751 + '@namespace.integer': z.number().int().readonly().optional(), 1752 + value: z.array(zModelWithString).readonly().optional() 1753 + }), 1754 + zModelThatExtends, 1755 + zModelThatExtendsExtends 1756 + ]); 1757 + 1758 + export const zCollectionFormatData = z.object({ 1759 + body: z.never().optional(), 1760 + path: z.never().optional(), 1761 + query: z.object({ 1762 + parameterArrayCSV: z.union([ 1763 + z.array(z.string()), 1764 + z.null() 1765 + ]), 1766 + parameterArraySSV: z.union([ 1767 + z.array(z.string()), 1768 + z.null() 1769 + ]), 1770 + parameterArrayTSV: z.union([ 1771 + z.array(z.string()), 1772 + z.null() 1773 + ]), 1774 + parameterArrayPipes: z.union([ 1775 + z.array(z.string()), 1776 + z.null() 1777 + ]), 1778 + parameterArrayMulti: z.union([ 1779 + z.array(z.string()), 1780 + z.null() 1781 + ]) 1782 + }) 1783 + }); 1784 + 1785 + export const zTypesData = z.object({ 1786 + body: z.never().optional(), 1787 + path: z.object({ 1788 + id: z.number().int().optional() 1789 + }).optional(), 1790 + query: z.object({ 1791 + parameterNumber: z.number().default(123), 1792 + parameterString: z.union([ 1793 + z.string().default('default'), 1794 + z.null() 1795 + ]).default('default'), 1796 + parameterBoolean: z.union([ 1797 + z.boolean().default(true), 1798 + z.null() 1799 + ]).default(true), 1800 + parameterObject: z.union([ 1801 + z.object({}), 1802 + z.null() 1803 + ]).default(null), 1804 + parameterArray: z.union([ 1805 + z.array(z.string()), 1806 + z.null() 1807 + ]), 1808 + parameterDictionary: z.union([ 1809 + z.object({}), 1810 + z.null() 1811 + ]), 1812 + parameterEnum: z.enum([ 1813 + 'Success', 1814 + 'Warning', 1815 + 'Error' 1816 + ]) 1817 + }) 1818 + }); 1819 + 1820 + export const zTypesResponse = z.union([ 1821 + z.number(), 1822 + z.string(), 1823 + z.boolean(), 1824 + z.object({}) 1825 + ]); 1826 + 1827 + export const zUploadFileData = z.object({ 1828 + body: z.string(), 1829 + path: z.object({ 1830 + 'api-version': z.union([ 1831 + z.string(), 1832 + z.null() 1833 + ]) 1834 + }), 1835 + query: z.never().optional() 1836 + }); 1837 + 1838 + export const zUploadFileResponse = z.boolean(); 1839 + 1840 + export const zFileResponseData = z.object({ 1841 + body: z.never().optional(), 1842 + path: z.object({ 1843 + id: z.string(), 1844 + 'api-version': z.string() 1845 + }), 1846 + query: z.never().optional() 1847 + }); 1848 + 1849 + /** 1850 + * Success 1851 + */ 1852 + export const zFileResponseResponse = z.string(); 1853 + 1854 + export const zComplexTypesData = z.object({ 1855 + body: z.never().optional(), 1856 + path: z.never().optional(), 1857 + query: z.object({ 1858 + parameterObject: z.object({ 1859 + first: z.object({ 1860 + second: z.object({ 1861 + third: z.string().optional() 1862 + }).optional() 1863 + }).optional() 1864 + }), 1865 + parameterReference: zModelWithString 1866 + }) 1867 + }); 1868 + 1869 + /** 1870 + * Successful response 1871 + */ 1872 + export const zComplexTypesResponse = z.array(zModelWithString); 1873 + 1874 + export const zMultipartResponseData = z.object({ 1875 + body: z.never().optional(), 1876 + path: z.never().optional(), 1877 + query: z.never().optional() 1878 + }); 1879 + 1880 + /** 1881 + * OK 1882 + */ 1883 + export const zMultipartResponseResponse = z.object({ 1884 + file: z.string().optional(), 1885 + metadata: z.object({ 1886 + foo: z.string().optional(), 1887 + bar: z.string().optional() 1888 + }).optional() 1889 + }); 1890 + 1891 + export const zMultipartRequestData = z.object({ 1892 + body: z.object({ 1893 + content: z.string().optional(), 1894 + data: z.union([ 1895 + zModelWithString, 1896 + z.null() 1897 + ]).optional() 1898 + }).optional(), 1899 + path: z.never().optional(), 1900 + query: z.never().optional() 1901 + }); 1902 + 1903 + export const zComplexParamsData = z.object({ 1904 + body: z.object({ 1905 + key: z.union([ 1906 + z.string().max(64).regex(/^[a-zA-Z0-9_]*$/).readonly(), 1907 + z.null() 1908 + ]).readonly(), 1909 + name: z.union([ 1910 + z.string().max(255), 1911 + z.null() 1912 + ]), 1913 + enabled: z.boolean().optional().default(true), 1914 + type: z.enum([ 1915 + 'Monkey', 1916 + 'Horse', 1917 + 'Bird' 1918 + ]), 1919 + listOfModels: z.union([ 1920 + z.array(zModelWithString), 1921 + z.null() 1922 + ]).optional(), 1923 + listOfStrings: z.union([ 1924 + z.array(z.string()), 1925 + z.null() 1926 + ]).optional(), 1927 + parameters: z.union([ 1928 + zModelWithString, 1929 + zModelWithEnum, 1930 + zModelWithArray, 1931 + zModelWithDictionary 1932 + ]), 1933 + user: z.object({ 1934 + id: z.number().int().readonly().optional(), 1935 + name: z.union([ 1936 + z.string().readonly(), 1937 + z.null() 1938 + ]).readonly().optional() 1939 + }).readonly().optional() 1940 + }).optional(), 1941 + path: z.object({ 1942 + id: z.number().int(), 1943 + 'api-version': z.string() 1944 + }), 1945 + query: z.never().optional() 1946 + }); 1947 + 1948 + /** 1949 + * Success 1950 + */ 1951 + export const zComplexParamsResponse = zModelWithString; 1952 + 1953 + export const zCallWithResultFromHeaderData = z.object({ 1954 + body: z.never().optional(), 1955 + path: z.never().optional(), 1956 + query: z.never().optional() 1957 + }); 1958 + 1959 + export const zTestErrorCodeData = z.object({ 1960 + body: z.never().optional(), 1961 + path: z.never().optional(), 1962 + query: z.object({ 1963 + status: z.number().int() 1964 + }) 1965 + }); 1966 + 1967 + export const zNonAsciiæøåÆøÅöôêÊ字符串Data = z.object({ 1968 + body: z.never().optional(), 1969 + path: z.never().optional(), 1970 + query: z.object({ 1971 + 'nonAsciiParamæøåÆØÅöôêÊ': z.number().int() 1972 + }) 1973 + }); 1974 + 1975 + /** 1976 + * Successful response 1977 + */ 1978 + export const zNonAsciiæøåÆøÅöôêÊ字符串Response = z.array(zNonAsciiStringæøåÆøÅöôêÊ字符串); 1979 + 1980 + export const zPutWithFormUrlEncodedData = z.object({ 1981 + body: zArrayWithStringsWritable, 1982 + path: z.never().optional(), 1983 + query: z.never().optional() 1984 + });
+18
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v3/enum-null/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod'; 4 + 5 + export const zFoo = z.enum([ 6 + 'foo', 7 + 'bar' 8 + ]).nullable(); 9 + 10 + export const zBar = z.enum([ 11 + 'foo', 12 + 'bar' 13 + ]); 14 + 15 + export const zBaz = z.enum([ 16 + 'foo', 17 + 'bar' 18 + ]);
+24
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v3/type-format-zod/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod'; 4 + 5 + export const zFoo = z.object({ 6 + bar: z.number().int().optional(), 7 + foo: z.coerce.bigint().default(BigInt(0)), 8 + id: z.string() 9 + }); 10 + 11 + export const zBar = z.object({ 12 + foo: z.number().int() 13 + }); 14 + 15 + export const zPostFooData = z.object({ 16 + body: z.never().optional(), 17 + path: z.never().optional(), 18 + query: z.never().optional() 19 + }); 20 + 21 + /** 22 + * OK 23 + */ 24 + export const zPostFooResponse = zFoo;
+23
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v3/validators/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod'; 4 + 5 + export const zBar: z.AnyZodObject = z.object({ 6 + foo: z.lazy(() => { 7 + return zFoo; 8 + }).optional() 9 + }); 10 + 11 + export const zFoo: z.ZodTypeAny = z.union([ 12 + z.object({ 13 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 14 + bar: zBar.optional(), 15 + baz: z.array(z.lazy(() => { 16 + return zFoo; 17 + })).optional(), 18 + qux: z.number().int().gt(0).optional().default(0) 19 + }), 20 + z.null() 21 + ]).default(null); 22 + 23 + export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz');
+9
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/array-items-one-of-length-1/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod/v4'; 4 + 5 + export const zBar = z.string(); 6 + 7 + export const zFoo = z.object({ 8 + foo: z.optional(z.array(zBar).min(1).max(2147483647)) 9 + });
+1984
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/default/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod/v4'; 4 + 5 + /** 6 + * Model with number-only name 7 + */ 8 + export const z400 = z.string(); 9 + 10 + /** 11 + * Testing multiline comments in string: First line 12 + * Second line 13 + * 14 + * Fourth line 15 + */ 16 + export const zCamelCaseCommentWithBreaks = z.int(); 17 + 18 + /** 19 + * Testing multiline comments in string: First line 20 + * Second line 21 + * 22 + * Fourth line 23 + */ 24 + export const zCommentWithBreaks = z.int(); 25 + 26 + /** 27 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 28 + */ 29 + export const zCommentWithBackticks = z.int(); 30 + 31 + /** 32 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 33 + */ 34 + export const zCommentWithBackticksAndQuotes = z.int(); 35 + 36 + /** 37 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 38 + */ 39 + export const zCommentWithSlashes = z.int(); 40 + 41 + /** 42 + * Testing expression placeholders in string: ${expression} should work 43 + */ 44 + export const zCommentWithExpressionPlaceholders = z.int(); 45 + 46 + /** 47 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 48 + */ 49 + export const zCommentWithQuotes = z.int(); 50 + 51 + /** 52 + * Testing reserved characters in string: * inline * and ** inline ** should work 53 + */ 54 + export const zCommentWithReservedCharacters = z.int(); 55 + 56 + /** 57 + * This is a simple number 58 + */ 59 + export const zSimpleInteger = z.int(); 60 + 61 + /** 62 + * This is a simple boolean 63 + */ 64 + export const zSimpleBoolean = z.boolean(); 65 + 66 + /** 67 + * This is a simple string 68 + */ 69 + export const zSimpleString = z.string(); 70 + 71 + /** 72 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 73 + */ 74 + export const zNonAsciiStringæøåÆøÅöôêÊ字符串 = z.string(); 75 + 76 + /** 77 + * This is a simple file 78 + */ 79 + export const zSimpleFile = z.string(); 80 + 81 + /** 82 + * This is a model with one string property 83 + */ 84 + export const zModelWithString = z.object({ 85 + prop: z.optional(z.string()) 86 + }); 87 + 88 + /** 89 + * This is a simple reference 90 + */ 91 + export const zSimpleReference = zModelWithString; 92 + 93 + /** 94 + * This is a simple string 95 + */ 96 + export const zSimpleStringWithPattern = z.union([ 97 + z.string().max(64).regex(/^[a-zA-Z0-9_]*$/), 98 + z.null() 99 + ]); 100 + 101 + /** 102 + * This is a simple enum with strings 103 + */ 104 + export const zEnumWithStrings = z.enum([ 105 + 'Success', 106 + 'Warning', 107 + 'Error', 108 + "'Single Quote'", 109 + '"Double Quotes"', 110 + 'Non-ascii: øæåôöØÆÅÔÖ字符串' 111 + ]); 112 + 113 + export const zEnumWithReplacedCharacters = z.enum([ 114 + "'Single Quote'", 115 + '"Double Quotes"', 116 + 'øæåôöØÆÅÔÖ字符串', 117 + '' 118 + ]); 119 + 120 + /** 121 + * This is a simple enum with numbers 122 + */ 123 + export const zEnumWithNumbers = z.unknown(); 124 + 125 + /** 126 + * Success=1,Warning=2,Error=3 127 + */ 128 + export const zEnumFromDescription = z.number(); 129 + 130 + /** 131 + * This is a simple enum with numbers 132 + */ 133 + export const zEnumWithExtensions = z.unknown(); 134 + 135 + export const zEnumWithXEnumNames = z.unknown(); 136 + 137 + /** 138 + * This is a simple array with numbers 139 + */ 140 + export const zArrayWithNumbers = z.array(z.int()); 141 + 142 + /** 143 + * This is a simple array with booleans 144 + */ 145 + export const zArrayWithBooleans = z.array(z.boolean()); 146 + 147 + /** 148 + * This is a simple array with strings 149 + */ 150 + export const zArrayWithStrings = z.array(z.string()).default(['test']); 151 + 152 + /** 153 + * This is a simple array with references 154 + */ 155 + export const zArrayWithReferences = z.array(zModelWithString); 156 + 157 + /** 158 + * This is a simple array containing an array 159 + */ 160 + export const zArrayWithArray = z.array(z.array(zModelWithString)); 161 + 162 + /** 163 + * This is a simple array with properties 164 + */ 165 + export const zArrayWithProperties = z.array(z.object({ 166 + '16x16': z.optional(zCamelCaseCommentWithBreaks), 167 + bar: z.optional(z.string()) 168 + })); 169 + 170 + /** 171 + * This is a simple array with any of properties 172 + */ 173 + export const zArrayWithAnyOfProperties = z.array(z.union([ 174 + z.object({ 175 + foo: z.optional(z.string()).default('test') 176 + }), 177 + z.object({ 178 + bar: z.optional(z.string()) 179 + }) 180 + ])); 181 + 182 + export const zAnyOfAnyAndNull = z.object({ 183 + data: z.optional(z.unknown()) 184 + }); 185 + 186 + /** 187 + * This is a simple array with any of properties 188 + */ 189 + export const zAnyOfArrays = z.object({ 190 + results: z.optional(z.array(z.union([ 191 + z.object({ 192 + foo: z.optional(z.string()) 193 + }), 194 + z.object({ 195 + bar: z.optional(z.string()) 196 + }) 197 + ]))) 198 + }); 199 + 200 + /** 201 + * This is a string dictionary 202 + */ 203 + export const zDictionaryWithString = z.object({}); 204 + 205 + export const zDictionaryWithPropertiesAndAdditionalProperties = z.object({ 206 + foo: z.optional(z.number()), 207 + bar: z.optional(z.boolean()) 208 + }); 209 + 210 + /** 211 + * This is a string reference 212 + */ 213 + export const zDictionaryWithReference = z.object({}); 214 + 215 + /** 216 + * This is a complex dictionary 217 + */ 218 + export const zDictionaryWithArray = z.object({}); 219 + 220 + /** 221 + * This is a string dictionary 222 + */ 223 + export const zDictionaryWithDictionary = z.record(z.string(), z.object({})); 224 + 225 + /** 226 + * This is a complex dictionary 227 + */ 228 + export const zDictionaryWithProperties = z.record(z.string(), z.object({ 229 + foo: z.optional(z.string()), 230 + bar: z.optional(z.string()) 231 + })); 232 + 233 + /** 234 + * This is a model with one number property 235 + */ 236 + export const zModelWithInteger = z.object({ 237 + prop: z.optional(z.int()) 238 + }); 239 + 240 + /** 241 + * This is a model with one boolean property 242 + */ 243 + export const zModelWithBoolean = z.object({ 244 + prop: z.optional(z.boolean()) 245 + }); 246 + 247 + /** 248 + * This is a model with one string property 249 + */ 250 + export const zModelWithStringError = z.object({ 251 + prop: z.optional(z.string()) 252 + }); 253 + 254 + /** 255 + * `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) 256 + */ 257 + export const zModelFromZendesk = z.string(); 258 + 259 + /** 260 + * This is a model with one string property 261 + */ 262 + export const zModelWithNullableString = z.object({ 263 + nullableProp1: z.optional(z.union([ 264 + z.string(), 265 + z.null() 266 + ])), 267 + nullableRequiredProp1: z.union([ 268 + z.string(), 269 + z.null() 270 + ]), 271 + nullableProp2: z.optional(z.union([ 272 + z.string(), 273 + z.null() 274 + ])), 275 + nullableRequiredProp2: z.union([ 276 + z.string(), 277 + z.null() 278 + ]), 279 + 'foo_bar-enum': z.optional(z.enum([ 280 + 'Success', 281 + 'Warning', 282 + 'Error', 283 + 'ØÆÅ字符串' 284 + ])) 285 + }); 286 + 287 + /** 288 + * This is a model with one enum 289 + */ 290 + export const zModelWithEnum = z.object({ 291 + 'foo_bar-enum': z.optional(z.enum([ 292 + 'Success', 293 + 'Warning', 294 + 'Error', 295 + 'ØÆÅ字符串' 296 + ])), 297 + statusCode: z.optional(z.enum([ 298 + '100', 299 + '200 FOO', 300 + '300 FOO_BAR', 301 + '400 foo-bar', 302 + '500 foo.bar', 303 + '600 foo&bar' 304 + ])), 305 + bool: z.optional(z.unknown()) 306 + }); 307 + 308 + /** 309 + * This is a model with one enum with escaped name 310 + */ 311 + export const zModelWithEnumWithHyphen = z.object({ 312 + 'foo-bar-baz-qux': z.optional(z.enum([ 313 + '3.0' 314 + ])) 315 + }); 316 + 317 + /** 318 + * This is a model with one enum 319 + */ 320 + export const zModelWithEnumFromDescription = z.object({ 321 + test: z.optional(z.int()) 322 + }); 323 + 324 + /** 325 + * This is a model with nested enums 326 + */ 327 + export const zModelWithNestedEnums = z.object({ 328 + dictionaryWithEnum: z.optional(z.object({})), 329 + dictionaryWithEnumFromDescription: z.optional(z.object({})), 330 + arrayWithEnum: z.optional(z.array(z.enum([ 331 + 'Success', 332 + 'Warning', 333 + 'Error' 334 + ]))), 335 + arrayWithDescription: z.optional(z.array(z.int())), 336 + 'foo_bar-enum': z.optional(z.enum([ 337 + 'Success', 338 + 'Warning', 339 + 'Error', 340 + 'ØÆÅ字符串' 341 + ])) 342 + }); 343 + 344 + /** 345 + * This is a model with one nested property 346 + */ 347 + export const zModelWithProperties = z.object({ 348 + required: z.string(), 349 + requiredAndReadOnly: z.string().readonly(), 350 + requiredAndNullable: z.union([ 351 + z.string(), 352 + z.null() 353 + ]), 354 + string: z.optional(z.string()), 355 + number: z.optional(z.number()), 356 + boolean: z.optional(z.boolean()), 357 + reference: z.optional(zModelWithString), 358 + 'property with space': z.optional(z.string()), 359 + default: z.optional(z.string()), 360 + try: z.optional(z.string()), 361 + '@namespace.string': z.optional(z.string().readonly()), 362 + '@namespace.integer': z.optional(z.int().readonly()) 363 + }); 364 + 365 + /** 366 + * This is a model with one property containing a reference 367 + */ 368 + export const zModelWithReference = z.object({ 369 + prop: z.optional(zModelWithProperties) 370 + }); 371 + 372 + export const zModelWithReadOnlyAndWriteOnly = z.object({ 373 + foo: z.string(), 374 + bar: z.string().readonly() 375 + }); 376 + 377 + /** 378 + * This is a model with one property containing an array 379 + */ 380 + export const zModelWithArrayReadOnlyAndWriteOnly = z.object({ 381 + prop: z.optional(z.array(zModelWithReadOnlyAndWriteOnly)), 382 + propWithFile: z.optional(z.array(z.string())), 383 + propWithNumber: z.optional(z.array(z.number())) 384 + }); 385 + 386 + /** 387 + * This is a model with one property containing an array 388 + */ 389 + export const zModelWithArray = z.object({ 390 + prop: z.optional(z.array(zModelWithString)), 391 + propWithFile: z.optional(z.array(z.string())), 392 + propWithNumber: z.optional(z.array(z.number())) 393 + }); 394 + 395 + /** 396 + * This is a model with one property containing a dictionary 397 + */ 398 + export const zModelWithDictionary = z.object({ 399 + prop: z.optional(z.object({})) 400 + }); 401 + 402 + /** 403 + * This is a deprecated model with a deprecated property 404 + * @deprecated 405 + */ 406 + export const zDeprecatedModel = z.object({ 407 + prop: z.optional(z.string()) 408 + }); 409 + 410 + /** 411 + * This is a model with one property containing a circular reference 412 + */ 413 + export const zModelWithCircularReference = z.object({ 414 + prop: z.optional(z.lazy(() => { 415 + return zModelWithCircularReference; 416 + })) 417 + }); 418 + 419 + /** 420 + * This is a model with one property with a 'one of' relationship 421 + */ 422 + export const zCompositionWithOneOf = z.object({ 423 + propA: z.optional(z.union([ 424 + zModelWithString, 425 + zModelWithEnum, 426 + zModelWithArray, 427 + zModelWithDictionary 428 + ])) 429 + }); 430 + 431 + /** 432 + * This is a model with one property with a 'one of' relationship where the options are not $ref 433 + */ 434 + export const zCompositionWithOneOfAnonymous = z.object({ 435 + propA: z.optional(z.union([ 436 + z.object({ 437 + propA: z.optional(z.string()) 438 + }), 439 + z.string(), 440 + z.int() 441 + ])) 442 + }); 443 + 444 + /** 445 + * Circle 446 + */ 447 + export const zModelCircle = z.object({ 448 + kind: z.string(), 449 + radius: z.optional(z.number()) 450 + }); 451 + 452 + /** 453 + * Square 454 + */ 455 + export const zModelSquare = z.object({ 456 + kind: z.string(), 457 + sideLength: z.optional(z.number()) 458 + }); 459 + 460 + /** 461 + * This is a model with one property with a 'one of' relationship where the options are not $ref 462 + */ 463 + export const zCompositionWithOneOfDiscriminator = z.union([ 464 + z.object({ 465 + kind: z.literal('circle') 466 + }).and(zModelCircle), 467 + z.object({ 468 + kind: z.literal('square') 469 + }).and(zModelSquare) 470 + ]); 471 + 472 + /** 473 + * This is a model with one property with a 'any of' relationship 474 + */ 475 + export const zCompositionWithAnyOf = z.object({ 476 + propA: z.optional(z.union([ 477 + zModelWithString, 478 + zModelWithEnum, 479 + zModelWithArray, 480 + zModelWithDictionary 481 + ])) 482 + }); 483 + 484 + /** 485 + * This is a model with one property with a 'any of' relationship where the options are not $ref 486 + */ 487 + export const zCompositionWithAnyOfAnonymous = z.object({ 488 + propA: z.optional(z.union([ 489 + z.object({ 490 + propA: z.optional(z.string()) 491 + }), 492 + z.string(), 493 + z.int() 494 + ])) 495 + }); 496 + 497 + /** 498 + * This is a model with nested 'any of' property with a type null 499 + */ 500 + export const zCompositionWithNestedAnyAndTypeNull = z.object({ 501 + propA: z.optional(z.union([ 502 + z.array(z.union([ 503 + zModelWithDictionary, 504 + z.null() 505 + ])), 506 + z.array(z.union([ 507 + zModelWithArray, 508 + z.null() 509 + ])) 510 + ])) 511 + }); 512 + 513 + export const z3eNum1Период = z.enum([ 514 + 'Bird', 515 + 'Dog' 516 + ]); 517 + 518 + export const zConstValue = z.enum([ 519 + 'ConstValue' 520 + ]); 521 + 522 + /** 523 + * This is a model with one property with a 'any of' relationship where the options are not $ref 524 + */ 525 + export const zCompositionWithNestedAnyOfAndNull = z.object({ 526 + propA: z.optional(z.union([ 527 + z.array(z.union([ 528 + z3eNum1Период, 529 + zConstValue 530 + ])), 531 + z.null() 532 + ])) 533 + }); 534 + 535 + /** 536 + * This is a model with one property with a 'one of' relationship 537 + */ 538 + export const zCompositionWithOneOfAndNullable = z.object({ 539 + propA: z.optional(z.union([ 540 + z.object({ 541 + boolean: z.optional(z.boolean()) 542 + }), 543 + zModelWithEnum, 544 + zModelWithArray, 545 + zModelWithDictionary, 546 + z.null() 547 + ])) 548 + }); 549 + 550 + /** 551 + * This is a model that contains a simple dictionary within composition 552 + */ 553 + export const zCompositionWithOneOfAndSimpleDictionary = z.object({ 554 + propA: z.optional(z.union([ 555 + z.boolean(), 556 + z.object({}) 557 + ])) 558 + }); 559 + 560 + /** 561 + * This is a model that contains a dictionary of simple arrays within composition 562 + */ 563 + export const zCompositionWithOneOfAndSimpleArrayDictionary = z.object({ 564 + propA: z.optional(z.union([ 565 + z.boolean(), 566 + z.object({}) 567 + ])) 568 + }); 569 + 570 + /** 571 + * This is a model that contains a dictionary of complex arrays (composited) within composition 572 + */ 573 + export const zCompositionWithOneOfAndComplexArrayDictionary = z.object({ 574 + propA: z.optional(z.union([ 575 + z.boolean(), 576 + z.object({}) 577 + ])) 578 + }); 579 + 580 + /** 581 + * This is a model with one property with a 'all of' relationship 582 + */ 583 + export const zCompositionWithAllOfAndNullable = z.object({ 584 + propA: z.optional(z.union([ 585 + z.object({ 586 + boolean: z.optional(z.boolean()) 587 + }).and(zModelWithEnum).and(zModelWithArray).and(zModelWithDictionary), 588 + z.null() 589 + ])) 590 + }); 591 + 592 + /** 593 + * This is a model with one property with a 'any of' relationship 594 + */ 595 + export const zCompositionWithAnyOfAndNullable = z.object({ 596 + propA: z.optional(z.union([ 597 + z.object({ 598 + boolean: z.optional(z.boolean()) 599 + }), 600 + zModelWithEnum, 601 + zModelWithArray, 602 + zModelWithDictionary, 603 + z.null() 604 + ])) 605 + }); 606 + 607 + /** 608 + * This is a base model with two simple optional properties 609 + */ 610 + export const zCompositionBaseModel = z.object({ 611 + firstName: z.optional(z.string()), 612 + lastname: z.optional(z.string()) 613 + }); 614 + 615 + /** 616 + * This is a model that extends the base model 617 + */ 618 + export const zCompositionExtendedModel = zCompositionBaseModel.and(z.object({ 619 + age: z.number(), 620 + firstName: z.string(), 621 + lastname: z.string() 622 + })); 623 + 624 + /** 625 + * This is a model with one nested property 626 + */ 627 + export const zModelWithNestedProperties = z.object({ 628 + first: z.union([ 629 + z.object({ 630 + second: z.union([ 631 + z.object({ 632 + third: z.union([ 633 + z.string().readonly(), 634 + z.null() 635 + ]).readonly() 636 + }).readonly(), 637 + z.null() 638 + ]).readonly() 639 + }).readonly(), 640 + z.null() 641 + ]).readonly() 642 + }); 643 + 644 + /** 645 + * This is a model with duplicated properties 646 + */ 647 + export const zModelWithDuplicateProperties = z.object({ 648 + prop: z.optional(zModelWithString) 649 + }); 650 + 651 + /** 652 + * This is a model with ordered properties 653 + */ 654 + export const zModelWithOrderedProperties = z.object({ 655 + zebra: z.optional(z.string()), 656 + apple: z.optional(z.string()), 657 + hawaii: z.optional(z.string()) 658 + }); 659 + 660 + /** 661 + * This is a model with duplicated imports 662 + */ 663 + export const zModelWithDuplicateImports = z.object({ 664 + propA: z.optional(zModelWithString), 665 + propB: z.optional(zModelWithString), 666 + propC: z.optional(zModelWithString) 667 + }); 668 + 669 + /** 670 + * This is a model that extends another model 671 + */ 672 + export const zModelThatExtends = zModelWithString.and(z.object({ 673 + propExtendsA: z.optional(z.string()), 674 + propExtendsB: z.optional(zModelWithString) 675 + })); 676 + 677 + /** 678 + * This is a model that extends another model 679 + */ 680 + export const zModelThatExtendsExtends = zModelWithString.and(zModelThatExtends).and(z.object({ 681 + propExtendsC: z.optional(z.string()), 682 + propExtendsD: z.optional(zModelWithString) 683 + })); 684 + 685 + /** 686 + * This is a model that contains a some patterns 687 + */ 688 + export const zModelWithPattern = z.object({ 689 + key: z.string().max(64).regex(/^[a-zA-Z0-9_]*$/), 690 + name: z.string().max(255), 691 + enabled: z.optional(z.boolean().readonly()), 692 + modified: z.optional(z.iso.datetime().readonly()), 693 + id: z.optional(z.string().regex(/^\d{2}-\d{3}-\d{4}$/)), 694 + text: z.optional(z.string().regex(/^\w+$/)), 695 + patternWithSingleQuotes: z.optional(z.string().regex(/^[a-zA-Z0-9']*$/)), 696 + patternWithNewline: z.optional(z.string().regex(/aaa\nbbb/)), 697 + patternWithBacktick: z.optional(z.string().regex(/aaa`bbb/)) 698 + }); 699 + 700 + export const zFile = z.object({ 701 + id: z.optional(z.string().min(1).readonly()), 702 + updated_at: z.optional(z.iso.datetime().readonly()), 703 + created_at: z.optional(z.iso.datetime().readonly()), 704 + mime: z.string().min(1).max(24), 705 + file: z.optional(z.url().readonly()) 706 + }); 707 + 708 + export const zDefault = z.object({ 709 + name: z.optional(z.string()) 710 + }); 711 + 712 + export const zPageable = z.object({ 713 + page: z.optional(z.int().gte(0)).default(0), 714 + size: z.optional(z.int().gte(1)), 715 + sort: z.optional(z.array(z.string())) 716 + }); 717 + 718 + /** 719 + * This is a free-form object without additionalProperties. 720 + */ 721 + export const zFreeFormObjectWithoutAdditionalProperties = z.object({}); 722 + 723 + /** 724 + * This is a free-form object with additionalProperties: true. 725 + */ 726 + export const zFreeFormObjectWithAdditionalPropertiesEqTrue = z.object({}); 727 + 728 + /** 729 + * This is a free-form object with additionalProperties: {}. 730 + */ 731 + export const zFreeFormObjectWithAdditionalPropertiesEqEmptyObject = z.object({}); 732 + 733 + export const zModelWithConst = z.object({ 734 + String: z.optional(z.enum([ 735 + 'String' 736 + ])), 737 + number: z.optional(z.unknown()), 738 + null: z.optional(z.unknown()), 739 + withType: z.optional(z.enum([ 740 + 'Some string' 741 + ])) 742 + }); 743 + 744 + /** 745 + * This is a model with one property and additionalProperties: true 746 + */ 747 + export const zModelWithAdditionalPropertiesEqTrue = z.object({ 748 + prop: z.optional(z.string()) 749 + }); 750 + 751 + export const zNestedAnyOfArraysNullable = z.object({ 752 + nullableArray: z.optional(z.union([ 753 + z.array(z.union([ 754 + z.string(), 755 + z.boolean() 756 + ])), 757 + z.null() 758 + ])) 759 + }); 760 + 761 + /** 762 + * This is a reusable parameter 763 + */ 764 + export const zSimpleParameter = z.unknown(); 765 + 766 + export const zCompositionWithOneOfAndProperties = z.intersection(z.union([ 767 + z.object({ 768 + foo: zSimpleParameter 769 + }), 770 + z.object({ 771 + bar: zNonAsciiStringæøåÆøÅöôêÊ字符串 772 + }) 773 + ]), z.object({ 774 + baz: z.union([ 775 + z.int().gte(0), 776 + z.null() 777 + ]), 778 + qux: z.int().gte(0) 779 + })); 780 + 781 + /** 782 + * An object that can be null 783 + */ 784 + export const zNullableObject = z.union([ 785 + z.object({ 786 + foo: z.optional(z.string()) 787 + }), 788 + z.null() 789 + ]).default(null); 790 + 791 + /** 792 + * Some % character 793 + */ 794 + export const zCharactersInDescription = z.string(); 795 + 796 + export const zModelWithNullableObject = z.object({ 797 + data: z.optional(zNullableObject) 798 + }); 799 + 800 + export const zModelWithOneOfEnum = z.union([ 801 + z.object({ 802 + foo: z.enum([ 803 + 'Bar' 804 + ]) 805 + }), 806 + z.object({ 807 + foo: z.enum([ 808 + 'Baz' 809 + ]) 810 + }), 811 + z.object({ 812 + foo: z.enum([ 813 + 'Qux' 814 + ]) 815 + }), 816 + z.object({ 817 + content: z.iso.datetime(), 818 + foo: z.enum([ 819 + 'Quux' 820 + ]) 821 + }), 822 + z.object({ 823 + content: z.tuple([ 824 + z.iso.datetime(), 825 + z.iso.datetime() 826 + ]), 827 + foo: z.enum([ 828 + 'Corge' 829 + ]) 830 + }) 831 + ]); 832 + 833 + export const zModelWithNestedArrayEnumsDataFoo = z.enum([ 834 + 'foo', 835 + 'bar' 836 + ]); 837 + 838 + export const zModelWithNestedArrayEnumsDataBar = z.enum([ 839 + 'baz', 840 + 'qux' 841 + ]); 842 + 843 + export const zModelWithNestedArrayEnumsData = z.object({ 844 + foo: z.optional(z.array(zModelWithNestedArrayEnumsDataFoo)), 845 + bar: z.optional(z.array(zModelWithNestedArrayEnumsDataBar)) 846 + }); 847 + 848 + export const zModelWithNestedArrayEnums = z.object({ 849 + array_strings: z.optional(z.array(z.string())), 850 + data: z.optional(zModelWithNestedArrayEnumsData) 851 + }); 852 + 853 + export const zModelWithNestedCompositionEnums = z.object({ 854 + foo: z.optional(zModelWithNestedArrayEnumsDataFoo) 855 + }); 856 + 857 + export const zModelWithConstantSizeArray = z.tuple([ 858 + z.number(), 859 + z.number() 860 + ]); 861 + 862 + export const zModelWithAnyOfConstantSizeArray = z.tuple([ 863 + z.union([ 864 + z.number(), 865 + z.string() 866 + ]), 867 + z.union([ 868 + z.number(), 869 + z.string() 870 + ]), 871 + z.union([ 872 + z.number(), 873 + z.string() 874 + ]) 875 + ]); 876 + 877 + export const zModelWithPrefixItemsConstantSizeArray = z.array(z.union([ 878 + zModelWithInteger, 879 + z.number(), 880 + z.string() 881 + ])); 882 + 883 + export const zModelWithAnyOfConstantSizeArrayNullable = z.tuple([ 884 + z.union([ 885 + z.number(), 886 + z.null(), 887 + z.string() 888 + ]), 889 + z.union([ 890 + z.number(), 891 + z.null(), 892 + z.string() 893 + ]), 894 + z.union([ 895 + z.number(), 896 + z.null(), 897 + z.string() 898 + ]) 899 + ]); 900 + 901 + /** 902 + * Model with restricted keyword name 903 + */ 904 + export const zImport = z.string(); 905 + 906 + export const zModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = z.tuple([ 907 + z.union([ 908 + z.number(), 909 + zImport 910 + ]), 911 + z.union([ 912 + z.number(), 913 + zImport 914 + ]) 915 + ]); 916 + 917 + export const zModelWithAnyOfConstantSizeArrayAndIntersect = z.tuple([ 918 + z.intersection(z.number(), z.string()), 919 + z.intersection(z.number(), z.string()) 920 + ]); 921 + 922 + export const zModelWithNumericEnumUnion = z.object({ 923 + value: z.optional(z.unknown()) 924 + }); 925 + 926 + /** 927 + * Some description with `back ticks` 928 + */ 929 + export const zModelWithBackticksInDescription = z.object({ 930 + template: z.optional(z.string()) 931 + }); 932 + 933 + export const zModelWithOneOfAndProperties = z.intersection(z.union([ 934 + zSimpleParameter, 935 + zNonAsciiStringæøåÆøÅöôêÊ字符串 936 + ]), z.object({ 937 + baz: z.union([ 938 + z.int().gte(0), 939 + z.null() 940 + ]), 941 + qux: z.int().gte(0) 942 + })); 943 + 944 + /** 945 + * Model used to test deduplication strategy (unused) 946 + */ 947 + export const zParameterSimpleParameterUnused = z.string(); 948 + 949 + /** 950 + * Model used to test deduplication strategy 951 + */ 952 + export const zPostServiceWithEmptyTagResponse = z.string(); 953 + 954 + /** 955 + * Model used to test deduplication strategy 956 + */ 957 + export const zPostServiceWithEmptyTagResponse2 = z.string(); 958 + 959 + /** 960 + * Model used to test deduplication strategy 961 + */ 962 + export const zDeleteFooData = z.string(); 963 + 964 + /** 965 + * Model used to test deduplication strategy 966 + */ 967 + export const zDeleteFooData2 = z.string(); 968 + 969 + export const zSchemaWithFormRestrictedKeys = z.object({ 970 + description: z.optional(z.string()), 971 + 'x-enum-descriptions': z.optional(z.string()), 972 + 'x-enum-varnames': z.optional(z.string()), 973 + 'x-enumNames': z.optional(z.string()), 974 + title: z.optional(z.string()), 975 + object: z.optional(z.object({ 976 + description: z.optional(z.string()), 977 + 'x-enum-descriptions': z.optional(z.string()), 978 + 'x-enum-varnames': z.optional(z.string()), 979 + 'x-enumNames': z.optional(z.string()), 980 + title: z.optional(z.string()) 981 + })), 982 + array: z.optional(z.array(z.object({ 983 + description: z.optional(z.string()), 984 + 'x-enum-descriptions': z.optional(z.string()), 985 + 'x-enum-varnames': z.optional(z.string()), 986 + 'x-enumNames': z.optional(z.string()), 987 + title: z.optional(z.string()) 988 + }))) 989 + }); 990 + 991 + /** 992 + * This schema was giving PascalCase transformations a hard time 993 + */ 994 + export const zIoK8sApimachineryPkgApisMetaV1Preconditions = z.object({ 995 + resourceVersion: z.optional(z.string()), 996 + uid: z.optional(z.string()) 997 + }); 998 + 999 + /** 1000 + * This schema was giving PascalCase transformations a hard time 1001 + */ 1002 + export const zIoK8sApimachineryPkgApisMetaV1DeleteOptions = z.object({ 1003 + preconditions: z.optional(zIoK8sApimachineryPkgApisMetaV1Preconditions) 1004 + }); 1005 + 1006 + export const zAdditionalPropertiesUnknownIssue = z.object({}); 1007 + 1008 + export const zAdditionalPropertiesUnknownIssue2 = z.object({}); 1009 + 1010 + export const zAdditionalPropertiesUnknownIssue3 = z.intersection(z.string(), z.object({ 1011 + entries: z.object({}) 1012 + })); 1013 + 1014 + export const zAdditionalPropertiesIntegerIssue = z.object({ 1015 + value: z.int() 1016 + }); 1017 + 1018 + export const zGenericSchemaDuplicateIssue1SystemBoolean = z.object({ 1019 + item: z.optional(z.boolean()), 1020 + error: z.optional(z.union([ 1021 + z.string(), 1022 + z.null() 1023 + ])), 1024 + hasError: z.optional(z.boolean().readonly()), 1025 + data: z.optional(z.object({})) 1026 + }); 1027 + 1028 + export const zGenericSchemaDuplicateIssue1SystemString = z.object({ 1029 + item: z.optional(z.union([ 1030 + z.string(), 1031 + z.null() 1032 + ])), 1033 + error: z.optional(z.union([ 1034 + z.string(), 1035 + z.null() 1036 + ])), 1037 + hasError: z.optional(z.boolean().readonly()) 1038 + }); 1039 + 1040 + export const zOneOfAllOfIssue = z.union([ 1041 + z.intersection(z.union([ 1042 + zConstValue, 1043 + zGenericSchemaDuplicateIssue1SystemBoolean 1044 + ]), z3eNum1Период), 1045 + zGenericSchemaDuplicateIssue1SystemString 1046 + ]); 1047 + 1048 + /** 1049 + * Model with number-only name 1050 + */ 1051 + export const z400Writable = z.string(); 1052 + 1053 + /** 1054 + * Testing multiline comments in string: First line 1055 + * Second line 1056 + * 1057 + * Fourth line 1058 + */ 1059 + export const zCamelCaseCommentWithBreaksWritable = z.int(); 1060 + 1061 + /** 1062 + * Testing multiline comments in string: First line 1063 + * Second line 1064 + * 1065 + * Fourth line 1066 + */ 1067 + export const zCommentWithBreaksWritable = z.int(); 1068 + 1069 + /** 1070 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1071 + */ 1072 + export const zCommentWithBackticksWritable = z.int(); 1073 + 1074 + /** 1075 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 1076 + */ 1077 + export const zCommentWithBackticksAndQuotesWritable = z.int(); 1078 + 1079 + /** 1080 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1081 + */ 1082 + export const zCommentWithSlashesWritable = z.int(); 1083 + 1084 + /** 1085 + * Testing expression placeholders in string: ${expression} should work 1086 + */ 1087 + export const zCommentWithExpressionPlaceholdersWritable = z.int(); 1088 + 1089 + /** 1090 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1091 + */ 1092 + export const zCommentWithQuotesWritable = z.int(); 1093 + 1094 + /** 1095 + * Testing reserved characters in string: * inline * and ** inline ** should work 1096 + */ 1097 + export const zCommentWithReservedCharactersWritable = z.int(); 1098 + 1099 + /** 1100 + * This is a simple number 1101 + */ 1102 + export const zSimpleIntegerWritable = z.int(); 1103 + 1104 + /** 1105 + * This is a simple boolean 1106 + */ 1107 + export const zSimpleBooleanWritable = z.boolean(); 1108 + 1109 + /** 1110 + * This is a simple string 1111 + */ 1112 + export const zSimpleStringWritable = z.string(); 1113 + 1114 + /** 1115 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 1116 + */ 1117 + export const zNonAsciiStringæøåÆøÅöôêÊ字符串Writable = z.string(); 1118 + 1119 + /** 1120 + * This is a simple file 1121 + */ 1122 + export const zSimpleFileWritable = z.string(); 1123 + 1124 + /** 1125 + * This is a simple string 1126 + */ 1127 + export const zSimpleStringWithPatternWritable = z.union([ 1128 + z.string().max(64).regex(/^[a-zA-Z0-9_]*$/), 1129 + z.null() 1130 + ]); 1131 + 1132 + /** 1133 + * This is a simple enum with strings 1134 + */ 1135 + export const zEnumWithStringsWritable = z.enum([ 1136 + 'Success', 1137 + 'Warning', 1138 + 'Error', 1139 + "'Single Quote'", 1140 + '"Double Quotes"', 1141 + 'Non-ascii: øæåôöØÆÅÔÖ字符串' 1142 + ]); 1143 + 1144 + export const zEnumWithReplacedCharactersWritable = z.enum([ 1145 + "'Single Quote'", 1146 + '"Double Quotes"', 1147 + 'øæåôöØÆÅÔÖ字符串', 1148 + '' 1149 + ]); 1150 + 1151 + /** 1152 + * This is a simple enum with numbers 1153 + */ 1154 + export const zEnumWithNumbersWritable = z.unknown(); 1155 + 1156 + /** 1157 + * Success=1,Warning=2,Error=3 1158 + */ 1159 + export const zEnumFromDescriptionWritable = z.number(); 1160 + 1161 + /** 1162 + * This is a simple enum with numbers 1163 + */ 1164 + export const zEnumWithExtensionsWritable = z.unknown(); 1165 + 1166 + export const zEnumWithXEnumNamesWritable = z.unknown(); 1167 + 1168 + /** 1169 + * This is a simple array with numbers 1170 + */ 1171 + export const zArrayWithNumbersWritable = z.array(z.int()); 1172 + 1173 + /** 1174 + * This is a simple array with booleans 1175 + */ 1176 + export const zArrayWithBooleansWritable = z.array(z.boolean()); 1177 + 1178 + /** 1179 + * This is a simple array with strings 1180 + */ 1181 + export const zArrayWithStringsWritable = z.array(z.string()).default(['test']); 1182 + 1183 + /** 1184 + * This is a string dictionary 1185 + */ 1186 + export const zDictionaryWithStringWritable = z.object({}); 1187 + 1188 + /** 1189 + * This is a string dictionary 1190 + */ 1191 + export const zDictionaryWithDictionaryWritable = z.record(z.string(), z.object({})); 1192 + 1193 + /** 1194 + * `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) 1195 + */ 1196 + export const zModelFromZendeskWritable = z.string(); 1197 + 1198 + export const zModelWithReadOnlyAndWriteOnlyWritable = z.object({ 1199 + foo: z.string(), 1200 + baz: z.string() 1201 + }); 1202 + 1203 + /** 1204 + * This is a model with one property containing an array 1205 + */ 1206 + export const zModelWithArrayReadOnlyAndWriteOnlyWritable = z.object({ 1207 + prop: z.optional(z.array(zModelWithReadOnlyAndWriteOnlyWritable)), 1208 + propWithFile: z.optional(z.array(z.string())), 1209 + propWithNumber: z.optional(z.array(z.number())) 1210 + }); 1211 + 1212 + export const z3eNum1ПериодWritable = z.enum([ 1213 + 'Bird', 1214 + 'Dog' 1215 + ]); 1216 + 1217 + export const zConstValueWritable = z.enum([ 1218 + 'ConstValue' 1219 + ]); 1220 + 1221 + /** 1222 + * This is a free-form object without additionalProperties. 1223 + */ 1224 + export const zFreeFormObjectWithoutAdditionalPropertiesWritable = z.object({}); 1225 + 1226 + /** 1227 + * This is a free-form object with additionalProperties: true. 1228 + */ 1229 + export const zFreeFormObjectWithAdditionalPropertiesEqTrueWritable = z.object({}); 1230 + 1231 + /** 1232 + * This is a free-form object with additionalProperties: {}. 1233 + */ 1234 + export const zFreeFormObjectWithAdditionalPropertiesEqEmptyObjectWritable = z.object({}); 1235 + 1236 + /** 1237 + * Some % character 1238 + */ 1239 + export const zCharactersInDescriptionWritable = z.string(); 1240 + 1241 + export const zModelWithNestedArrayEnumsDataFooWritable = z.enum([ 1242 + 'foo', 1243 + 'bar' 1244 + ]); 1245 + 1246 + export const zModelWithNestedArrayEnumsDataBarWritable = z.enum([ 1247 + 'baz', 1248 + 'qux' 1249 + ]); 1250 + 1251 + export const zModelWithConstantSizeArrayWritable = z.tuple([ 1252 + z.number(), 1253 + z.number() 1254 + ]); 1255 + 1256 + export const zModelWithAnyOfConstantSizeArrayWritable = z.tuple([ 1257 + z.union([ 1258 + z.number(), 1259 + z.string() 1260 + ]), 1261 + z.union([ 1262 + z.number(), 1263 + z.string() 1264 + ]), 1265 + z.union([ 1266 + z.number(), 1267 + z.string() 1268 + ]) 1269 + ]); 1270 + 1271 + export const zModelWithAnyOfConstantSizeArrayNullableWritable = z.tuple([ 1272 + z.union([ 1273 + z.number(), 1274 + z.null(), 1275 + z.string() 1276 + ]), 1277 + z.union([ 1278 + z.number(), 1279 + z.null(), 1280 + z.string() 1281 + ]), 1282 + z.union([ 1283 + z.number(), 1284 + z.null(), 1285 + z.string() 1286 + ]) 1287 + ]); 1288 + 1289 + /** 1290 + * Model with restricted keyword name 1291 + */ 1292 + export const zImportWritable = z.string(); 1293 + 1294 + export const zModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = z.tuple([ 1295 + z.union([ 1296 + z.number(), 1297 + zImportWritable 1298 + ]), 1299 + z.union([ 1300 + z.number(), 1301 + zImportWritable 1302 + ]) 1303 + ]); 1304 + 1305 + export const zModelWithAnyOfConstantSizeArrayAndIntersectWritable = z.tuple([ 1306 + z.intersection(z.number(), z.string()), 1307 + z.intersection(z.number(), z.string()) 1308 + ]); 1309 + 1310 + /** 1311 + * Model used to test deduplication strategy (unused) 1312 + */ 1313 + export const zParameterSimpleParameterUnusedWritable = z.string(); 1314 + 1315 + /** 1316 + * Model used to test deduplication strategy 1317 + */ 1318 + export const zPostServiceWithEmptyTagResponseWritable = z.string(); 1319 + 1320 + /** 1321 + * Model used to test deduplication strategy 1322 + */ 1323 + export const zPostServiceWithEmptyTagResponse2Writable = z.string(); 1324 + 1325 + /** 1326 + * Model used to test deduplication strategy 1327 + */ 1328 + export const zDeleteFooDataWritable = z.string(); 1329 + 1330 + /** 1331 + * Model used to test deduplication strategy 1332 + */ 1333 + export const zDeleteFooData2Writable = z.string(); 1334 + 1335 + export const zAdditionalPropertiesUnknownIssueWritable = z.object({}); 1336 + 1337 + export const zAdditionalPropertiesUnknownIssue2Writable = z.object({}); 1338 + 1339 + export const zOneOfAllOfIssueWritable = z.union([ 1340 + z.intersection(z.union([ 1341 + zConstValueWritable, 1342 + zGenericSchemaDuplicateIssue1SystemBoolean 1343 + ]), z3eNum1Период), 1344 + zGenericSchemaDuplicateIssue1SystemString 1345 + ]); 1346 + 1347 + /** 1348 + * Parameter with illegal characters 1349 + */ 1350 + export const zXFooBar = zModelWithString; 1351 + 1352 + export const zSimpleRequestBody = zModelWithString; 1353 + 1354 + export const zSimpleFormData = zModelWithString; 1355 + 1356 + export const zExportData = z.object({ 1357 + body: z.optional(z.never()), 1358 + path: z.optional(z.never()), 1359 + query: z.optional(z.never()) 1360 + }); 1361 + 1362 + export const zPatchApiVbyApiVersionNoTagData = z.object({ 1363 + body: z.optional(z.never()), 1364 + path: z.optional(z.never()), 1365 + query: z.optional(z.never()) 1366 + }); 1367 + 1368 + export const zImportData = z.object({ 1369 + body: z.union([ 1370 + zModelWithReadOnlyAndWriteOnlyWritable, 1371 + zModelWithArrayReadOnlyAndWriteOnlyWritable 1372 + ]), 1373 + path: z.optional(z.never()), 1374 + query: z.optional(z.never()) 1375 + }); 1376 + 1377 + export const zImportResponse = z.union([ 1378 + zModelFromZendesk, 1379 + zModelWithReadOnlyAndWriteOnly 1380 + ]); 1381 + 1382 + export const zFooWowData = z.object({ 1383 + body: z.optional(z.never()), 1384 + path: z.optional(z.never()), 1385 + query: z.optional(z.never()) 1386 + }); 1387 + 1388 + export const zApiVVersionODataControllerCountData = z.object({ 1389 + body: z.optional(z.never()), 1390 + path: z.optional(z.never()), 1391 + query: z.optional(z.never()) 1392 + }); 1393 + 1394 + /** 1395 + * Success 1396 + */ 1397 + export const zApiVVersionODataControllerCountResponse = zModelFromZendesk; 1398 + 1399 + export const zGetApiVbyApiVersionSimpleOperationData = z.object({ 1400 + body: z.optional(z.never()), 1401 + path: z.object({ 1402 + foo_param: z.string() 1403 + }), 1404 + query: z.optional(z.never()) 1405 + }); 1406 + 1407 + /** 1408 + * Response is a simple number 1409 + */ 1410 + export const zGetApiVbyApiVersionSimpleOperationResponse = z.number(); 1411 + 1412 + export const zDeleteCallWithoutParametersAndResponseData = z.object({ 1413 + body: z.optional(z.never()), 1414 + path: z.optional(z.never()), 1415 + query: z.optional(z.never()) 1416 + }); 1417 + 1418 + export const zGetCallWithoutParametersAndResponseData = z.object({ 1419 + body: z.optional(z.never()), 1420 + path: z.optional(z.never()), 1421 + query: z.optional(z.never()) 1422 + }); 1423 + 1424 + export const zHeadCallWithoutParametersAndResponseData = z.object({ 1425 + body: z.optional(z.never()), 1426 + path: z.optional(z.never()), 1427 + query: z.optional(z.never()) 1428 + }); 1429 + 1430 + export const zOptionsCallWithoutParametersAndResponseData = z.object({ 1431 + body: z.optional(z.never()), 1432 + path: z.optional(z.never()), 1433 + query: z.optional(z.never()) 1434 + }); 1435 + 1436 + export const zPatchCallWithoutParametersAndResponseData = z.object({ 1437 + body: z.optional(z.never()), 1438 + path: z.optional(z.never()), 1439 + query: z.optional(z.never()) 1440 + }); 1441 + 1442 + export const zPostCallWithoutParametersAndResponseData = z.object({ 1443 + body: z.optional(z.never()), 1444 + path: z.optional(z.never()), 1445 + query: z.optional(z.never()) 1446 + }); 1447 + 1448 + export const zPutCallWithoutParametersAndResponseData = z.object({ 1449 + body: z.optional(z.never()), 1450 + path: z.optional(z.never()), 1451 + query: z.optional(z.never()) 1452 + }); 1453 + 1454 + export const zDeleteFooData3 = z.object({ 1455 + body: z.optional(z.never()), 1456 + path: z.object({ 1457 + foo_param: z.string(), 1458 + BarParam: z.string() 1459 + }), 1460 + query: z.optional(z.never()), 1461 + headers: z.object({ 1462 + 'x-Foo-Bar': zModelWithString 1463 + }) 1464 + }); 1465 + 1466 + export const zCallWithDescriptionsData = z.object({ 1467 + body: z.optional(z.never()), 1468 + path: z.optional(z.never()), 1469 + query: z.optional(z.object({ 1470 + parameterWithBreaks: z.optional(z.string()), 1471 + parameterWithBackticks: z.optional(z.string()), 1472 + parameterWithSlashes: z.optional(z.string()), 1473 + parameterWithExpressionPlaceholders: z.optional(z.string()), 1474 + parameterWithQuotes: z.optional(z.string()), 1475 + parameterWithReservedCharacters: z.optional(z.string()) 1476 + })) 1477 + }); 1478 + 1479 + export const zDeprecatedCallData = z.object({ 1480 + body: z.optional(z.never()), 1481 + path: z.optional(z.never()), 1482 + query: z.optional(z.never()), 1483 + headers: z.object({ 1484 + parameter: z.union([ 1485 + zDeprecatedModel, 1486 + z.null() 1487 + ]) 1488 + }) 1489 + }); 1490 + 1491 + export const zCallWithParametersData = z.object({ 1492 + body: z.union([ 1493 + z.object({}), 1494 + z.null() 1495 + ]), 1496 + path: z.object({ 1497 + parameterPath: z.union([ 1498 + z.string(), 1499 + z.null() 1500 + ]), 1501 + 'api-version': z.union([ 1502 + z.string(), 1503 + z.null() 1504 + ]) 1505 + }), 1506 + query: z.object({ 1507 + foo_ref_enum: z.optional(zModelWithNestedArrayEnumsDataFooWritable), 1508 + foo_all_of_enum: zModelWithNestedArrayEnumsDataFooWritable, 1509 + cursor: z.union([ 1510 + z.string(), 1511 + z.null() 1512 + ]) 1513 + }), 1514 + headers: z.object({ 1515 + parameterHeader: z.union([ 1516 + z.string(), 1517 + z.null() 1518 + ]) 1519 + }) 1520 + }); 1521 + 1522 + export const zCallWithWeirdParameterNamesData = z.object({ 1523 + body: z.union([ 1524 + zModelWithString, 1525 + z.null() 1526 + ]), 1527 + path: z.object({ 1528 + 'parameter.path.1': z.optional(z.string()), 1529 + 'parameter-path-2': z.optional(z.string()), 1530 + 'PARAMETER-PATH-3': z.optional(z.string()), 1531 + 'api-version': z.union([ 1532 + z.string(), 1533 + z.null() 1534 + ]) 1535 + }), 1536 + query: z.object({ 1537 + default: z.optional(z.string()), 1538 + 'parameter-query': z.union([ 1539 + z.string(), 1540 + z.null() 1541 + ]) 1542 + }), 1543 + headers: z.object({ 1544 + 'parameter.header': z.union([ 1545 + z.string(), 1546 + z.null() 1547 + ]) 1548 + }) 1549 + }); 1550 + 1551 + export const zGetCallWithOptionalParamData = z.object({ 1552 + body: zModelWithOneOfEnum, 1553 + path: z.optional(z.never()), 1554 + query: z.optional(z.object({ 1555 + page: z.optional(z.number()) 1556 + })) 1557 + }); 1558 + 1559 + export const zPostCallWithOptionalParamData = z.object({ 1560 + body: z.optional(z.object({ 1561 + offset: z.optional(z.union([ 1562 + z.number(), 1563 + z.null() 1564 + ])) 1565 + })), 1566 + path: z.optional(z.never()), 1567 + query: z.object({ 1568 + parameter: zPageable 1569 + }) 1570 + }); 1571 + 1572 + export const zPostCallWithOptionalParamResponse = z.union([ 1573 + z.number(), 1574 + z.void() 1575 + ]); 1576 + 1577 + export const zPostApiVbyApiVersionRequestBodyData = z.object({ 1578 + body: z.optional(zSimpleRequestBody), 1579 + path: z.optional(z.never()), 1580 + query: z.optional(z.object({ 1581 + parameter: z.optional(z.string()) 1582 + })) 1583 + }); 1584 + 1585 + export const zPostApiVbyApiVersionFormDataData = z.object({ 1586 + body: z.optional(zSimpleFormData), 1587 + path: z.optional(z.never()), 1588 + query: z.optional(z.object({ 1589 + parameter: z.optional(z.string()) 1590 + })) 1591 + }); 1592 + 1593 + export const zCallWithDefaultParametersData = z.object({ 1594 + body: z.optional(z.never()), 1595 + path: z.optional(z.never()), 1596 + query: z.optional(z.object({ 1597 + parameterString: z.optional(z.union([ 1598 + z.string().default('Hello World!'), 1599 + z.null() 1600 + ])).default('Hello World!'), 1601 + parameterNumber: z.optional(z.union([ 1602 + z.number().default(123), 1603 + z.null() 1604 + ])).default(123), 1605 + parameterBoolean: z.optional(z.union([ 1606 + z.boolean().default(true), 1607 + z.null() 1608 + ])).default(true), 1609 + parameterEnum: z.optional(z.enum([ 1610 + 'Success', 1611 + 'Warning', 1612 + 'Error' 1613 + ])), 1614 + parameterModel: z.optional(z.union([ 1615 + zModelWithString, 1616 + z.null() 1617 + ])) 1618 + })) 1619 + }); 1620 + 1621 + export const zCallWithDefaultOptionalParametersData = z.object({ 1622 + body: z.optional(z.never()), 1623 + path: z.optional(z.never()), 1624 + query: z.optional(z.object({ 1625 + parameterString: z.optional(z.string()).default('Hello World!'), 1626 + parameterNumber: z.optional(z.number()).default(123), 1627 + parameterBoolean: z.optional(z.boolean()).default(true), 1628 + parameterEnum: z.optional(z.enum([ 1629 + 'Success', 1630 + 'Warning', 1631 + 'Error' 1632 + ])), 1633 + parameterModel: z.optional(zModelWithString) 1634 + })) 1635 + }); 1636 + 1637 + export const zCallToTestOrderOfParamsData = z.object({ 1638 + body: z.optional(z.never()), 1639 + path: z.optional(z.never()), 1640 + query: z.object({ 1641 + parameterOptionalStringWithDefault: z.optional(z.string()).default('Hello World!'), 1642 + parameterOptionalStringWithEmptyDefault: z.optional(z.string()).default(''), 1643 + parameterOptionalStringWithNoDefault: z.optional(z.string()), 1644 + parameterStringWithDefault: z.string().default('Hello World!'), 1645 + parameterStringWithEmptyDefault: z.string().default(''), 1646 + parameterStringWithNoDefault: z.string(), 1647 + parameterStringNullableWithNoDefault: z.optional(z.union([ 1648 + z.string(), 1649 + z.null() 1650 + ])), 1651 + parameterStringNullableWithDefault: z.optional(z.union([ 1652 + z.string(), 1653 + z.null() 1654 + ])).default(null) 1655 + }) 1656 + }); 1657 + 1658 + export const zDuplicateNameData = z.object({ 1659 + body: z.optional(z.never()), 1660 + path: z.optional(z.never()), 1661 + query: z.optional(z.never()) 1662 + }); 1663 + 1664 + export const zDuplicateName2Data = z.object({ 1665 + body: z.optional(z.never()), 1666 + path: z.optional(z.never()), 1667 + query: z.optional(z.never()) 1668 + }); 1669 + 1670 + export const zDuplicateName3Data = z.object({ 1671 + body: z.optional(z.never()), 1672 + path: z.optional(z.never()), 1673 + query: z.optional(z.never()) 1674 + }); 1675 + 1676 + export const zDuplicateName4Data = z.object({ 1677 + body: z.optional(z.never()), 1678 + path: z.optional(z.never()), 1679 + query: z.optional(z.never()) 1680 + }); 1681 + 1682 + export const zCallWithNoContentResponseData = z.object({ 1683 + body: z.optional(z.never()), 1684 + path: z.optional(z.never()), 1685 + query: z.optional(z.never()) 1686 + }); 1687 + 1688 + /** 1689 + * Success 1690 + */ 1691 + export const zCallWithNoContentResponseResponse = z.void(); 1692 + 1693 + export const zCallWithResponseAndNoContentResponseData = z.object({ 1694 + body: z.optional(z.never()), 1695 + path: z.optional(z.never()), 1696 + query: z.optional(z.never()) 1697 + }); 1698 + 1699 + export const zCallWithResponseAndNoContentResponseResponse = z.union([ 1700 + z.number(), 1701 + z.void() 1702 + ]); 1703 + 1704 + export const zDummyAData = z.object({ 1705 + body: z.optional(z.never()), 1706 + path: z.optional(z.never()), 1707 + query: z.optional(z.never()) 1708 + }); 1709 + 1710 + export const zDummyAResponse = z400; 1711 + 1712 + export const zDummyBData = z.object({ 1713 + body: z.optional(z.never()), 1714 + path: z.optional(z.never()), 1715 + query: z.optional(z.never()) 1716 + }); 1717 + 1718 + /** 1719 + * Success 1720 + */ 1721 + export const zDummyBResponse = z.void(); 1722 + 1723 + export const zCallWithResponseData = z.object({ 1724 + body: z.optional(z.never()), 1725 + path: z.optional(z.never()), 1726 + query: z.optional(z.never()) 1727 + }); 1728 + 1729 + export const zCallWithResponseResponse = zImport; 1730 + 1731 + export const zCallWithDuplicateResponsesData = z.object({ 1732 + body: z.optional(z.never()), 1733 + path: z.optional(z.never()), 1734 + query: z.optional(z.never()) 1735 + }); 1736 + 1737 + export const zCallWithDuplicateResponsesResponse = z.union([ 1738 + zModelWithBoolean.and(zModelWithInteger), 1739 + zModelWithString 1740 + ]); 1741 + 1742 + export const zCallWithResponsesData = z.object({ 1743 + body: z.optional(z.never()), 1744 + path: z.optional(z.never()), 1745 + query: z.optional(z.never()) 1746 + }); 1747 + 1748 + export const zCallWithResponsesResponse = z.union([ 1749 + z.object({ 1750 + '@namespace.string': z.optional(z.string().readonly()), 1751 + '@namespace.integer': z.optional(z.int().readonly()), 1752 + value: z.optional(z.array(zModelWithString).readonly()) 1753 + }), 1754 + zModelThatExtends, 1755 + zModelThatExtendsExtends 1756 + ]); 1757 + 1758 + export const zCollectionFormatData = z.object({ 1759 + body: z.optional(z.never()), 1760 + path: z.optional(z.never()), 1761 + query: z.object({ 1762 + parameterArrayCSV: z.union([ 1763 + z.array(z.string()), 1764 + z.null() 1765 + ]), 1766 + parameterArraySSV: z.union([ 1767 + z.array(z.string()), 1768 + z.null() 1769 + ]), 1770 + parameterArrayTSV: z.union([ 1771 + z.array(z.string()), 1772 + z.null() 1773 + ]), 1774 + parameterArrayPipes: z.union([ 1775 + z.array(z.string()), 1776 + z.null() 1777 + ]), 1778 + parameterArrayMulti: z.union([ 1779 + z.array(z.string()), 1780 + z.null() 1781 + ]) 1782 + }) 1783 + }); 1784 + 1785 + export const zTypesData = z.object({ 1786 + body: z.optional(z.never()), 1787 + path: z.optional(z.object({ 1788 + id: z.optional(z.int()) 1789 + })), 1790 + query: z.object({ 1791 + parameterNumber: z.number().default(123), 1792 + parameterString: z.union([ 1793 + z.string().default('default'), 1794 + z.null() 1795 + ]).default('default'), 1796 + parameterBoolean: z.union([ 1797 + z.boolean().default(true), 1798 + z.null() 1799 + ]).default(true), 1800 + parameterObject: z.union([ 1801 + z.object({}), 1802 + z.null() 1803 + ]).default(null), 1804 + parameterArray: z.union([ 1805 + z.array(z.string()), 1806 + z.null() 1807 + ]), 1808 + parameterDictionary: z.union([ 1809 + z.object({}), 1810 + z.null() 1811 + ]), 1812 + parameterEnum: z.enum([ 1813 + 'Success', 1814 + 'Warning', 1815 + 'Error' 1816 + ]) 1817 + }) 1818 + }); 1819 + 1820 + export const zTypesResponse = z.union([ 1821 + z.number(), 1822 + z.string(), 1823 + z.boolean(), 1824 + z.object({}) 1825 + ]); 1826 + 1827 + export const zUploadFileData = z.object({ 1828 + body: z.string(), 1829 + path: z.object({ 1830 + 'api-version': z.union([ 1831 + z.string(), 1832 + z.null() 1833 + ]) 1834 + }), 1835 + query: z.optional(z.never()) 1836 + }); 1837 + 1838 + export const zUploadFileResponse = z.boolean(); 1839 + 1840 + export const zFileResponseData = z.object({ 1841 + body: z.optional(z.never()), 1842 + path: z.object({ 1843 + id: z.string(), 1844 + 'api-version': z.string() 1845 + }), 1846 + query: z.optional(z.never()) 1847 + }); 1848 + 1849 + /** 1850 + * Success 1851 + */ 1852 + export const zFileResponseResponse = z.string(); 1853 + 1854 + export const zComplexTypesData = z.object({ 1855 + body: z.optional(z.never()), 1856 + path: z.optional(z.never()), 1857 + query: z.object({ 1858 + parameterObject: z.object({ 1859 + first: z.optional(z.object({ 1860 + second: z.optional(z.object({ 1861 + third: z.optional(z.string()) 1862 + })) 1863 + })) 1864 + }), 1865 + parameterReference: zModelWithString 1866 + }) 1867 + }); 1868 + 1869 + /** 1870 + * Successful response 1871 + */ 1872 + export const zComplexTypesResponse = z.array(zModelWithString); 1873 + 1874 + export const zMultipartResponseData = z.object({ 1875 + body: z.optional(z.never()), 1876 + path: z.optional(z.never()), 1877 + query: z.optional(z.never()) 1878 + }); 1879 + 1880 + /** 1881 + * OK 1882 + */ 1883 + export const zMultipartResponseResponse = z.object({ 1884 + file: z.optional(z.string()), 1885 + metadata: z.optional(z.object({ 1886 + foo: z.optional(z.string()), 1887 + bar: z.optional(z.string()) 1888 + })) 1889 + }); 1890 + 1891 + export const zMultipartRequestData = z.object({ 1892 + body: z.optional(z.object({ 1893 + content: z.optional(z.string()), 1894 + data: z.optional(z.union([ 1895 + zModelWithString, 1896 + z.null() 1897 + ])) 1898 + })), 1899 + path: z.optional(z.never()), 1900 + query: z.optional(z.never()) 1901 + }); 1902 + 1903 + export const zComplexParamsData = z.object({ 1904 + body: z.optional(z.object({ 1905 + key: z.union([ 1906 + z.string().max(64).regex(/^[a-zA-Z0-9_]*$/).readonly(), 1907 + z.null() 1908 + ]).readonly(), 1909 + name: z.union([ 1910 + z.string().max(255), 1911 + z.null() 1912 + ]), 1913 + enabled: z.optional(z.boolean()).default(true), 1914 + type: z.enum([ 1915 + 'Monkey', 1916 + 'Horse', 1917 + 'Bird' 1918 + ]), 1919 + listOfModels: z.optional(z.union([ 1920 + z.array(zModelWithString), 1921 + z.null() 1922 + ])), 1923 + listOfStrings: z.optional(z.union([ 1924 + z.array(z.string()), 1925 + z.null() 1926 + ])), 1927 + parameters: z.union([ 1928 + zModelWithString, 1929 + zModelWithEnum, 1930 + zModelWithArray, 1931 + zModelWithDictionary 1932 + ]), 1933 + user: z.optional(z.object({ 1934 + id: z.optional(z.int().readonly()), 1935 + name: z.optional(z.union([ 1936 + z.string().readonly(), 1937 + z.null() 1938 + ]).readonly()) 1939 + }).readonly()) 1940 + })), 1941 + path: z.object({ 1942 + id: z.int(), 1943 + 'api-version': z.string() 1944 + }), 1945 + query: z.optional(z.never()) 1946 + }); 1947 + 1948 + /** 1949 + * Success 1950 + */ 1951 + export const zComplexParamsResponse = zModelWithString; 1952 + 1953 + export const zCallWithResultFromHeaderData = z.object({ 1954 + body: z.optional(z.never()), 1955 + path: z.optional(z.never()), 1956 + query: z.optional(z.never()) 1957 + }); 1958 + 1959 + export const zTestErrorCodeData = z.object({ 1960 + body: z.optional(z.never()), 1961 + path: z.optional(z.never()), 1962 + query: z.object({ 1963 + status: z.int() 1964 + }) 1965 + }); 1966 + 1967 + export const zNonAsciiæøåÆøÅöôêÊ字符串Data = z.object({ 1968 + body: z.optional(z.never()), 1969 + path: z.optional(z.never()), 1970 + query: z.object({ 1971 + 'nonAsciiParamæøåÆØÅöôêÊ': z.int() 1972 + }) 1973 + }); 1974 + 1975 + /** 1976 + * Successful response 1977 + */ 1978 + export const zNonAsciiæøåÆøÅöôêÊ字符串Response = z.array(zNonAsciiStringæøåÆøÅöôêÊ字符串); 1979 + 1980 + export const zPutWithFormUrlEncodedData = z.object({ 1981 + body: zArrayWithStringsWritable, 1982 + path: z.optional(z.never()), 1983 + query: z.optional(z.never()) 1984 + });
+18
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/enum-null/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod/v4'; 4 + 5 + export const zFoo = z.enum([ 6 + 'foo', 7 + 'bar' 8 + ]).nullable(); 9 + 10 + export const zBar = z.enum([ 11 + 'foo', 12 + 'bar' 13 + ]); 14 + 15 + export const zBaz = z.enum([ 16 + 'foo', 17 + 'bar' 18 + ]);
+24
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/type-format-zod/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod/v4'; 4 + 5 + export const zFoo = z.object({ 6 + bar: z.optional(z.int()), 7 + foo: z.coerce.bigint().default(BigInt(0)), 8 + id: z.string() 9 + }); 10 + 11 + export const zBar = z.object({ 12 + foo: z.int() 13 + }); 14 + 15 + export const zPostFooData = z.object({ 16 + body: z.optional(z.never()), 17 + path: z.optional(z.never()), 18 + query: z.optional(z.never()) 19 + }); 20 + 21 + /** 22 + * OK 23 + */ 24 + export const zPostFooResponse = zFoo;
+23
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/validators/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod/v4'; 4 + 5 + export const zBar = z.object({ 6 + foo: z.optional(z.lazy(() => { 7 + return zFoo; 8 + })) 9 + }); 10 + 11 + export const zFoo = z.union([ 12 + z.object({ 13 + foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), 14 + bar: z.optional(zBar), 15 + baz: z.optional(z.array(z.lazy(() => { 16 + return zFoo; 17 + }))), 18 + qux: z.optional(z.int().gt(0)).default(0) 19 + }), 20 + z.null() 21 + ]).default(null); 22 + 23 + export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz');
+1992
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/default/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import * as z from 'zod/v4-mini'; 4 + 5 + /** 6 + * Model with number-only name 7 + */ 8 + export const z400 = z.string(); 9 + 10 + /** 11 + * Testing multiline comments in string: First line 12 + * Second line 13 + * 14 + * Fourth line 15 + */ 16 + export const zCamelCaseCommentWithBreaks = z.int(); 17 + 18 + /** 19 + * Testing multiline comments in string: First line 20 + * Second line 21 + * 22 + * Fourth line 23 + */ 24 + export const zCommentWithBreaks = z.int(); 25 + 26 + /** 27 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 28 + */ 29 + export const zCommentWithBackticks = z.int(); 30 + 31 + /** 32 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 33 + */ 34 + export const zCommentWithBackticksAndQuotes = z.int(); 35 + 36 + /** 37 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 38 + */ 39 + export const zCommentWithSlashes = z.int(); 40 + 41 + /** 42 + * Testing expression placeholders in string: ${expression} should work 43 + */ 44 + export const zCommentWithExpressionPlaceholders = z.int(); 45 + 46 + /** 47 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 48 + */ 49 + export const zCommentWithQuotes = z.int(); 50 + 51 + /** 52 + * Testing reserved characters in string: * inline * and ** inline ** should work 53 + */ 54 + export const zCommentWithReservedCharacters = z.int(); 55 + 56 + /** 57 + * This is a simple number 58 + */ 59 + export const zSimpleInteger = z.int(); 60 + 61 + /** 62 + * This is a simple boolean 63 + */ 64 + export const zSimpleBoolean = z.boolean(); 65 + 66 + /** 67 + * This is a simple string 68 + */ 69 + export const zSimpleString = z.string(); 70 + 71 + /** 72 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 73 + */ 74 + export const zNonAsciiStringæøåÆøÅöôêÊ字符串 = z.string(); 75 + 76 + /** 77 + * This is a simple file 78 + */ 79 + export const zSimpleFile = z.string(); 80 + 81 + /** 82 + * This is a model with one string property 83 + */ 84 + export const zModelWithString = z.object({ 85 + prop: z.optional(z.string()) 86 + }); 87 + 88 + /** 89 + * This is a simple reference 90 + */ 91 + export const zSimpleReference = zModelWithString; 92 + 93 + /** 94 + * This is a simple string 95 + */ 96 + export const zSimpleStringWithPattern = z.union([ 97 + z.string().check(z.maxLength(64), z.regex(/^[a-zA-Z0-9_]*$/)), 98 + z.null() 99 + ]); 100 + 101 + /** 102 + * This is a simple enum with strings 103 + */ 104 + export const zEnumWithStrings = z.enum([ 105 + 'Success', 106 + 'Warning', 107 + 'Error', 108 + "'Single Quote'", 109 + '"Double Quotes"', 110 + 'Non-ascii: øæåôöØÆÅÔÖ字符串' 111 + ]); 112 + 113 + export const zEnumWithReplacedCharacters = z.enum([ 114 + "'Single Quote'", 115 + '"Double Quotes"', 116 + 'øæåôöØÆÅÔÖ字符串', 117 + '' 118 + ]); 119 + 120 + /** 121 + * This is a simple enum with numbers 122 + */ 123 + export const zEnumWithNumbers = z.unknown(); 124 + 125 + /** 126 + * Success=1,Warning=2,Error=3 127 + */ 128 + export const zEnumFromDescription = z.number(); 129 + 130 + /** 131 + * This is a simple enum with numbers 132 + */ 133 + export const zEnumWithExtensions = z.unknown(); 134 + 135 + export const zEnumWithXEnumNames = z.unknown(); 136 + 137 + /** 138 + * This is a simple array with numbers 139 + */ 140 + export const zArrayWithNumbers = z.array(z.int()); 141 + 142 + /** 143 + * This is a simple array with booleans 144 + */ 145 + export const zArrayWithBooleans = z.array(z.boolean()); 146 + 147 + /** 148 + * This is a simple array with strings 149 + */ 150 + export const zArrayWithStrings = z._default(z.array(z.string()), ['test']); 151 + 152 + /** 153 + * This is a simple array with references 154 + */ 155 + export const zArrayWithReferences = z.array(zModelWithString); 156 + 157 + /** 158 + * This is a simple array containing an array 159 + */ 160 + export const zArrayWithArray = z.array(z.array(zModelWithString)); 161 + 162 + /** 163 + * This is a simple array with properties 164 + */ 165 + export const zArrayWithProperties = z.array(z.object({ 166 + '16x16': z.optional(zCamelCaseCommentWithBreaks), 167 + bar: z.optional(z.string()) 168 + })); 169 + 170 + /** 171 + * This is a simple array with any of properties 172 + */ 173 + export const zArrayWithAnyOfProperties = z.array(z.union([ 174 + z.object({ 175 + foo: z._default(z.optional(z.string()), 'test') 176 + }), 177 + z.object({ 178 + bar: z.optional(z.string()) 179 + }) 180 + ])); 181 + 182 + export const zAnyOfAnyAndNull = z.object({ 183 + data: z.optional(z.union([ 184 + z.unknown(), 185 + z.null() 186 + ])) 187 + }); 188 + 189 + /** 190 + * This is a simple array with any of properties 191 + */ 192 + export const zAnyOfArrays = z.object({ 193 + results: z.optional(z.array(z.union([ 194 + z.object({ 195 + foo: z.optional(z.string()) 196 + }), 197 + z.object({ 198 + bar: z.optional(z.string()) 199 + }) 200 + ]))) 201 + }); 202 + 203 + /** 204 + * This is a string dictionary 205 + */ 206 + export const zDictionaryWithString = z.object({}); 207 + 208 + export const zDictionaryWithPropertiesAndAdditionalProperties = z.object({ 209 + foo: z.optional(z.number()), 210 + bar: z.optional(z.boolean()) 211 + }); 212 + 213 + /** 214 + * This is a string reference 215 + */ 216 + export const zDictionaryWithReference = z.object({}); 217 + 218 + /** 219 + * This is a complex dictionary 220 + */ 221 + export const zDictionaryWithArray = z.object({}); 222 + 223 + /** 224 + * This is a string dictionary 225 + */ 226 + export const zDictionaryWithDictionary = z.record(z.string(), z.object({})); 227 + 228 + /** 229 + * This is a complex dictionary 230 + */ 231 + export const zDictionaryWithProperties = z.record(z.string(), z.object({ 232 + foo: z.optional(z.string()), 233 + bar: z.optional(z.string()) 234 + })); 235 + 236 + /** 237 + * This is a model with one number property 238 + */ 239 + export const zModelWithInteger = z.object({ 240 + prop: z.optional(z.int()) 241 + }); 242 + 243 + /** 244 + * This is a model with one boolean property 245 + */ 246 + export const zModelWithBoolean = z.object({ 247 + prop: z.optional(z.boolean()) 248 + }); 249 + 250 + /** 251 + * This is a model with one string property 252 + */ 253 + export const zModelWithStringError = z.object({ 254 + prop: z.optional(z.string()) 255 + }); 256 + 257 + /** 258 + * `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) 259 + */ 260 + export const zModelFromZendesk = z.string(); 261 + 262 + /** 263 + * This is a model with one string property 264 + */ 265 + export const zModelWithNullableString = z.object({ 266 + nullableProp1: z.optional(z.union([ 267 + z.string(), 268 + z.null() 269 + ])), 270 + nullableRequiredProp1: z.union([ 271 + z.string(), 272 + z.null() 273 + ]), 274 + nullableProp2: z.optional(z.union([ 275 + z.string(), 276 + z.null() 277 + ])), 278 + nullableRequiredProp2: z.union([ 279 + z.string(), 280 + z.null() 281 + ]), 282 + 'foo_bar-enum': z.optional(z.enum([ 283 + 'Success', 284 + 'Warning', 285 + 'Error', 286 + 'ØÆÅ字符串' 287 + ])) 288 + }); 289 + 290 + /** 291 + * This is a model with one enum 292 + */ 293 + export const zModelWithEnum = z.object({ 294 + 'foo_bar-enum': z.optional(z.enum([ 295 + 'Success', 296 + 'Warning', 297 + 'Error', 298 + 'ØÆÅ字符串' 299 + ])), 300 + statusCode: z.optional(z.enum([ 301 + '100', 302 + '200 FOO', 303 + '300 FOO_BAR', 304 + '400 foo-bar', 305 + '500 foo.bar', 306 + '600 foo&bar' 307 + ])), 308 + bool: z.optional(z.unknown()) 309 + }); 310 + 311 + /** 312 + * This is a model with one enum with escaped name 313 + */ 314 + export const zModelWithEnumWithHyphen = z.object({ 315 + 'foo-bar-baz-qux': z.optional(z.enum([ 316 + '3.0' 317 + ])) 318 + }); 319 + 320 + /** 321 + * This is a model with one enum 322 + */ 323 + export const zModelWithEnumFromDescription = z.object({ 324 + test: z.optional(z.int()) 325 + }); 326 + 327 + /** 328 + * This is a model with nested enums 329 + */ 330 + export const zModelWithNestedEnums = z.object({ 331 + dictionaryWithEnum: z.optional(z.object({})), 332 + dictionaryWithEnumFromDescription: z.optional(z.object({})), 333 + arrayWithEnum: z.optional(z.array(z.enum([ 334 + 'Success', 335 + 'Warning', 336 + 'Error' 337 + ]))), 338 + arrayWithDescription: z.optional(z.array(z.int())), 339 + 'foo_bar-enum': z.optional(z.enum([ 340 + 'Success', 341 + 'Warning', 342 + 'Error', 343 + 'ØÆÅ字符串' 344 + ])) 345 + }); 346 + 347 + /** 348 + * This is a model with one nested property 349 + */ 350 + export const zModelWithProperties = z.object({ 351 + required: z.string(), 352 + requiredAndReadOnly: z.readonly(z.string()), 353 + requiredAndNullable: z.union([ 354 + z.string(), 355 + z.null() 356 + ]), 357 + string: z.optional(z.string()), 358 + number: z.optional(z.number()), 359 + boolean: z.optional(z.boolean()), 360 + reference: z.optional(zModelWithString), 361 + 'property with space': z.optional(z.string()), 362 + default: z.optional(z.string()), 363 + try: z.optional(z.string()), 364 + '@namespace.string': z.optional(z.readonly(z.string())), 365 + '@namespace.integer': z.optional(z.readonly(z.int())) 366 + }); 367 + 368 + /** 369 + * This is a model with one property containing a reference 370 + */ 371 + export const zModelWithReference = z.object({ 372 + prop: z.optional(zModelWithProperties) 373 + }); 374 + 375 + export const zModelWithReadOnlyAndWriteOnly = z.object({ 376 + foo: z.string(), 377 + bar: z.readonly(z.string()) 378 + }); 379 + 380 + /** 381 + * This is a model with one property containing an array 382 + */ 383 + export const zModelWithArrayReadOnlyAndWriteOnly = z.object({ 384 + prop: z.optional(z.array(zModelWithReadOnlyAndWriteOnly)), 385 + propWithFile: z.optional(z.array(z.string())), 386 + propWithNumber: z.optional(z.array(z.number())) 387 + }); 388 + 389 + /** 390 + * This is a model with one property containing an array 391 + */ 392 + export const zModelWithArray = z.object({ 393 + prop: z.optional(z.array(zModelWithString)), 394 + propWithFile: z.optional(z.array(z.string())), 395 + propWithNumber: z.optional(z.array(z.number())) 396 + }); 397 + 398 + /** 399 + * This is a model with one property containing a dictionary 400 + */ 401 + export const zModelWithDictionary = z.object({ 402 + prop: z.optional(z.object({})) 403 + }); 404 + 405 + /** 406 + * This is a deprecated model with a deprecated property 407 + * @deprecated 408 + */ 409 + export const zDeprecatedModel = z.object({ 410 + prop: z.optional(z.string()) 411 + }); 412 + 413 + /** 414 + * This is a model with one property containing a circular reference 415 + */ 416 + export const zModelWithCircularReference = z.object({ 417 + prop: z.optional(z.lazy(() => { 418 + return zModelWithCircularReference; 419 + })) 420 + }); 421 + 422 + /** 423 + * This is a model with one property with a 'one of' relationship 424 + */ 425 + export const zCompositionWithOneOf = z.object({ 426 + propA: z.optional(z.union([ 427 + zModelWithString, 428 + zModelWithEnum, 429 + zModelWithArray, 430 + zModelWithDictionary 431 + ])) 432 + }); 433 + 434 + /** 435 + * This is a model with one property with a 'one of' relationship where the options are not $ref 436 + */ 437 + export const zCompositionWithOneOfAnonymous = z.object({ 438 + propA: z.optional(z.union([ 439 + z.object({ 440 + propA: z.optional(z.string()) 441 + }), 442 + z.string(), 443 + z.int() 444 + ])) 445 + }); 446 + 447 + /** 448 + * Circle 449 + */ 450 + export const zModelCircle = z.object({ 451 + kind: z.string(), 452 + radius: z.optional(z.number()) 453 + }); 454 + 455 + /** 456 + * Square 457 + */ 458 + export const zModelSquare = z.object({ 459 + kind: z.string(), 460 + sideLength: z.optional(z.number()) 461 + }); 462 + 463 + /** 464 + * This is a model with one property with a 'one of' relationship where the options are not $ref 465 + */ 466 + export const zCompositionWithOneOfDiscriminator = z.union([ 467 + z.intersection(z.object({ 468 + kind: z.literal('circle') 469 + }), zModelCircle), 470 + z.intersection(z.object({ 471 + kind: z.literal('square') 472 + }), zModelSquare) 473 + ]); 474 + 475 + /** 476 + * This is a model with one property with a 'any of' relationship 477 + */ 478 + export const zCompositionWithAnyOf = z.object({ 479 + propA: z.optional(z.union([ 480 + zModelWithString, 481 + zModelWithEnum, 482 + zModelWithArray, 483 + zModelWithDictionary 484 + ])) 485 + }); 486 + 487 + /** 488 + * This is a model with one property with a 'any of' relationship where the options are not $ref 489 + */ 490 + export const zCompositionWithAnyOfAnonymous = z.object({ 491 + propA: z.optional(z.union([ 492 + z.object({ 493 + propA: z.optional(z.string()) 494 + }), 495 + z.string(), 496 + z.int() 497 + ])) 498 + }); 499 + 500 + /** 501 + * This is a model with nested 'any of' property with a type null 502 + */ 503 + export const zCompositionWithNestedAnyAndTypeNull = z.object({ 504 + propA: z.optional(z.union([ 505 + z.array(z.union([ 506 + zModelWithDictionary, 507 + z.null() 508 + ])), 509 + z.array(z.union([ 510 + zModelWithArray, 511 + z.null() 512 + ])) 513 + ])) 514 + }); 515 + 516 + export const z3eNum1Период = z.enum([ 517 + 'Bird', 518 + 'Dog' 519 + ]); 520 + 521 + export const zConstValue = z.literal('ConstValue'); 522 + 523 + /** 524 + * This is a model with one property with a 'any of' relationship where the options are not $ref 525 + */ 526 + export const zCompositionWithNestedAnyOfAndNull = z.object({ 527 + propA: z.optional(z.union([ 528 + z.array(z.union([ 529 + z3eNum1Период, 530 + zConstValue 531 + ])), 532 + z.null() 533 + ])) 534 + }); 535 + 536 + /** 537 + * This is a model with one property with a 'one of' relationship 538 + */ 539 + export const zCompositionWithOneOfAndNullable = z.object({ 540 + propA: z.optional(z.union([ 541 + z.object({ 542 + boolean: z.optional(z.boolean()) 543 + }), 544 + zModelWithEnum, 545 + zModelWithArray, 546 + zModelWithDictionary, 547 + z.null() 548 + ])) 549 + }); 550 + 551 + /** 552 + * This is a model that contains a simple dictionary within composition 553 + */ 554 + export const zCompositionWithOneOfAndSimpleDictionary = z.object({ 555 + propA: z.optional(z.union([ 556 + z.boolean(), 557 + z.object({}) 558 + ])) 559 + }); 560 + 561 + /** 562 + * This is a model that contains a dictionary of simple arrays within composition 563 + */ 564 + export const zCompositionWithOneOfAndSimpleArrayDictionary = z.object({ 565 + propA: z.optional(z.union([ 566 + z.boolean(), 567 + z.object({}) 568 + ])) 569 + }); 570 + 571 + /** 572 + * This is a model that contains a dictionary of complex arrays (composited) within composition 573 + */ 574 + export const zCompositionWithOneOfAndComplexArrayDictionary = z.object({ 575 + propA: z.optional(z.union([ 576 + z.boolean(), 577 + z.object({}) 578 + ])) 579 + }); 580 + 581 + /** 582 + * This is a model with one property with a 'all of' relationship 583 + */ 584 + export const zCompositionWithAllOfAndNullable = z.object({ 585 + propA: z.optional(z.union([ 586 + z.intersection(z.intersection(z.intersection(z.object({ 587 + boolean: z.optional(z.boolean()) 588 + }), zModelWithEnum), zModelWithArray), zModelWithDictionary), 589 + z.null() 590 + ])) 591 + }); 592 + 593 + /** 594 + * This is a model with one property with a 'any of' relationship 595 + */ 596 + export const zCompositionWithAnyOfAndNullable = z.object({ 597 + propA: z.optional(z.union([ 598 + z.object({ 599 + boolean: z.optional(z.boolean()) 600 + }), 601 + zModelWithEnum, 602 + zModelWithArray, 603 + zModelWithDictionary, 604 + z.null() 605 + ])) 606 + }); 607 + 608 + /** 609 + * This is a base model with two simple optional properties 610 + */ 611 + export const zCompositionBaseModel = z.object({ 612 + firstName: z.optional(z.string()), 613 + lastname: z.optional(z.string()) 614 + }); 615 + 616 + /** 617 + * This is a model that extends the base model 618 + */ 619 + export const zCompositionExtendedModel = z.intersection(zCompositionBaseModel, z.object({ 620 + age: z.number(), 621 + firstName: z.string(), 622 + lastname: z.string() 623 + })); 624 + 625 + /** 626 + * This is a model with one nested property 627 + */ 628 + export const zModelWithNestedProperties = z.object({ 629 + first: z.readonly(z.union([ 630 + z.readonly(z.object({ 631 + second: z.readonly(z.union([ 632 + z.readonly(z.object({ 633 + third: z.readonly(z.union([ 634 + z.readonly(z.string()), 635 + z.null() 636 + ])) 637 + })), 638 + z.null() 639 + ])) 640 + })), 641 + z.null() 642 + ])) 643 + }); 644 + 645 + /** 646 + * This is a model with duplicated properties 647 + */ 648 + export const zModelWithDuplicateProperties = z.object({ 649 + prop: z.optional(zModelWithString) 650 + }); 651 + 652 + /** 653 + * This is a model with ordered properties 654 + */ 655 + export const zModelWithOrderedProperties = z.object({ 656 + zebra: z.optional(z.string()), 657 + apple: z.optional(z.string()), 658 + hawaii: z.optional(z.string()) 659 + }); 660 + 661 + /** 662 + * This is a model with duplicated imports 663 + */ 664 + export const zModelWithDuplicateImports = z.object({ 665 + propA: z.optional(zModelWithString), 666 + propB: z.optional(zModelWithString), 667 + propC: z.optional(zModelWithString) 668 + }); 669 + 670 + /** 671 + * This is a model that extends another model 672 + */ 673 + export const zModelThatExtends = z.intersection(zModelWithString, z.object({ 674 + propExtendsA: z.optional(z.string()), 675 + propExtendsB: z.optional(zModelWithString) 676 + })); 677 + 678 + /** 679 + * This is a model that extends another model 680 + */ 681 + export const zModelThatExtendsExtends = z.intersection(z.intersection(zModelWithString, zModelThatExtends), z.object({ 682 + propExtendsC: z.optional(z.string()), 683 + propExtendsD: z.optional(zModelWithString) 684 + })); 685 + 686 + /** 687 + * This is a model that contains a some patterns 688 + */ 689 + export const zModelWithPattern = z.object({ 690 + key: z.string().check(z.maxLength(64), z.regex(/^[a-zA-Z0-9_]*$/)), 691 + name: z.string().check(z.maxLength(255)), 692 + enabled: z.optional(z.readonly(z.boolean())), 693 + modified: z.optional(z.readonly(z.iso.datetime())), 694 + id: z.optional(z.string().check(z.regex(/^\d{2}-\d{3}-\d{4}$/))), 695 + text: z.optional(z.string().check(z.regex(/^\w+$/))), 696 + patternWithSingleQuotes: z.optional(z.string().check(z.regex(/^[a-zA-Z0-9']*$/))), 697 + patternWithNewline: z.optional(z.string().check(z.regex(/aaa\nbbb/))), 698 + patternWithBacktick: z.optional(z.string().check(z.regex(/aaa`bbb/))) 699 + }); 700 + 701 + export const zFile = z.object({ 702 + id: z.optional(z.readonly(z.string().check(z.minLength(1)))), 703 + updated_at: z.optional(z.readonly(z.iso.datetime())), 704 + created_at: z.optional(z.readonly(z.iso.datetime())), 705 + mime: z.string().check(z.minLength(1), z.maxLength(24)), 706 + file: z.optional(z.readonly(z.url())) 707 + }); 708 + 709 + export const zDefault = z.object({ 710 + name: z.optional(z.string()) 711 + }); 712 + 713 + export const zPageable = z.object({ 714 + page: z._default(z.optional(z.int().check(z.gte(0))), 0), 715 + size: z.optional(z.int().check(z.gte(1))), 716 + sort: z.optional(z.array(z.string())) 717 + }); 718 + 719 + /** 720 + * This is a free-form object without additionalProperties. 721 + */ 722 + export const zFreeFormObjectWithoutAdditionalProperties = z.object({}); 723 + 724 + /** 725 + * This is a free-form object with additionalProperties: true. 726 + */ 727 + export const zFreeFormObjectWithAdditionalPropertiesEqTrue = z.object({}); 728 + 729 + /** 730 + * This is a free-form object with additionalProperties: {}. 731 + */ 732 + export const zFreeFormObjectWithAdditionalPropertiesEqEmptyObject = z.object({}); 733 + 734 + export const zModelWithConst = z.object({ 735 + String: z.optional(z.literal('String')), 736 + number: z.optional(z.literal(0)), 737 + null: z.optional(z.null()), 738 + withType: z.optional(z.literal('Some string')) 739 + }); 740 + 741 + /** 742 + * This is a model with one property and additionalProperties: true 743 + */ 744 + export const zModelWithAdditionalPropertiesEqTrue = z.object({ 745 + prop: z.optional(z.string()) 746 + }); 747 + 748 + export const zNestedAnyOfArraysNullable = z.object({ 749 + nullableArray: z.optional(z.union([ 750 + z.array(z.union([ 751 + z.string(), 752 + z.boolean() 753 + ])), 754 + z.null() 755 + ])) 756 + }); 757 + 758 + /** 759 + * This is a reusable parameter 760 + */ 761 + export const zSimpleParameter = z.unknown(); 762 + 763 + export const zCompositionWithOneOfAndProperties = z.intersection(z.union([ 764 + z.object({ 765 + foo: zSimpleParameter 766 + }), 767 + z.object({ 768 + bar: zNonAsciiStringæøåÆøÅöôêÊ字符串 769 + }) 770 + ]), z.object({ 771 + baz: z.union([ 772 + z.int().check(z.gte(0)), 773 + z.null() 774 + ]), 775 + qux: z.int().check(z.gte(0)) 776 + })); 777 + 778 + /** 779 + * An object that can be null 780 + */ 781 + export const zNullableObject = z._default(z.union([ 782 + z.object({ 783 + foo: z.optional(z.string()) 784 + }), 785 + z.null() 786 + ]), null); 787 + 788 + /** 789 + * Some % character 790 + */ 791 + export const zCharactersInDescription = z.string(); 792 + 793 + export const zModelWithNullableObject = z.object({ 794 + data: z.optional(zNullableObject) 795 + }); 796 + 797 + export const zModelWithOneOfEnum = z.union([ 798 + z.object({ 799 + foo: z.enum([ 800 + 'Bar' 801 + ]) 802 + }), 803 + z.object({ 804 + foo: z.enum([ 805 + 'Baz' 806 + ]) 807 + }), 808 + z.object({ 809 + foo: z.enum([ 810 + 'Qux' 811 + ]) 812 + }), 813 + z.object({ 814 + content: z.iso.datetime(), 815 + foo: z.enum([ 816 + 'Quux' 817 + ]) 818 + }), 819 + z.object({ 820 + content: z.tuple([ 821 + z.iso.datetime(), 822 + z.string() 823 + ]), 824 + foo: z.enum([ 825 + 'Corge' 826 + ]) 827 + }) 828 + ]); 829 + 830 + export const zModelWithNestedArrayEnumsDataFoo = z.enum([ 831 + 'foo', 832 + 'bar' 833 + ]); 834 + 835 + export const zModelWithNestedArrayEnumsDataBar = z.enum([ 836 + 'baz', 837 + 'qux' 838 + ]); 839 + 840 + export const zModelWithNestedArrayEnumsData = z.object({ 841 + foo: z.optional(z.array(zModelWithNestedArrayEnumsDataFoo)), 842 + bar: z.optional(z.array(zModelWithNestedArrayEnumsDataBar)) 843 + }); 844 + 845 + export const zModelWithNestedArrayEnums = z.object({ 846 + array_strings: z.optional(z.array(z.string())), 847 + data: z.optional(zModelWithNestedArrayEnumsData) 848 + }); 849 + 850 + export const zModelWithNestedCompositionEnums = z.object({ 851 + foo: z.optional(zModelWithNestedArrayEnumsDataFoo) 852 + }); 853 + 854 + export const zModelWithConstantSizeArray = z.tuple([ 855 + z.number(), 856 + z.number() 857 + ]); 858 + 859 + export const zModelWithAnyOfConstantSizeArray = z.tuple([ 860 + z.union([ 861 + z.number(), 862 + z.string() 863 + ]), 864 + z.union([ 865 + z.number(), 866 + z.string() 867 + ]), 868 + z.union([ 869 + z.number(), 870 + z.string() 871 + ]) 872 + ]); 873 + 874 + export const zModelWithPrefixItemsConstantSizeArray = z.tuple([ 875 + zModelWithInteger, 876 + z.union([ 877 + z.number(), 878 + z.string() 879 + ]), 880 + z.string() 881 + ]); 882 + 883 + export const zModelWithAnyOfConstantSizeArrayNullable = z.tuple([ 884 + z.union([ 885 + z.number(), 886 + z.null(), 887 + z.string() 888 + ]), 889 + z.union([ 890 + z.number(), 891 + z.null(), 892 + z.string() 893 + ]), 894 + z.union([ 895 + z.number(), 896 + z.null(), 897 + z.string() 898 + ]) 899 + ]); 900 + 901 + /** 902 + * Model with restricted keyword name 903 + */ 904 + export const zImport = z.string(); 905 + 906 + export const zModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = z.tuple([ 907 + z.union([ 908 + z.number(), 909 + zImport 910 + ]), 911 + z.union([ 912 + z.number(), 913 + zImport 914 + ]) 915 + ]); 916 + 917 + export const zModelWithAnyOfConstantSizeArrayAndIntersect = z.tuple([ 918 + z.intersection(z.number(), z.string()), 919 + z.intersection(z.number(), z.string()) 920 + ]); 921 + 922 + export const zModelWithNumericEnumUnion = z.object({ 923 + value: z.optional(z.unknown()) 924 + }); 925 + 926 + /** 927 + * Some description with `back ticks` 928 + */ 929 + export const zModelWithBackticksInDescription = z.object({ 930 + template: z.optional(z.string()) 931 + }); 932 + 933 + export const zModelWithOneOfAndProperties = z.intersection(z.union([ 934 + zSimpleParameter, 935 + zNonAsciiStringæøåÆøÅöôêÊ字符串 936 + ]), z.object({ 937 + baz: z.union([ 938 + z.int().check(z.gte(0)), 939 + z.null() 940 + ]), 941 + qux: z.int().check(z.gte(0)) 942 + })); 943 + 944 + /** 945 + * Model used to test deduplication strategy (unused) 946 + */ 947 + export const zParameterSimpleParameterUnused = z.string(); 948 + 949 + /** 950 + * Model used to test deduplication strategy 951 + */ 952 + export const zPostServiceWithEmptyTagResponse = z.string(); 953 + 954 + /** 955 + * Model used to test deduplication strategy 956 + */ 957 + export const zPostServiceWithEmptyTagResponse2 = z.string(); 958 + 959 + /** 960 + * Model used to test deduplication strategy 961 + */ 962 + export const zDeleteFooData = z.string(); 963 + 964 + /** 965 + * Model used to test deduplication strategy 966 + */ 967 + export const zDeleteFooData2 = z.string(); 968 + 969 + export const zSchemaWithFormRestrictedKeys = z.object({ 970 + description: z.optional(z.string()), 971 + 'x-enum-descriptions': z.optional(z.string()), 972 + 'x-enum-varnames': z.optional(z.string()), 973 + 'x-enumNames': z.optional(z.string()), 974 + title: z.optional(z.string()), 975 + object: z.optional(z.object({ 976 + description: z.optional(z.string()), 977 + 'x-enum-descriptions': z.optional(z.string()), 978 + 'x-enum-varnames': z.optional(z.string()), 979 + 'x-enumNames': z.optional(z.string()), 980 + title: z.optional(z.string()) 981 + })), 982 + array: z.optional(z.array(z.object({ 983 + description: z.optional(z.string()), 984 + 'x-enum-descriptions': z.optional(z.string()), 985 + 'x-enum-varnames': z.optional(z.string()), 986 + 'x-enumNames': z.optional(z.string()), 987 + title: z.optional(z.string()) 988 + }))) 989 + }); 990 + 991 + /** 992 + * This schema was giving PascalCase transformations a hard time 993 + */ 994 + export const zIoK8sApimachineryPkgApisMetaV1Preconditions = z.object({ 995 + resourceVersion: z.optional(z.string()), 996 + uid: z.optional(z.string()) 997 + }); 998 + 999 + /** 1000 + * This schema was giving PascalCase transformations a hard time 1001 + */ 1002 + export const zIoK8sApimachineryPkgApisMetaV1DeleteOptions = z.object({ 1003 + preconditions: z.optional(zIoK8sApimachineryPkgApisMetaV1Preconditions) 1004 + }); 1005 + 1006 + export const zAdditionalPropertiesUnknownIssue = z.object({}); 1007 + 1008 + export const zAdditionalPropertiesUnknownIssue2 = z.object({}); 1009 + 1010 + export const zAdditionalPropertiesUnknownIssue3 = z.intersection(z.string(), z.object({ 1011 + entries: z.object({}) 1012 + })); 1013 + 1014 + export const zAdditionalPropertiesIntegerIssue = z.object({ 1015 + value: z.int() 1016 + }); 1017 + 1018 + export const zGenericSchemaDuplicateIssue1SystemBoolean = z.object({ 1019 + item: z.optional(z.boolean()), 1020 + error: z.optional(z.union([ 1021 + z.string(), 1022 + z.null() 1023 + ])), 1024 + hasError: z.optional(z.readonly(z.boolean())), 1025 + data: z.optional(z.object({})) 1026 + }); 1027 + 1028 + export const zGenericSchemaDuplicateIssue1SystemString = z.object({ 1029 + item: z.optional(z.union([ 1030 + z.string(), 1031 + z.null() 1032 + ])), 1033 + error: z.optional(z.union([ 1034 + z.string(), 1035 + z.null() 1036 + ])), 1037 + hasError: z.optional(z.readonly(z.boolean())) 1038 + }); 1039 + 1040 + export const zOneOfAllOfIssue = z.union([ 1041 + z.intersection(z.union([ 1042 + zConstValue, 1043 + zGenericSchemaDuplicateIssue1SystemBoolean 1044 + ]), z3eNum1Период), 1045 + zGenericSchemaDuplicateIssue1SystemString 1046 + ]); 1047 + 1048 + /** 1049 + * Model with number-only name 1050 + */ 1051 + export const z400Writable = z.string(); 1052 + 1053 + /** 1054 + * Testing multiline comments in string: First line 1055 + * Second line 1056 + * 1057 + * Fourth line 1058 + */ 1059 + export const zCamelCaseCommentWithBreaksWritable = z.int(); 1060 + 1061 + /** 1062 + * Testing multiline comments in string: First line 1063 + * Second line 1064 + * 1065 + * Fourth line 1066 + */ 1067 + export const zCommentWithBreaksWritable = z.int(); 1068 + 1069 + /** 1070 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1071 + */ 1072 + export const zCommentWithBackticksWritable = z.int(); 1073 + 1074 + /** 1075 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 1076 + */ 1077 + export const zCommentWithBackticksAndQuotesWritable = z.int(); 1078 + 1079 + /** 1080 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1081 + */ 1082 + export const zCommentWithSlashesWritable = z.int(); 1083 + 1084 + /** 1085 + * Testing expression placeholders in string: ${expression} should work 1086 + */ 1087 + export const zCommentWithExpressionPlaceholdersWritable = z.int(); 1088 + 1089 + /** 1090 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1091 + */ 1092 + export const zCommentWithQuotesWritable = z.int(); 1093 + 1094 + /** 1095 + * Testing reserved characters in string: * inline * and ** inline ** should work 1096 + */ 1097 + export const zCommentWithReservedCharactersWritable = z.int(); 1098 + 1099 + /** 1100 + * This is a simple number 1101 + */ 1102 + export const zSimpleIntegerWritable = z.int(); 1103 + 1104 + /** 1105 + * This is a simple boolean 1106 + */ 1107 + export const zSimpleBooleanWritable = z.boolean(); 1108 + 1109 + /** 1110 + * This is a simple string 1111 + */ 1112 + export const zSimpleStringWritable = z.string(); 1113 + 1114 + /** 1115 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 1116 + */ 1117 + export const zNonAsciiStringæøåÆøÅöôêÊ字符串Writable = z.string(); 1118 + 1119 + /** 1120 + * This is a simple file 1121 + */ 1122 + export const zSimpleFileWritable = z.string(); 1123 + 1124 + /** 1125 + * This is a simple string 1126 + */ 1127 + export const zSimpleStringWithPatternWritable = z.union([ 1128 + z.string().check(z.maxLength(64), z.regex(/^[a-zA-Z0-9_]*$/)), 1129 + z.null() 1130 + ]); 1131 + 1132 + /** 1133 + * This is a simple enum with strings 1134 + */ 1135 + export const zEnumWithStringsWritable = z.enum([ 1136 + 'Success', 1137 + 'Warning', 1138 + 'Error', 1139 + "'Single Quote'", 1140 + '"Double Quotes"', 1141 + 'Non-ascii: øæåôöØÆÅÔÖ字符串' 1142 + ]); 1143 + 1144 + export const zEnumWithReplacedCharactersWritable = z.enum([ 1145 + "'Single Quote'", 1146 + '"Double Quotes"', 1147 + 'øæåôöØÆÅÔÖ字符串', 1148 + '' 1149 + ]); 1150 + 1151 + /** 1152 + * This is a simple enum with numbers 1153 + */ 1154 + export const zEnumWithNumbersWritable = z.unknown(); 1155 + 1156 + /** 1157 + * Success=1,Warning=2,Error=3 1158 + */ 1159 + export const zEnumFromDescriptionWritable = z.number(); 1160 + 1161 + /** 1162 + * This is a simple enum with numbers 1163 + */ 1164 + export const zEnumWithExtensionsWritable = z.unknown(); 1165 + 1166 + export const zEnumWithXEnumNamesWritable = z.unknown(); 1167 + 1168 + /** 1169 + * This is a simple array with numbers 1170 + */ 1171 + export const zArrayWithNumbersWritable = z.array(z.int()); 1172 + 1173 + /** 1174 + * This is a simple array with booleans 1175 + */ 1176 + export const zArrayWithBooleansWritable = z.array(z.boolean()); 1177 + 1178 + /** 1179 + * This is a simple array with strings 1180 + */ 1181 + export const zArrayWithStringsWritable = z._default(z.array(z.string()), ['test']); 1182 + 1183 + /** 1184 + * This is a string dictionary 1185 + */ 1186 + export const zDictionaryWithStringWritable = z.object({}); 1187 + 1188 + /** 1189 + * This is a string dictionary 1190 + */ 1191 + export const zDictionaryWithDictionaryWritable = z.record(z.string(), z.object({})); 1192 + 1193 + /** 1194 + * `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) 1195 + */ 1196 + export const zModelFromZendeskWritable = z.string(); 1197 + 1198 + export const zModelWithReadOnlyAndWriteOnlyWritable = z.object({ 1199 + foo: z.string(), 1200 + baz: z.string() 1201 + }); 1202 + 1203 + /** 1204 + * This is a model with one property containing an array 1205 + */ 1206 + export const zModelWithArrayReadOnlyAndWriteOnlyWritable = z.object({ 1207 + prop: z.optional(z.array(zModelWithReadOnlyAndWriteOnlyWritable)), 1208 + propWithFile: z.optional(z.array(z.string())), 1209 + propWithNumber: z.optional(z.array(z.number())) 1210 + }); 1211 + 1212 + export const z3eNum1ПериодWritable = z.enum([ 1213 + 'Bird', 1214 + 'Dog' 1215 + ]); 1216 + 1217 + export const zConstValueWritable = z.literal('ConstValue'); 1218 + 1219 + /** 1220 + * This is a free-form object without additionalProperties. 1221 + */ 1222 + export const zFreeFormObjectWithoutAdditionalPropertiesWritable = z.object({}); 1223 + 1224 + /** 1225 + * This is a free-form object with additionalProperties: true. 1226 + */ 1227 + export const zFreeFormObjectWithAdditionalPropertiesEqTrueWritable = z.object({}); 1228 + 1229 + /** 1230 + * This is a free-form object with additionalProperties: {}. 1231 + */ 1232 + export const zFreeFormObjectWithAdditionalPropertiesEqEmptyObjectWritable = z.object({}); 1233 + 1234 + /** 1235 + * Some % character 1236 + */ 1237 + export const zCharactersInDescriptionWritable = z.string(); 1238 + 1239 + export const zModelWithNestedArrayEnumsDataFooWritable = z.enum([ 1240 + 'foo', 1241 + 'bar' 1242 + ]); 1243 + 1244 + export const zModelWithNestedArrayEnumsDataBarWritable = z.enum([ 1245 + 'baz', 1246 + 'qux' 1247 + ]); 1248 + 1249 + export const zModelWithConstantSizeArrayWritable = z.tuple([ 1250 + z.number(), 1251 + z.number() 1252 + ]); 1253 + 1254 + export const zModelWithAnyOfConstantSizeArrayWritable = z.tuple([ 1255 + z.union([ 1256 + z.number(), 1257 + z.string() 1258 + ]), 1259 + z.union([ 1260 + z.number(), 1261 + z.string() 1262 + ]), 1263 + z.union([ 1264 + z.number(), 1265 + z.string() 1266 + ]) 1267 + ]); 1268 + 1269 + export const zModelWithAnyOfConstantSizeArrayNullableWritable = z.tuple([ 1270 + z.union([ 1271 + z.number(), 1272 + z.null(), 1273 + z.string() 1274 + ]), 1275 + z.union([ 1276 + z.number(), 1277 + z.null(), 1278 + z.string() 1279 + ]), 1280 + z.union([ 1281 + z.number(), 1282 + z.null(), 1283 + z.string() 1284 + ]) 1285 + ]); 1286 + 1287 + /** 1288 + * Model with restricted keyword name 1289 + */ 1290 + export const zImportWritable = z.string(); 1291 + 1292 + export const zModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = z.tuple([ 1293 + z.union([ 1294 + z.number(), 1295 + zImportWritable 1296 + ]), 1297 + z.union([ 1298 + z.number(), 1299 + zImportWritable 1300 + ]) 1301 + ]); 1302 + 1303 + export const zModelWithAnyOfConstantSizeArrayAndIntersectWritable = z.tuple([ 1304 + z.intersection(z.number(), z.string()), 1305 + z.intersection(z.number(), z.string()) 1306 + ]); 1307 + 1308 + /** 1309 + * Model used to test deduplication strategy (unused) 1310 + */ 1311 + export const zParameterSimpleParameterUnusedWritable = z.string(); 1312 + 1313 + /** 1314 + * Model used to test deduplication strategy 1315 + */ 1316 + export const zPostServiceWithEmptyTagResponseWritable = z.string(); 1317 + 1318 + /** 1319 + * Model used to test deduplication strategy 1320 + */ 1321 + export const zPostServiceWithEmptyTagResponse2Writable = z.string(); 1322 + 1323 + /** 1324 + * Model used to test deduplication strategy 1325 + */ 1326 + export const zDeleteFooDataWritable = z.string(); 1327 + 1328 + /** 1329 + * Model used to test deduplication strategy 1330 + */ 1331 + export const zDeleteFooData2Writable = z.string(); 1332 + 1333 + export const zAdditionalPropertiesUnknownIssueWritable = z.object({}); 1334 + 1335 + export const zAdditionalPropertiesUnknownIssue2Writable = z.object({}); 1336 + 1337 + export const zOneOfAllOfIssueWritable = z.union([ 1338 + z.intersection(z.union([ 1339 + zConstValueWritable, 1340 + zGenericSchemaDuplicateIssue1SystemBoolean 1341 + ]), z3eNum1Период), 1342 + zGenericSchemaDuplicateIssue1SystemString 1343 + ]); 1344 + 1345 + /** 1346 + * Parameter with illegal characters 1347 + */ 1348 + export const zXFooBar = zModelWithString; 1349 + 1350 + /** 1351 + * A reusable request body 1352 + */ 1353 + export const zSimpleRequestBody = zModelWithString; 1354 + 1355 + /** 1356 + * A reusable request body 1357 + */ 1358 + export const zSimpleFormData = zModelWithString; 1359 + 1360 + export const zExportData = z.object({ 1361 + body: z.optional(z.never()), 1362 + path: z.optional(z.never()), 1363 + query: z.optional(z.never()) 1364 + }); 1365 + 1366 + export const zPatchApiVbyApiVersionNoTagData = z.object({ 1367 + body: z.optional(z.never()), 1368 + path: z.optional(z.never()), 1369 + query: z.optional(z.never()) 1370 + }); 1371 + 1372 + export const zImportData = z.object({ 1373 + body: z.union([ 1374 + zModelWithReadOnlyAndWriteOnlyWritable, 1375 + zModelWithArrayReadOnlyAndWriteOnlyWritable 1376 + ]), 1377 + path: z.optional(z.never()), 1378 + query: z.optional(z.never()) 1379 + }); 1380 + 1381 + export const zImportResponse = z.union([ 1382 + zModelFromZendesk, 1383 + zModelWithReadOnlyAndWriteOnly 1384 + ]); 1385 + 1386 + export const zFooWowData = z.object({ 1387 + body: z.optional(z.never()), 1388 + path: z.optional(z.never()), 1389 + query: z.optional(z.never()) 1390 + }); 1391 + 1392 + export const zApiVVersionODataControllerCountData = z.object({ 1393 + body: z.optional(z.never()), 1394 + path: z.optional(z.never()), 1395 + query: z.optional(z.never()) 1396 + }); 1397 + 1398 + /** 1399 + * Success 1400 + */ 1401 + export const zApiVVersionODataControllerCountResponse = zModelFromZendesk; 1402 + 1403 + export const zGetApiVbyApiVersionSimpleOperationData = z.object({ 1404 + body: z.optional(z.never()), 1405 + path: z.object({ 1406 + foo_param: z.union([ 1407 + z.string(), 1408 + z.uuid() 1409 + ]) 1410 + }), 1411 + query: z.optional(z.never()) 1412 + }); 1413 + 1414 + /** 1415 + * Response is a simple number 1416 + */ 1417 + export const zGetApiVbyApiVersionSimpleOperationResponse = z.number(); 1418 + 1419 + export const zDeleteCallWithoutParametersAndResponseData = z.object({ 1420 + body: z.optional(z.never()), 1421 + path: z.optional(z.never()), 1422 + query: z.optional(z.never()) 1423 + }); 1424 + 1425 + export const zGetCallWithoutParametersAndResponseData = z.object({ 1426 + body: z.optional(z.never()), 1427 + path: z.optional(z.never()), 1428 + query: z.optional(z.never()) 1429 + }); 1430 + 1431 + export const zHeadCallWithoutParametersAndResponseData = z.object({ 1432 + body: z.optional(z.never()), 1433 + path: z.optional(z.never()), 1434 + query: z.optional(z.never()) 1435 + }); 1436 + 1437 + export const zOptionsCallWithoutParametersAndResponseData = z.object({ 1438 + body: z.optional(z.never()), 1439 + path: z.optional(z.never()), 1440 + query: z.optional(z.never()) 1441 + }); 1442 + 1443 + export const zPatchCallWithoutParametersAndResponseData = z.object({ 1444 + body: z.optional(z.never()), 1445 + path: z.optional(z.never()), 1446 + query: z.optional(z.never()) 1447 + }); 1448 + 1449 + export const zPostCallWithoutParametersAndResponseData = z.object({ 1450 + body: z.optional(z.never()), 1451 + path: z.optional(z.never()), 1452 + query: z.optional(z.never()) 1453 + }); 1454 + 1455 + export const zPutCallWithoutParametersAndResponseData = z.object({ 1456 + body: z.optional(z.never()), 1457 + path: z.optional(z.never()), 1458 + query: z.optional(z.never()) 1459 + }); 1460 + 1461 + export const zDeleteFooData3 = z.object({ 1462 + body: z.optional(z.never()), 1463 + path: z.object({ 1464 + foo_param: z.string(), 1465 + BarParam: z.string() 1466 + }), 1467 + query: z.optional(z.never()), 1468 + headers: z.object({ 1469 + 'x-Foo-Bar': zModelWithString 1470 + }) 1471 + }); 1472 + 1473 + export const zCallWithDescriptionsData = z.object({ 1474 + body: z.optional(z.never()), 1475 + path: z.optional(z.never()), 1476 + query: z.optional(z.object({ 1477 + parameterWithBreaks: z.optional(z.string()), 1478 + parameterWithBackticks: z.optional(z.string()), 1479 + parameterWithSlashes: z.optional(z.string()), 1480 + parameterWithExpressionPlaceholders: z.optional(z.string()), 1481 + parameterWithQuotes: z.optional(z.string()), 1482 + parameterWithReservedCharacters: z.optional(z.string()) 1483 + })) 1484 + }); 1485 + 1486 + export const zDeprecatedCallData = z.object({ 1487 + body: z.optional(z.never()), 1488 + path: z.optional(z.never()), 1489 + query: z.optional(z.never()), 1490 + headers: z.object({ 1491 + parameter: z.union([ 1492 + zDeprecatedModel, 1493 + z.null() 1494 + ]) 1495 + }) 1496 + }); 1497 + 1498 + export const zCallWithParametersData = z.object({ 1499 + body: z.union([ 1500 + z.object({}), 1501 + z.null() 1502 + ]), 1503 + path: z.object({ 1504 + parameterPath: z.union([ 1505 + z.string(), 1506 + z.null() 1507 + ]), 1508 + 'api-version': z.union([ 1509 + z.string(), 1510 + z.null() 1511 + ]) 1512 + }), 1513 + query: z.object({ 1514 + foo_ref_enum: z.optional(zModelWithNestedArrayEnumsDataFooWritable), 1515 + foo_all_of_enum: zModelWithNestedArrayEnumsDataFooWritable, 1516 + cursor: z.union([ 1517 + z.string(), 1518 + z.null() 1519 + ]) 1520 + }), 1521 + headers: z.object({ 1522 + parameterHeader: z.union([ 1523 + z.string(), 1524 + z.null() 1525 + ]) 1526 + }) 1527 + }); 1528 + 1529 + export const zCallWithWeirdParameterNamesData = z.object({ 1530 + body: z.union([ 1531 + zModelWithString, 1532 + z.null() 1533 + ]), 1534 + path: z.object({ 1535 + 'parameter.path.1': z.optional(z.string()), 1536 + 'parameter-path-2': z.optional(z.string()), 1537 + 'PARAMETER-PATH-3': z.optional(z.string()), 1538 + 'api-version': z.union([ 1539 + z.string(), 1540 + z.null() 1541 + ]) 1542 + }), 1543 + query: z.object({ 1544 + default: z.optional(z.string()), 1545 + 'parameter-query': z.union([ 1546 + z.string(), 1547 + z.null() 1548 + ]) 1549 + }), 1550 + headers: z.object({ 1551 + 'parameter.header': z.union([ 1552 + z.string(), 1553 + z.null() 1554 + ]) 1555 + }) 1556 + }); 1557 + 1558 + export const zGetCallWithOptionalParamData = z.object({ 1559 + body: zModelWithOneOfEnum, 1560 + path: z.optional(z.never()), 1561 + query: z.optional(z.object({ 1562 + page: z.optional(z.number()) 1563 + })) 1564 + }); 1565 + 1566 + export const zPostCallWithOptionalParamData = z.object({ 1567 + body: z.optional(z.object({ 1568 + offset: z.optional(z.union([ 1569 + z.number(), 1570 + z.null() 1571 + ])) 1572 + })), 1573 + path: z.optional(z.never()), 1574 + query: z.object({ 1575 + parameter: zPageable 1576 + }) 1577 + }); 1578 + 1579 + export const zPostCallWithOptionalParamResponse = z.union([ 1580 + z.number(), 1581 + z.void() 1582 + ]); 1583 + 1584 + export const zPostApiVbyApiVersionRequestBodyData = z.object({ 1585 + body: z.optional(zSimpleRequestBody), 1586 + path: z.optional(z.never()), 1587 + query: z.optional(z.object({ 1588 + parameter: z.optional(z.string()) 1589 + })) 1590 + }); 1591 + 1592 + export const zPostApiVbyApiVersionFormDataData = z.object({ 1593 + body: z.optional(zSimpleFormData), 1594 + path: z.optional(z.never()), 1595 + query: z.optional(z.object({ 1596 + parameter: z.optional(z.string()) 1597 + })) 1598 + }); 1599 + 1600 + export const zCallWithDefaultParametersData = z.object({ 1601 + body: z.optional(z.never()), 1602 + path: z.optional(z.never()), 1603 + query: z.optional(z.object({ 1604 + parameterString: z._default(z.optional(z.union([ 1605 + z._default(z.string(), 'Hello World!'), 1606 + z.null() 1607 + ])), 'Hello World!'), 1608 + parameterNumber: z._default(z.optional(z.union([ 1609 + z._default(z.number(), 123), 1610 + z.null() 1611 + ])), 123), 1612 + parameterBoolean: z._default(z.optional(z.union([ 1613 + z._default(z.boolean(), true), 1614 + z.null() 1615 + ])), true), 1616 + parameterEnum: z.optional(z.enum([ 1617 + 'Success', 1618 + 'Warning', 1619 + 'Error' 1620 + ])), 1621 + parameterModel: z.optional(z.union([ 1622 + zModelWithString, 1623 + z.null() 1624 + ])) 1625 + })) 1626 + }); 1627 + 1628 + export const zCallWithDefaultOptionalParametersData = z.object({ 1629 + body: z.optional(z.never()), 1630 + path: z.optional(z.never()), 1631 + query: z.optional(z.object({ 1632 + parameterString: z._default(z.optional(z.string()), 'Hello World!'), 1633 + parameterNumber: z._default(z.optional(z.number()), 123), 1634 + parameterBoolean: z._default(z.optional(z.boolean()), true), 1635 + parameterEnum: z.optional(z.enum([ 1636 + 'Success', 1637 + 'Warning', 1638 + 'Error' 1639 + ])), 1640 + parameterModel: z.optional(zModelWithString) 1641 + })) 1642 + }); 1643 + 1644 + export const zCallToTestOrderOfParamsData = z.object({ 1645 + body: z.optional(z.never()), 1646 + path: z.optional(z.never()), 1647 + query: z.object({ 1648 + parameterOptionalStringWithDefault: z._default(z.optional(z.string()), 'Hello World!'), 1649 + parameterOptionalStringWithEmptyDefault: z._default(z.optional(z.string()), ''), 1650 + parameterOptionalStringWithNoDefault: z.optional(z.string()), 1651 + parameterStringWithDefault: z._default(z.string(), 'Hello World!'), 1652 + parameterStringWithEmptyDefault: z._default(z.string(), ''), 1653 + parameterStringWithNoDefault: z.string(), 1654 + parameterStringNullableWithNoDefault: z.optional(z.union([ 1655 + z.string(), 1656 + z.null() 1657 + ])), 1658 + parameterStringNullableWithDefault: z._default(z.optional(z.union([ 1659 + z.string(), 1660 + z.null() 1661 + ])), null) 1662 + }) 1663 + }); 1664 + 1665 + export const zDuplicateNameData = z.object({ 1666 + body: z.optional(z.never()), 1667 + path: z.optional(z.never()), 1668 + query: z.optional(z.never()) 1669 + }); 1670 + 1671 + export const zDuplicateName2Data = z.object({ 1672 + body: z.optional(z.never()), 1673 + path: z.optional(z.never()), 1674 + query: z.optional(z.never()) 1675 + }); 1676 + 1677 + export const zDuplicateName3Data = z.object({ 1678 + body: z.optional(z.never()), 1679 + path: z.optional(z.never()), 1680 + query: z.optional(z.never()) 1681 + }); 1682 + 1683 + export const zDuplicateName4Data = z.object({ 1684 + body: z.optional(z.never()), 1685 + path: z.optional(z.never()), 1686 + query: z.optional(z.never()) 1687 + }); 1688 + 1689 + export const zCallWithNoContentResponseData = z.object({ 1690 + body: z.optional(z.never()), 1691 + path: z.optional(z.never()), 1692 + query: z.optional(z.never()) 1693 + }); 1694 + 1695 + /** 1696 + * Success 1697 + */ 1698 + export const zCallWithNoContentResponseResponse = z.void(); 1699 + 1700 + export const zCallWithResponseAndNoContentResponseData = z.object({ 1701 + body: z.optional(z.never()), 1702 + path: z.optional(z.never()), 1703 + query: z.optional(z.never()) 1704 + }); 1705 + 1706 + export const zCallWithResponseAndNoContentResponseResponse = z.union([ 1707 + z.number(), 1708 + z.void() 1709 + ]); 1710 + 1711 + export const zDummyAData = z.object({ 1712 + body: z.optional(z.never()), 1713 + path: z.optional(z.never()), 1714 + query: z.optional(z.never()) 1715 + }); 1716 + 1717 + export const zDummyAResponse = z400; 1718 + 1719 + export const zDummyBData = z.object({ 1720 + body: z.optional(z.never()), 1721 + path: z.optional(z.never()), 1722 + query: z.optional(z.never()) 1723 + }); 1724 + 1725 + /** 1726 + * Success 1727 + */ 1728 + export const zDummyBResponse = z.void(); 1729 + 1730 + export const zCallWithResponseData = z.object({ 1731 + body: z.optional(z.never()), 1732 + path: z.optional(z.never()), 1733 + query: z.optional(z.never()) 1734 + }); 1735 + 1736 + export const zCallWithResponseResponse = zImport; 1737 + 1738 + export const zCallWithDuplicateResponsesData = z.object({ 1739 + body: z.optional(z.never()), 1740 + path: z.optional(z.never()), 1741 + query: z.optional(z.never()) 1742 + }); 1743 + 1744 + export const zCallWithDuplicateResponsesResponse = z.union([ 1745 + z.intersection(zModelWithBoolean, zModelWithInteger), 1746 + zModelWithString 1747 + ]); 1748 + 1749 + export const zCallWithResponsesData = z.object({ 1750 + body: z.optional(z.never()), 1751 + path: z.optional(z.never()), 1752 + query: z.optional(z.never()) 1753 + }); 1754 + 1755 + export const zCallWithResponsesResponse = z.union([ 1756 + z.object({ 1757 + '@namespace.string': z.optional(z.readonly(z.string())), 1758 + '@namespace.integer': z.optional(z.readonly(z.int())), 1759 + value: z.optional(z.readonly(z.array(zModelWithString))) 1760 + }), 1761 + zModelThatExtends, 1762 + zModelThatExtendsExtends 1763 + ]); 1764 + 1765 + export const zCollectionFormatData = z.object({ 1766 + body: z.optional(z.never()), 1767 + path: z.optional(z.never()), 1768 + query: z.object({ 1769 + parameterArrayCSV: z.union([ 1770 + z.array(z.string()), 1771 + z.null() 1772 + ]), 1773 + parameterArraySSV: z.union([ 1774 + z.array(z.string()), 1775 + z.null() 1776 + ]), 1777 + parameterArrayTSV: z.union([ 1778 + z.array(z.string()), 1779 + z.null() 1780 + ]), 1781 + parameterArrayPipes: z.union([ 1782 + z.array(z.string()), 1783 + z.null() 1784 + ]), 1785 + parameterArrayMulti: z.union([ 1786 + z.array(z.string()), 1787 + z.null() 1788 + ]) 1789 + }) 1790 + }); 1791 + 1792 + export const zTypesData = z.object({ 1793 + body: z.optional(z.never()), 1794 + path: z.optional(z.object({ 1795 + id: z.optional(z.int()) 1796 + })), 1797 + query: z.object({ 1798 + parameterNumber: z._default(z.number(), 123), 1799 + parameterString: z._default(z.union([ 1800 + z._default(z.string(), 'default'), 1801 + z.null() 1802 + ]), 'default'), 1803 + parameterBoolean: z._default(z.union([ 1804 + z._default(z.boolean(), true), 1805 + z.null() 1806 + ]), true), 1807 + parameterObject: z._default(z.union([ 1808 + z.object({}), 1809 + z.null() 1810 + ]), null), 1811 + parameterArray: z.union([ 1812 + z.array(z.string()), 1813 + z.null() 1814 + ]), 1815 + parameterDictionary: z.union([ 1816 + z.object({}), 1817 + z.null() 1818 + ]), 1819 + parameterEnum: z.union([ 1820 + z.literal('Success'), 1821 + z.literal('Warning'), 1822 + z.literal('Error'), 1823 + z.null() 1824 + ]) 1825 + }) 1826 + }); 1827 + 1828 + export const zTypesResponse = z.union([ 1829 + z.number(), 1830 + z.string(), 1831 + z.boolean(), 1832 + z.object({}) 1833 + ]); 1834 + 1835 + export const zUploadFileData = z.object({ 1836 + body: z.string(), 1837 + path: z.object({ 1838 + 'api-version': z.union([ 1839 + z.string(), 1840 + z.null() 1841 + ]) 1842 + }), 1843 + query: z.optional(z.never()) 1844 + }); 1845 + 1846 + export const zUploadFileResponse = z.boolean(); 1847 + 1848 + export const zFileResponseData = z.object({ 1849 + body: z.optional(z.never()), 1850 + path: z.object({ 1851 + id: z.string(), 1852 + 'api-version': z.string() 1853 + }), 1854 + query: z.optional(z.never()) 1855 + }); 1856 + 1857 + /** 1858 + * Success 1859 + */ 1860 + export const zFileResponseResponse = z.string(); 1861 + 1862 + export const zComplexTypesData = z.object({ 1863 + body: z.optional(z.never()), 1864 + path: z.optional(z.never()), 1865 + query: z.object({ 1866 + parameterObject: z.object({ 1867 + first: z.optional(z.object({ 1868 + second: z.optional(z.object({ 1869 + third: z.optional(z.string()) 1870 + })) 1871 + })) 1872 + }), 1873 + parameterReference: zModelWithString 1874 + }) 1875 + }); 1876 + 1877 + /** 1878 + * Successful response 1879 + */ 1880 + export const zComplexTypesResponse = z.array(zModelWithString); 1881 + 1882 + export const zMultipartResponseData = z.object({ 1883 + body: z.optional(z.never()), 1884 + path: z.optional(z.never()), 1885 + query: z.optional(z.never()) 1886 + }); 1887 + 1888 + /** 1889 + * OK 1890 + */ 1891 + export const zMultipartResponseResponse = z.object({ 1892 + file: z.optional(z.string()), 1893 + metadata: z.optional(z.object({ 1894 + foo: z.optional(z.string()), 1895 + bar: z.optional(z.string()) 1896 + })) 1897 + }); 1898 + 1899 + export const zMultipartRequestData = z.object({ 1900 + body: z.optional(z.object({ 1901 + content: z.optional(z.string()), 1902 + data: z.optional(z.union([ 1903 + zModelWithString, 1904 + z.null() 1905 + ])) 1906 + })), 1907 + path: z.optional(z.never()), 1908 + query: z.optional(z.never()) 1909 + }); 1910 + 1911 + export const zComplexParamsData = z.object({ 1912 + body: z.optional(z.object({ 1913 + key: z.readonly(z.union([ 1914 + z.readonly(z.string().check(z.maxLength(64), z.regex(/^[a-zA-Z0-9_]*$/))), 1915 + z.null() 1916 + ])), 1917 + name: z.union([ 1918 + z.string().check(z.maxLength(255)), 1919 + z.null() 1920 + ]), 1921 + enabled: z._default(z.optional(z.boolean()), true), 1922 + type: z.enum([ 1923 + 'Monkey', 1924 + 'Horse', 1925 + 'Bird' 1926 + ]), 1927 + listOfModels: z.optional(z.union([ 1928 + z.array(zModelWithString), 1929 + z.null() 1930 + ])), 1931 + listOfStrings: z.optional(z.union([ 1932 + z.array(z.string()), 1933 + z.null() 1934 + ])), 1935 + parameters: z.union([ 1936 + zModelWithString, 1937 + zModelWithEnum, 1938 + zModelWithArray, 1939 + zModelWithDictionary 1940 + ]), 1941 + user: z.optional(z.readonly(z.object({ 1942 + id: z.optional(z.readonly(z.int())), 1943 + name: z.optional(z.readonly(z.union([ 1944 + z.readonly(z.string()), 1945 + z.null() 1946 + ]))) 1947 + }))) 1948 + })), 1949 + path: z.object({ 1950 + id: z.int(), 1951 + 'api-version': z.string() 1952 + }), 1953 + query: z.optional(z.never()) 1954 + }); 1955 + 1956 + /** 1957 + * Success 1958 + */ 1959 + export const zComplexParamsResponse = zModelWithString; 1960 + 1961 + export const zCallWithResultFromHeaderData = z.object({ 1962 + body: z.optional(z.never()), 1963 + path: z.optional(z.never()), 1964 + query: z.optional(z.never()) 1965 + }); 1966 + 1967 + export const zTestErrorCodeData = z.object({ 1968 + body: z.optional(z.never()), 1969 + path: z.optional(z.never()), 1970 + query: z.object({ 1971 + status: z.int() 1972 + }) 1973 + }); 1974 + 1975 + export const zNonAsciiæøåÆøÅöôêÊ字符串Data = z.object({ 1976 + body: z.optional(z.never()), 1977 + path: z.optional(z.never()), 1978 + query: z.object({ 1979 + 'nonAsciiParamæøåÆØÅöôêÊ': z.int() 1980 + }) 1981 + }); 1982 + 1983 + /** 1984 + * Successful response 1985 + */ 1986 + export const zNonAsciiæøåÆøÅöôêÊ字符串Response = z.array(zNonAsciiStringæøåÆøÅöôêÊ字符串); 1987 + 1988 + export const zPutWithFormUrlEncodedData = z.object({ 1989 + body: zArrayWithStringsWritable, 1990 + path: z.optional(z.never()), 1991 + query: z.optional(z.never()) 1992 + });
+24
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/type-format-zod/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import * as z from 'zod/v4-mini'; 4 + 5 + export const zFoo = z.object({ 6 + bar: z.optional(z.int()), 7 + foo: z._default(z.coerce.bigint(), BigInt(0)), 8 + id: z.string() 9 + }); 10 + 11 + export const zBar = z.object({ 12 + foo: z.int() 13 + }); 14 + 15 + export const zPostFooData = z.object({ 16 + body: z.optional(z.never()), 17 + path: z.optional(z.never()), 18 + query: z.optional(z.never()) 19 + }); 20 + 21 + /** 22 + * OK 23 + */ 24 + export const zPostFooResponse = zFoo;
+1992
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v3/default/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod'; 4 + 5 + /** 6 + * Model with number-only name 7 + */ 8 + export const z400 = z.string(); 9 + 10 + /** 11 + * Testing multiline comments in string: First line 12 + * Second line 13 + * 14 + * Fourth line 15 + */ 16 + export const zCamelCaseCommentWithBreaks = z.number().int(); 17 + 18 + /** 19 + * Testing multiline comments in string: First line 20 + * Second line 21 + * 22 + * Fourth line 23 + */ 24 + export const zCommentWithBreaks = z.number().int(); 25 + 26 + /** 27 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 28 + */ 29 + export const zCommentWithBackticks = z.number().int(); 30 + 31 + /** 32 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 33 + */ 34 + export const zCommentWithBackticksAndQuotes = z.number().int(); 35 + 36 + /** 37 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 38 + */ 39 + export const zCommentWithSlashes = z.number().int(); 40 + 41 + /** 42 + * Testing expression placeholders in string: ${expression} should work 43 + */ 44 + export const zCommentWithExpressionPlaceholders = z.number().int(); 45 + 46 + /** 47 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 48 + */ 49 + export const zCommentWithQuotes = z.number().int(); 50 + 51 + /** 52 + * Testing reserved characters in string: * inline * and ** inline ** should work 53 + */ 54 + export const zCommentWithReservedCharacters = z.number().int(); 55 + 56 + /** 57 + * This is a simple number 58 + */ 59 + export const zSimpleInteger = z.number().int(); 60 + 61 + /** 62 + * This is a simple boolean 63 + */ 64 + export const zSimpleBoolean = z.boolean(); 65 + 66 + /** 67 + * This is a simple string 68 + */ 69 + export const zSimpleString = z.string(); 70 + 71 + /** 72 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 73 + */ 74 + export const zNonAsciiStringæøåÆøÅöôêÊ字符串 = z.string(); 75 + 76 + /** 77 + * This is a simple file 78 + */ 79 + export const zSimpleFile = z.string(); 80 + 81 + /** 82 + * This is a model with one string property 83 + */ 84 + export const zModelWithString = z.object({ 85 + prop: z.string().optional() 86 + }); 87 + 88 + /** 89 + * This is a simple reference 90 + */ 91 + export const zSimpleReference = zModelWithString; 92 + 93 + /** 94 + * This is a simple string 95 + */ 96 + export const zSimpleStringWithPattern = z.union([ 97 + z.string().max(64).regex(/^[a-zA-Z0-9_]*$/), 98 + z.null() 99 + ]); 100 + 101 + /** 102 + * This is a simple enum with strings 103 + */ 104 + export const zEnumWithStrings = z.enum([ 105 + 'Success', 106 + 'Warning', 107 + 'Error', 108 + "'Single Quote'", 109 + '"Double Quotes"', 110 + 'Non-ascii: øæåôöØÆÅÔÖ字符串' 111 + ]); 112 + 113 + export const zEnumWithReplacedCharacters = z.enum([ 114 + "'Single Quote'", 115 + '"Double Quotes"', 116 + 'øæåôöØÆÅÔÖ字符串', 117 + '' 118 + ]); 119 + 120 + /** 121 + * This is a simple enum with numbers 122 + */ 123 + export const zEnumWithNumbers = z.unknown(); 124 + 125 + /** 126 + * Success=1,Warning=2,Error=3 127 + */ 128 + export const zEnumFromDescription = z.number(); 129 + 130 + /** 131 + * This is a simple enum with numbers 132 + */ 133 + export const zEnumWithExtensions = z.unknown(); 134 + 135 + export const zEnumWithXEnumNames = z.unknown(); 136 + 137 + /** 138 + * This is a simple array with numbers 139 + */ 140 + export const zArrayWithNumbers = z.array(z.number().int()); 141 + 142 + /** 143 + * This is a simple array with booleans 144 + */ 145 + export const zArrayWithBooleans = z.array(z.boolean()); 146 + 147 + /** 148 + * This is a simple array with strings 149 + */ 150 + export const zArrayWithStrings = z.array(z.string()).default(['test']); 151 + 152 + /** 153 + * This is a simple array with references 154 + */ 155 + export const zArrayWithReferences = z.array(zModelWithString); 156 + 157 + /** 158 + * This is a simple array containing an array 159 + */ 160 + export const zArrayWithArray = z.array(z.array(zModelWithString)); 161 + 162 + /** 163 + * This is a simple array with properties 164 + */ 165 + export const zArrayWithProperties = z.array(z.object({ 166 + '16x16': zCamelCaseCommentWithBreaks.optional(), 167 + bar: z.string().optional() 168 + })); 169 + 170 + /** 171 + * This is a simple array with any of properties 172 + */ 173 + export const zArrayWithAnyOfProperties = z.array(z.union([ 174 + z.object({ 175 + foo: z.string().optional().default('test') 176 + }), 177 + z.object({ 178 + bar: z.string().optional() 179 + }) 180 + ])); 181 + 182 + export const zAnyOfAnyAndNull = z.object({ 183 + data: z.union([ 184 + z.unknown(), 185 + z.null() 186 + ]).optional() 187 + }); 188 + 189 + /** 190 + * This is a simple array with any of properties 191 + */ 192 + export const zAnyOfArrays = z.object({ 193 + results: z.array(z.union([ 194 + z.object({ 195 + foo: z.string().optional() 196 + }), 197 + z.object({ 198 + bar: z.string().optional() 199 + }) 200 + ])).optional() 201 + }); 202 + 203 + /** 204 + * This is a string dictionary 205 + */ 206 + export const zDictionaryWithString = z.object({}); 207 + 208 + export const zDictionaryWithPropertiesAndAdditionalProperties = z.object({ 209 + foo: z.number().optional(), 210 + bar: z.boolean().optional() 211 + }); 212 + 213 + /** 214 + * This is a string reference 215 + */ 216 + export const zDictionaryWithReference = z.object({}); 217 + 218 + /** 219 + * This is a complex dictionary 220 + */ 221 + export const zDictionaryWithArray = z.object({}); 222 + 223 + /** 224 + * This is a string dictionary 225 + */ 226 + export const zDictionaryWithDictionary = z.record(z.object({})); 227 + 228 + /** 229 + * This is a complex dictionary 230 + */ 231 + export const zDictionaryWithProperties = z.record(z.object({ 232 + foo: z.string().optional(), 233 + bar: z.string().optional() 234 + })); 235 + 236 + /** 237 + * This is a model with one number property 238 + */ 239 + export const zModelWithInteger = z.object({ 240 + prop: z.number().int().optional() 241 + }); 242 + 243 + /** 244 + * This is a model with one boolean property 245 + */ 246 + export const zModelWithBoolean = z.object({ 247 + prop: z.boolean().optional() 248 + }); 249 + 250 + /** 251 + * This is a model with one string property 252 + */ 253 + export const zModelWithStringError = z.object({ 254 + prop: z.string().optional() 255 + }); 256 + 257 + /** 258 + * `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) 259 + */ 260 + export const zModelFromZendesk = z.string(); 261 + 262 + /** 263 + * This is a model with one string property 264 + */ 265 + export const zModelWithNullableString = z.object({ 266 + nullableProp1: z.union([ 267 + z.string(), 268 + z.null() 269 + ]).optional(), 270 + nullableRequiredProp1: z.union([ 271 + z.string(), 272 + z.null() 273 + ]), 274 + nullableProp2: z.union([ 275 + z.string(), 276 + z.null() 277 + ]).optional(), 278 + nullableRequiredProp2: z.union([ 279 + z.string(), 280 + z.null() 281 + ]), 282 + 'foo_bar-enum': z.enum([ 283 + 'Success', 284 + 'Warning', 285 + 'Error', 286 + 'ØÆÅ字符串' 287 + ]).optional() 288 + }); 289 + 290 + /** 291 + * This is a model with one enum 292 + */ 293 + export const zModelWithEnum = z.object({ 294 + 'foo_bar-enum': z.enum([ 295 + 'Success', 296 + 'Warning', 297 + 'Error', 298 + 'ØÆÅ字符串' 299 + ]).optional(), 300 + statusCode: z.enum([ 301 + '100', 302 + '200 FOO', 303 + '300 FOO_BAR', 304 + '400 foo-bar', 305 + '500 foo.bar', 306 + '600 foo&bar' 307 + ]).optional(), 308 + bool: z.unknown().optional() 309 + }); 310 + 311 + /** 312 + * This is a model with one enum with escaped name 313 + */ 314 + export const zModelWithEnumWithHyphen = z.object({ 315 + 'foo-bar-baz-qux': z.enum([ 316 + '3.0' 317 + ]).optional() 318 + }); 319 + 320 + /** 321 + * This is a model with one enum 322 + */ 323 + export const zModelWithEnumFromDescription = z.object({ 324 + test: z.number().int().optional() 325 + }); 326 + 327 + /** 328 + * This is a model with nested enums 329 + */ 330 + export const zModelWithNestedEnums = z.object({ 331 + dictionaryWithEnum: z.object({}).optional(), 332 + dictionaryWithEnumFromDescription: z.object({}).optional(), 333 + arrayWithEnum: z.array(z.enum([ 334 + 'Success', 335 + 'Warning', 336 + 'Error' 337 + ])).optional(), 338 + arrayWithDescription: z.array(z.number().int()).optional(), 339 + 'foo_bar-enum': z.enum([ 340 + 'Success', 341 + 'Warning', 342 + 'Error', 343 + 'ØÆÅ字符串' 344 + ]).optional() 345 + }); 346 + 347 + /** 348 + * This is a model with one nested property 349 + */ 350 + export const zModelWithProperties = z.object({ 351 + required: z.string(), 352 + requiredAndReadOnly: z.string().readonly(), 353 + requiredAndNullable: z.union([ 354 + z.string(), 355 + z.null() 356 + ]), 357 + string: z.string().optional(), 358 + number: z.number().optional(), 359 + boolean: z.boolean().optional(), 360 + reference: zModelWithString.optional(), 361 + 'property with space': z.string().optional(), 362 + default: z.string().optional(), 363 + try: z.string().optional(), 364 + '@namespace.string': z.string().readonly().optional(), 365 + '@namespace.integer': z.number().int().readonly().optional() 366 + }); 367 + 368 + /** 369 + * This is a model with one property containing a reference 370 + */ 371 + export const zModelWithReference = z.object({ 372 + prop: zModelWithProperties.optional() 373 + }); 374 + 375 + export const zModelWithReadOnlyAndWriteOnly = z.object({ 376 + foo: z.string(), 377 + bar: z.string().readonly() 378 + }); 379 + 380 + /** 381 + * This is a model with one property containing an array 382 + */ 383 + export const zModelWithArrayReadOnlyAndWriteOnly = z.object({ 384 + prop: z.array(zModelWithReadOnlyAndWriteOnly).optional(), 385 + propWithFile: z.array(z.string()).optional(), 386 + propWithNumber: z.array(z.number()).optional() 387 + }); 388 + 389 + /** 390 + * This is a model with one property containing an array 391 + */ 392 + export const zModelWithArray = z.object({ 393 + prop: z.array(zModelWithString).optional(), 394 + propWithFile: z.array(z.string()).optional(), 395 + propWithNumber: z.array(z.number()).optional() 396 + }); 397 + 398 + /** 399 + * This is a model with one property containing a dictionary 400 + */ 401 + export const zModelWithDictionary = z.object({ 402 + prop: z.object({}).optional() 403 + }); 404 + 405 + /** 406 + * This is a deprecated model with a deprecated property 407 + * @deprecated 408 + */ 409 + export const zDeprecatedModel = z.object({ 410 + prop: z.string().optional() 411 + }); 412 + 413 + /** 414 + * This is a model with one property containing a circular reference 415 + */ 416 + export const zModelWithCircularReference: z.AnyZodObject = z.object({ 417 + prop: z.lazy(() => { 418 + return zModelWithCircularReference; 419 + }).optional() 420 + }); 421 + 422 + /** 423 + * This is a model with one property with a 'one of' relationship 424 + */ 425 + export const zCompositionWithOneOf = z.object({ 426 + propA: z.union([ 427 + zModelWithString, 428 + zModelWithEnum, 429 + zModelWithArray, 430 + zModelWithDictionary 431 + ]).optional() 432 + }); 433 + 434 + /** 435 + * This is a model with one property with a 'one of' relationship where the options are not $ref 436 + */ 437 + export const zCompositionWithOneOfAnonymous = z.object({ 438 + propA: z.union([ 439 + z.object({ 440 + propA: z.string().optional() 441 + }), 442 + z.string(), 443 + z.number().int() 444 + ]).optional() 445 + }); 446 + 447 + /** 448 + * Circle 449 + */ 450 + export const zModelCircle = z.object({ 451 + kind: z.string(), 452 + radius: z.number().optional() 453 + }); 454 + 455 + /** 456 + * Square 457 + */ 458 + export const zModelSquare = z.object({ 459 + kind: z.string(), 460 + sideLength: z.number().optional() 461 + }); 462 + 463 + /** 464 + * This is a model with one property with a 'one of' relationship where the options are not $ref 465 + */ 466 + export const zCompositionWithOneOfDiscriminator = z.union([ 467 + z.object({ 468 + kind: z.literal('circle') 469 + }).and(zModelCircle), 470 + z.object({ 471 + kind: z.literal('square') 472 + }).and(zModelSquare) 473 + ]); 474 + 475 + /** 476 + * This is a model with one property with a 'any of' relationship 477 + */ 478 + export const zCompositionWithAnyOf = z.object({ 479 + propA: z.union([ 480 + zModelWithString, 481 + zModelWithEnum, 482 + zModelWithArray, 483 + zModelWithDictionary 484 + ]).optional() 485 + }); 486 + 487 + /** 488 + * This is a model with one property with a 'any of' relationship where the options are not $ref 489 + */ 490 + export const zCompositionWithAnyOfAnonymous = z.object({ 491 + propA: z.union([ 492 + z.object({ 493 + propA: z.string().optional() 494 + }), 495 + z.string(), 496 + z.number().int() 497 + ]).optional() 498 + }); 499 + 500 + /** 501 + * This is a model with nested 'any of' property with a type null 502 + */ 503 + export const zCompositionWithNestedAnyAndTypeNull = z.object({ 504 + propA: z.union([ 505 + z.array(z.union([ 506 + zModelWithDictionary, 507 + z.null() 508 + ])), 509 + z.array(z.union([ 510 + zModelWithArray, 511 + z.null() 512 + ])) 513 + ]).optional() 514 + }); 515 + 516 + export const z3eNum1Период = z.enum([ 517 + 'Bird', 518 + 'Dog' 519 + ]); 520 + 521 + export const zConstValue = z.literal('ConstValue'); 522 + 523 + /** 524 + * This is a model with one property with a 'any of' relationship where the options are not $ref 525 + */ 526 + export const zCompositionWithNestedAnyOfAndNull = z.object({ 527 + propA: z.union([ 528 + z.array(z.union([ 529 + z3eNum1Период, 530 + zConstValue 531 + ])), 532 + z.null() 533 + ]).optional() 534 + }); 535 + 536 + /** 537 + * This is a model with one property with a 'one of' relationship 538 + */ 539 + export const zCompositionWithOneOfAndNullable = z.object({ 540 + propA: z.union([ 541 + z.object({ 542 + boolean: z.boolean().optional() 543 + }), 544 + zModelWithEnum, 545 + zModelWithArray, 546 + zModelWithDictionary, 547 + z.null() 548 + ]).optional() 549 + }); 550 + 551 + /** 552 + * This is a model that contains a simple dictionary within composition 553 + */ 554 + export const zCompositionWithOneOfAndSimpleDictionary = z.object({ 555 + propA: z.union([ 556 + z.boolean(), 557 + z.object({}) 558 + ]).optional() 559 + }); 560 + 561 + /** 562 + * This is a model that contains a dictionary of simple arrays within composition 563 + */ 564 + export const zCompositionWithOneOfAndSimpleArrayDictionary = z.object({ 565 + propA: z.union([ 566 + z.boolean(), 567 + z.object({}) 568 + ]).optional() 569 + }); 570 + 571 + /** 572 + * This is a model that contains a dictionary of complex arrays (composited) within composition 573 + */ 574 + export const zCompositionWithOneOfAndComplexArrayDictionary = z.object({ 575 + propA: z.union([ 576 + z.boolean(), 577 + z.object({}) 578 + ]).optional() 579 + }); 580 + 581 + /** 582 + * This is a model with one property with a 'all of' relationship 583 + */ 584 + export const zCompositionWithAllOfAndNullable = z.object({ 585 + propA: z.union([ 586 + z.object({ 587 + boolean: z.boolean().optional() 588 + }).and(zModelWithEnum).and(zModelWithArray).and(zModelWithDictionary), 589 + z.null() 590 + ]).optional() 591 + }); 592 + 593 + /** 594 + * This is a model with one property with a 'any of' relationship 595 + */ 596 + export const zCompositionWithAnyOfAndNullable = z.object({ 597 + propA: z.union([ 598 + z.object({ 599 + boolean: z.boolean().optional() 600 + }), 601 + zModelWithEnum, 602 + zModelWithArray, 603 + zModelWithDictionary, 604 + z.null() 605 + ]).optional() 606 + }); 607 + 608 + /** 609 + * This is a base model with two simple optional properties 610 + */ 611 + export const zCompositionBaseModel = z.object({ 612 + firstName: z.string().optional(), 613 + lastname: z.string().optional() 614 + }); 615 + 616 + /** 617 + * This is a model that extends the base model 618 + */ 619 + export const zCompositionExtendedModel = zCompositionBaseModel.and(z.object({ 620 + age: z.number(), 621 + firstName: z.string(), 622 + lastname: z.string() 623 + })); 624 + 625 + /** 626 + * This is a model with one nested property 627 + */ 628 + export const zModelWithNestedProperties = z.object({ 629 + first: z.union([ 630 + z.object({ 631 + second: z.union([ 632 + z.object({ 633 + third: z.union([ 634 + z.string().readonly(), 635 + z.null() 636 + ]).readonly() 637 + }).readonly(), 638 + z.null() 639 + ]).readonly() 640 + }).readonly(), 641 + z.null() 642 + ]).readonly() 643 + }); 644 + 645 + /** 646 + * This is a model with duplicated properties 647 + */ 648 + export const zModelWithDuplicateProperties = z.object({ 649 + prop: zModelWithString.optional() 650 + }); 651 + 652 + /** 653 + * This is a model with ordered properties 654 + */ 655 + export const zModelWithOrderedProperties = z.object({ 656 + zebra: z.string().optional(), 657 + apple: z.string().optional(), 658 + hawaii: z.string().optional() 659 + }); 660 + 661 + /** 662 + * This is a model with duplicated imports 663 + */ 664 + export const zModelWithDuplicateImports = z.object({ 665 + propA: zModelWithString.optional(), 666 + propB: zModelWithString.optional(), 667 + propC: zModelWithString.optional() 668 + }); 669 + 670 + /** 671 + * This is a model that extends another model 672 + */ 673 + export const zModelThatExtends = zModelWithString.and(z.object({ 674 + propExtendsA: z.string().optional(), 675 + propExtendsB: zModelWithString.optional() 676 + })); 677 + 678 + /** 679 + * This is a model that extends another model 680 + */ 681 + export const zModelThatExtendsExtends = zModelWithString.and(zModelThatExtends).and(z.object({ 682 + propExtendsC: z.string().optional(), 683 + propExtendsD: zModelWithString.optional() 684 + })); 685 + 686 + /** 687 + * This is a model that contains a some patterns 688 + */ 689 + export const zModelWithPattern = z.object({ 690 + key: z.string().max(64).regex(/^[a-zA-Z0-9_]*$/), 691 + name: z.string().max(255), 692 + enabled: z.boolean().readonly().optional(), 693 + modified: z.string().datetime().readonly().optional(), 694 + id: z.string().regex(/^\d{2}-\d{3}-\d{4}$/).optional(), 695 + text: z.string().regex(/^\w+$/).optional(), 696 + patternWithSingleQuotes: z.string().regex(/^[a-zA-Z0-9']*$/).optional(), 697 + patternWithNewline: z.string().regex(/aaa\nbbb/).optional(), 698 + patternWithBacktick: z.string().regex(/aaa`bbb/).optional() 699 + }); 700 + 701 + export const zFile = z.object({ 702 + id: z.string().min(1).readonly().optional(), 703 + updated_at: z.string().datetime().readonly().optional(), 704 + created_at: z.string().datetime().readonly().optional(), 705 + mime: z.string().min(1).max(24), 706 + file: z.string().url().readonly().optional() 707 + }); 708 + 709 + export const zDefault = z.object({ 710 + name: z.string().optional() 711 + }); 712 + 713 + export const zPageable = z.object({ 714 + page: z.number().int().gte(0).optional().default(0), 715 + size: z.number().int().gte(1).optional(), 716 + sort: z.array(z.string()).optional() 717 + }); 718 + 719 + /** 720 + * This is a free-form object without additionalProperties. 721 + */ 722 + export const zFreeFormObjectWithoutAdditionalProperties = z.object({}); 723 + 724 + /** 725 + * This is a free-form object with additionalProperties: true. 726 + */ 727 + export const zFreeFormObjectWithAdditionalPropertiesEqTrue = z.object({}); 728 + 729 + /** 730 + * This is a free-form object with additionalProperties: {}. 731 + */ 732 + export const zFreeFormObjectWithAdditionalPropertiesEqEmptyObject = z.object({}); 733 + 734 + export const zModelWithConst = z.object({ 735 + String: z.literal('String').optional(), 736 + number: z.literal(0).optional(), 737 + null: z.null().optional(), 738 + withType: z.literal('Some string').optional() 739 + }); 740 + 741 + /** 742 + * This is a model with one property and additionalProperties: true 743 + */ 744 + export const zModelWithAdditionalPropertiesEqTrue = z.object({ 745 + prop: z.string().optional() 746 + }); 747 + 748 + export const zNestedAnyOfArraysNullable = z.object({ 749 + nullableArray: z.union([ 750 + z.array(z.union([ 751 + z.string(), 752 + z.boolean() 753 + ])), 754 + z.null() 755 + ]).optional() 756 + }); 757 + 758 + /** 759 + * This is a reusable parameter 760 + */ 761 + export const zSimpleParameter = z.unknown(); 762 + 763 + export const zCompositionWithOneOfAndProperties = z.intersection(z.union([ 764 + z.object({ 765 + foo: zSimpleParameter 766 + }), 767 + z.object({ 768 + bar: zNonAsciiStringæøåÆøÅöôêÊ字符串 769 + }) 770 + ]), z.object({ 771 + baz: z.union([ 772 + z.number().int().gte(0), 773 + z.null() 774 + ]), 775 + qux: z.number().int().gte(0) 776 + })); 777 + 778 + /** 779 + * An object that can be null 780 + */ 781 + export const zNullableObject = z.union([ 782 + z.object({ 783 + foo: z.string().optional() 784 + }), 785 + z.null() 786 + ]).default(null); 787 + 788 + /** 789 + * Some % character 790 + */ 791 + export const zCharactersInDescription = z.string(); 792 + 793 + export const zModelWithNullableObject = z.object({ 794 + data: zNullableObject.optional() 795 + }); 796 + 797 + export const zModelWithOneOfEnum = z.union([ 798 + z.object({ 799 + foo: z.enum([ 800 + 'Bar' 801 + ]) 802 + }), 803 + z.object({ 804 + foo: z.enum([ 805 + 'Baz' 806 + ]) 807 + }), 808 + z.object({ 809 + foo: z.enum([ 810 + 'Qux' 811 + ]) 812 + }), 813 + z.object({ 814 + content: z.string().datetime(), 815 + foo: z.enum([ 816 + 'Quux' 817 + ]) 818 + }), 819 + z.object({ 820 + content: z.tuple([ 821 + z.string().datetime(), 822 + z.string() 823 + ]), 824 + foo: z.enum([ 825 + 'Corge' 826 + ]) 827 + }) 828 + ]); 829 + 830 + export const zModelWithNestedArrayEnumsDataFoo = z.enum([ 831 + 'foo', 832 + 'bar' 833 + ]); 834 + 835 + export const zModelWithNestedArrayEnumsDataBar = z.enum([ 836 + 'baz', 837 + 'qux' 838 + ]); 839 + 840 + export const zModelWithNestedArrayEnumsData = z.object({ 841 + foo: z.array(zModelWithNestedArrayEnumsDataFoo).optional(), 842 + bar: z.array(zModelWithNestedArrayEnumsDataBar).optional() 843 + }); 844 + 845 + export const zModelWithNestedArrayEnums = z.object({ 846 + array_strings: z.array(z.string()).optional(), 847 + data: zModelWithNestedArrayEnumsData.optional() 848 + }); 849 + 850 + export const zModelWithNestedCompositionEnums = z.object({ 851 + foo: zModelWithNestedArrayEnumsDataFoo.optional() 852 + }); 853 + 854 + export const zModelWithConstantSizeArray = z.tuple([ 855 + z.number(), 856 + z.number() 857 + ]); 858 + 859 + export const zModelWithAnyOfConstantSizeArray = z.tuple([ 860 + z.union([ 861 + z.number(), 862 + z.string() 863 + ]), 864 + z.union([ 865 + z.number(), 866 + z.string() 867 + ]), 868 + z.union([ 869 + z.number(), 870 + z.string() 871 + ]) 872 + ]); 873 + 874 + export const zModelWithPrefixItemsConstantSizeArray = z.tuple([ 875 + zModelWithInteger, 876 + z.union([ 877 + z.number(), 878 + z.string() 879 + ]), 880 + z.string() 881 + ]); 882 + 883 + export const zModelWithAnyOfConstantSizeArrayNullable = z.tuple([ 884 + z.union([ 885 + z.number(), 886 + z.null(), 887 + z.string() 888 + ]), 889 + z.union([ 890 + z.number(), 891 + z.null(), 892 + z.string() 893 + ]), 894 + z.union([ 895 + z.number(), 896 + z.null(), 897 + z.string() 898 + ]) 899 + ]); 900 + 901 + /** 902 + * Model with restricted keyword name 903 + */ 904 + export const zImport = z.string(); 905 + 906 + export const zModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = z.tuple([ 907 + z.union([ 908 + z.number(), 909 + zImport 910 + ]), 911 + z.union([ 912 + z.number(), 913 + zImport 914 + ]) 915 + ]); 916 + 917 + export const zModelWithAnyOfConstantSizeArrayAndIntersect = z.tuple([ 918 + z.intersection(z.number(), z.string()), 919 + z.intersection(z.number(), z.string()) 920 + ]); 921 + 922 + export const zModelWithNumericEnumUnion = z.object({ 923 + value: z.unknown().optional() 924 + }); 925 + 926 + /** 927 + * Some description with `back ticks` 928 + */ 929 + export const zModelWithBackticksInDescription = z.object({ 930 + template: z.string().optional() 931 + }); 932 + 933 + export const zModelWithOneOfAndProperties = z.intersection(z.union([ 934 + zSimpleParameter, 935 + zNonAsciiStringæøåÆøÅöôêÊ字符串 936 + ]), z.object({ 937 + baz: z.union([ 938 + z.number().int().gte(0), 939 + z.null() 940 + ]), 941 + qux: z.number().int().gte(0) 942 + })); 943 + 944 + /** 945 + * Model used to test deduplication strategy (unused) 946 + */ 947 + export const zParameterSimpleParameterUnused = z.string(); 948 + 949 + /** 950 + * Model used to test deduplication strategy 951 + */ 952 + export const zPostServiceWithEmptyTagResponse = z.string(); 953 + 954 + /** 955 + * Model used to test deduplication strategy 956 + */ 957 + export const zPostServiceWithEmptyTagResponse2 = z.string(); 958 + 959 + /** 960 + * Model used to test deduplication strategy 961 + */ 962 + export const zDeleteFooData = z.string(); 963 + 964 + /** 965 + * Model used to test deduplication strategy 966 + */ 967 + export const zDeleteFooData2 = z.string(); 968 + 969 + export const zSchemaWithFormRestrictedKeys = z.object({ 970 + description: z.string().optional(), 971 + 'x-enum-descriptions': z.string().optional(), 972 + 'x-enum-varnames': z.string().optional(), 973 + 'x-enumNames': z.string().optional(), 974 + title: z.string().optional(), 975 + object: z.object({ 976 + description: z.string().optional(), 977 + 'x-enum-descriptions': z.string().optional(), 978 + 'x-enum-varnames': z.string().optional(), 979 + 'x-enumNames': z.string().optional(), 980 + title: z.string().optional() 981 + }).optional(), 982 + array: z.array(z.object({ 983 + description: z.string().optional(), 984 + 'x-enum-descriptions': z.string().optional(), 985 + 'x-enum-varnames': z.string().optional(), 986 + 'x-enumNames': z.string().optional(), 987 + title: z.string().optional() 988 + })).optional() 989 + }); 990 + 991 + /** 992 + * This schema was giving PascalCase transformations a hard time 993 + */ 994 + export const zIoK8sApimachineryPkgApisMetaV1Preconditions = z.object({ 995 + resourceVersion: z.string().optional(), 996 + uid: z.string().optional() 997 + }); 998 + 999 + /** 1000 + * This schema was giving PascalCase transformations a hard time 1001 + */ 1002 + export const zIoK8sApimachineryPkgApisMetaV1DeleteOptions = z.object({ 1003 + preconditions: zIoK8sApimachineryPkgApisMetaV1Preconditions.optional() 1004 + }); 1005 + 1006 + export const zAdditionalPropertiesUnknownIssue = z.object({}); 1007 + 1008 + export const zAdditionalPropertiesUnknownIssue2 = z.object({}); 1009 + 1010 + export const zAdditionalPropertiesUnknownIssue3 = z.intersection(z.string(), z.object({ 1011 + entries: z.object({}) 1012 + })); 1013 + 1014 + export const zAdditionalPropertiesIntegerIssue = z.object({ 1015 + value: z.number().int() 1016 + }); 1017 + 1018 + export const zGenericSchemaDuplicateIssue1SystemBoolean = z.object({ 1019 + item: z.boolean().optional(), 1020 + error: z.union([ 1021 + z.string(), 1022 + z.null() 1023 + ]).optional(), 1024 + hasError: z.boolean().readonly().optional(), 1025 + data: z.object({}).optional() 1026 + }); 1027 + 1028 + export const zGenericSchemaDuplicateIssue1SystemString = z.object({ 1029 + item: z.union([ 1030 + z.string(), 1031 + z.null() 1032 + ]).optional(), 1033 + error: z.union([ 1034 + z.string(), 1035 + z.null() 1036 + ]).optional(), 1037 + hasError: z.boolean().readonly().optional() 1038 + }); 1039 + 1040 + export const zOneOfAllOfIssue = z.union([ 1041 + z.intersection(z.union([ 1042 + zConstValue, 1043 + zGenericSchemaDuplicateIssue1SystemBoolean 1044 + ]), z3eNum1Период), 1045 + zGenericSchemaDuplicateIssue1SystemString 1046 + ]); 1047 + 1048 + /** 1049 + * Model with number-only name 1050 + */ 1051 + export const z400Writable = z.string(); 1052 + 1053 + /** 1054 + * Testing multiline comments in string: First line 1055 + * Second line 1056 + * 1057 + * Fourth line 1058 + */ 1059 + export const zCamelCaseCommentWithBreaksWritable = z.number().int(); 1060 + 1061 + /** 1062 + * Testing multiline comments in string: First line 1063 + * Second line 1064 + * 1065 + * Fourth line 1066 + */ 1067 + export const zCommentWithBreaksWritable = z.number().int(); 1068 + 1069 + /** 1070 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1071 + */ 1072 + export const zCommentWithBackticksWritable = z.number().int(); 1073 + 1074 + /** 1075 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 1076 + */ 1077 + export const zCommentWithBackticksAndQuotesWritable = z.number().int(); 1078 + 1079 + /** 1080 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1081 + */ 1082 + export const zCommentWithSlashesWritable = z.number().int(); 1083 + 1084 + /** 1085 + * Testing expression placeholders in string: ${expression} should work 1086 + */ 1087 + export const zCommentWithExpressionPlaceholdersWritable = z.number().int(); 1088 + 1089 + /** 1090 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1091 + */ 1092 + export const zCommentWithQuotesWritable = z.number().int(); 1093 + 1094 + /** 1095 + * Testing reserved characters in string: * inline * and ** inline ** should work 1096 + */ 1097 + export const zCommentWithReservedCharactersWritable = z.number().int(); 1098 + 1099 + /** 1100 + * This is a simple number 1101 + */ 1102 + export const zSimpleIntegerWritable = z.number().int(); 1103 + 1104 + /** 1105 + * This is a simple boolean 1106 + */ 1107 + export const zSimpleBooleanWritable = z.boolean(); 1108 + 1109 + /** 1110 + * This is a simple string 1111 + */ 1112 + export const zSimpleStringWritable = z.string(); 1113 + 1114 + /** 1115 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 1116 + */ 1117 + export const zNonAsciiStringæøåÆøÅöôêÊ字符串Writable = z.string(); 1118 + 1119 + /** 1120 + * This is a simple file 1121 + */ 1122 + export const zSimpleFileWritable = z.string(); 1123 + 1124 + /** 1125 + * This is a simple string 1126 + */ 1127 + export const zSimpleStringWithPatternWritable = z.union([ 1128 + z.string().max(64).regex(/^[a-zA-Z0-9_]*$/), 1129 + z.null() 1130 + ]); 1131 + 1132 + /** 1133 + * This is a simple enum with strings 1134 + */ 1135 + export const zEnumWithStringsWritable = z.enum([ 1136 + 'Success', 1137 + 'Warning', 1138 + 'Error', 1139 + "'Single Quote'", 1140 + '"Double Quotes"', 1141 + 'Non-ascii: øæåôöØÆÅÔÖ字符串' 1142 + ]); 1143 + 1144 + export const zEnumWithReplacedCharactersWritable = z.enum([ 1145 + "'Single Quote'", 1146 + '"Double Quotes"', 1147 + 'øæåôöØÆÅÔÖ字符串', 1148 + '' 1149 + ]); 1150 + 1151 + /** 1152 + * This is a simple enum with numbers 1153 + */ 1154 + export const zEnumWithNumbersWritable = z.unknown(); 1155 + 1156 + /** 1157 + * Success=1,Warning=2,Error=3 1158 + */ 1159 + export const zEnumFromDescriptionWritable = z.number(); 1160 + 1161 + /** 1162 + * This is a simple enum with numbers 1163 + */ 1164 + export const zEnumWithExtensionsWritable = z.unknown(); 1165 + 1166 + export const zEnumWithXEnumNamesWritable = z.unknown(); 1167 + 1168 + /** 1169 + * This is a simple array with numbers 1170 + */ 1171 + export const zArrayWithNumbersWritable = z.array(z.number().int()); 1172 + 1173 + /** 1174 + * This is a simple array with booleans 1175 + */ 1176 + export const zArrayWithBooleansWritable = z.array(z.boolean()); 1177 + 1178 + /** 1179 + * This is a simple array with strings 1180 + */ 1181 + export const zArrayWithStringsWritable = z.array(z.string()).default(['test']); 1182 + 1183 + /** 1184 + * This is a string dictionary 1185 + */ 1186 + export const zDictionaryWithStringWritable = z.object({}); 1187 + 1188 + /** 1189 + * This is a string dictionary 1190 + */ 1191 + export const zDictionaryWithDictionaryWritable = z.record(z.object({})); 1192 + 1193 + /** 1194 + * `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) 1195 + */ 1196 + export const zModelFromZendeskWritable = z.string(); 1197 + 1198 + export const zModelWithReadOnlyAndWriteOnlyWritable = z.object({ 1199 + foo: z.string(), 1200 + baz: z.string() 1201 + }); 1202 + 1203 + /** 1204 + * This is a model with one property containing an array 1205 + */ 1206 + export const zModelWithArrayReadOnlyAndWriteOnlyWritable = z.object({ 1207 + prop: z.array(zModelWithReadOnlyAndWriteOnlyWritable).optional(), 1208 + propWithFile: z.array(z.string()).optional(), 1209 + propWithNumber: z.array(z.number()).optional() 1210 + }); 1211 + 1212 + export const z3eNum1ПериодWritable = z.enum([ 1213 + 'Bird', 1214 + 'Dog' 1215 + ]); 1216 + 1217 + export const zConstValueWritable = z.literal('ConstValue'); 1218 + 1219 + /** 1220 + * This is a free-form object without additionalProperties. 1221 + */ 1222 + export const zFreeFormObjectWithoutAdditionalPropertiesWritable = z.object({}); 1223 + 1224 + /** 1225 + * This is a free-form object with additionalProperties: true. 1226 + */ 1227 + export const zFreeFormObjectWithAdditionalPropertiesEqTrueWritable = z.object({}); 1228 + 1229 + /** 1230 + * This is a free-form object with additionalProperties: {}. 1231 + */ 1232 + export const zFreeFormObjectWithAdditionalPropertiesEqEmptyObjectWritable = z.object({}); 1233 + 1234 + /** 1235 + * Some % character 1236 + */ 1237 + export const zCharactersInDescriptionWritable = z.string(); 1238 + 1239 + export const zModelWithNestedArrayEnumsDataFooWritable = z.enum([ 1240 + 'foo', 1241 + 'bar' 1242 + ]); 1243 + 1244 + export const zModelWithNestedArrayEnumsDataBarWritable = z.enum([ 1245 + 'baz', 1246 + 'qux' 1247 + ]); 1248 + 1249 + export const zModelWithConstantSizeArrayWritable = z.tuple([ 1250 + z.number(), 1251 + z.number() 1252 + ]); 1253 + 1254 + export const zModelWithAnyOfConstantSizeArrayWritable = z.tuple([ 1255 + z.union([ 1256 + z.number(), 1257 + z.string() 1258 + ]), 1259 + z.union([ 1260 + z.number(), 1261 + z.string() 1262 + ]), 1263 + z.union([ 1264 + z.number(), 1265 + z.string() 1266 + ]) 1267 + ]); 1268 + 1269 + export const zModelWithAnyOfConstantSizeArrayNullableWritable = z.tuple([ 1270 + z.union([ 1271 + z.number(), 1272 + z.null(), 1273 + z.string() 1274 + ]), 1275 + z.union([ 1276 + z.number(), 1277 + z.null(), 1278 + z.string() 1279 + ]), 1280 + z.union([ 1281 + z.number(), 1282 + z.null(), 1283 + z.string() 1284 + ]) 1285 + ]); 1286 + 1287 + /** 1288 + * Model with restricted keyword name 1289 + */ 1290 + export const zImportWritable = z.string(); 1291 + 1292 + export const zModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = z.tuple([ 1293 + z.union([ 1294 + z.number(), 1295 + zImportWritable 1296 + ]), 1297 + z.union([ 1298 + z.number(), 1299 + zImportWritable 1300 + ]) 1301 + ]); 1302 + 1303 + export const zModelWithAnyOfConstantSizeArrayAndIntersectWritable = z.tuple([ 1304 + z.intersection(z.number(), z.string()), 1305 + z.intersection(z.number(), z.string()) 1306 + ]); 1307 + 1308 + /** 1309 + * Model used to test deduplication strategy (unused) 1310 + */ 1311 + export const zParameterSimpleParameterUnusedWritable = z.string(); 1312 + 1313 + /** 1314 + * Model used to test deduplication strategy 1315 + */ 1316 + export const zPostServiceWithEmptyTagResponseWritable = z.string(); 1317 + 1318 + /** 1319 + * Model used to test deduplication strategy 1320 + */ 1321 + export const zPostServiceWithEmptyTagResponse2Writable = z.string(); 1322 + 1323 + /** 1324 + * Model used to test deduplication strategy 1325 + */ 1326 + export const zDeleteFooDataWritable = z.string(); 1327 + 1328 + /** 1329 + * Model used to test deduplication strategy 1330 + */ 1331 + export const zDeleteFooData2Writable = z.string(); 1332 + 1333 + export const zAdditionalPropertiesUnknownIssueWritable = z.object({}); 1334 + 1335 + export const zAdditionalPropertiesUnknownIssue2Writable = z.object({}); 1336 + 1337 + export const zOneOfAllOfIssueWritable = z.union([ 1338 + z.intersection(z.union([ 1339 + zConstValueWritable, 1340 + zGenericSchemaDuplicateIssue1SystemBoolean 1341 + ]), z3eNum1Период), 1342 + zGenericSchemaDuplicateIssue1SystemString 1343 + ]); 1344 + 1345 + /** 1346 + * Parameter with illegal characters 1347 + */ 1348 + export const zXFooBar = zModelWithString; 1349 + 1350 + /** 1351 + * A reusable request body 1352 + */ 1353 + export const zSimpleRequestBody = zModelWithString; 1354 + 1355 + /** 1356 + * A reusable request body 1357 + */ 1358 + export const zSimpleFormData = zModelWithString; 1359 + 1360 + export const zExportData = z.object({ 1361 + body: z.never().optional(), 1362 + path: z.never().optional(), 1363 + query: z.never().optional() 1364 + }); 1365 + 1366 + export const zPatchApiVbyApiVersionNoTagData = z.object({ 1367 + body: z.never().optional(), 1368 + path: z.never().optional(), 1369 + query: z.never().optional() 1370 + }); 1371 + 1372 + export const zImportData = z.object({ 1373 + body: z.union([ 1374 + zModelWithReadOnlyAndWriteOnlyWritable, 1375 + zModelWithArrayReadOnlyAndWriteOnlyWritable 1376 + ]), 1377 + path: z.never().optional(), 1378 + query: z.never().optional() 1379 + }); 1380 + 1381 + export const zImportResponse = z.union([ 1382 + zModelFromZendesk, 1383 + zModelWithReadOnlyAndWriteOnly 1384 + ]); 1385 + 1386 + export const zFooWowData = z.object({ 1387 + body: z.never().optional(), 1388 + path: z.never().optional(), 1389 + query: z.never().optional() 1390 + }); 1391 + 1392 + export const zApiVVersionODataControllerCountData = z.object({ 1393 + body: z.never().optional(), 1394 + path: z.never().optional(), 1395 + query: z.never().optional() 1396 + }); 1397 + 1398 + /** 1399 + * Success 1400 + */ 1401 + export const zApiVVersionODataControllerCountResponse = zModelFromZendesk; 1402 + 1403 + export const zGetApiVbyApiVersionSimpleOperationData = z.object({ 1404 + body: z.never().optional(), 1405 + path: z.object({ 1406 + foo_param: z.union([ 1407 + z.string(), 1408 + z.string().uuid() 1409 + ]) 1410 + }), 1411 + query: z.never().optional() 1412 + }); 1413 + 1414 + /** 1415 + * Response is a simple number 1416 + */ 1417 + export const zGetApiVbyApiVersionSimpleOperationResponse = z.number(); 1418 + 1419 + export const zDeleteCallWithoutParametersAndResponseData = z.object({ 1420 + body: z.never().optional(), 1421 + path: z.never().optional(), 1422 + query: z.never().optional() 1423 + }); 1424 + 1425 + export const zGetCallWithoutParametersAndResponseData = z.object({ 1426 + body: z.never().optional(), 1427 + path: z.never().optional(), 1428 + query: z.never().optional() 1429 + }); 1430 + 1431 + export const zHeadCallWithoutParametersAndResponseData = z.object({ 1432 + body: z.never().optional(), 1433 + path: z.never().optional(), 1434 + query: z.never().optional() 1435 + }); 1436 + 1437 + export const zOptionsCallWithoutParametersAndResponseData = z.object({ 1438 + body: z.never().optional(), 1439 + path: z.never().optional(), 1440 + query: z.never().optional() 1441 + }); 1442 + 1443 + export const zPatchCallWithoutParametersAndResponseData = z.object({ 1444 + body: z.never().optional(), 1445 + path: z.never().optional(), 1446 + query: z.never().optional() 1447 + }); 1448 + 1449 + export const zPostCallWithoutParametersAndResponseData = z.object({ 1450 + body: z.never().optional(), 1451 + path: z.never().optional(), 1452 + query: z.never().optional() 1453 + }); 1454 + 1455 + export const zPutCallWithoutParametersAndResponseData = z.object({ 1456 + body: z.never().optional(), 1457 + path: z.never().optional(), 1458 + query: z.never().optional() 1459 + }); 1460 + 1461 + export const zDeleteFooData3 = z.object({ 1462 + body: z.never().optional(), 1463 + path: z.object({ 1464 + foo_param: z.string(), 1465 + BarParam: z.string() 1466 + }), 1467 + query: z.never().optional(), 1468 + headers: z.object({ 1469 + 'x-Foo-Bar': zModelWithString 1470 + }) 1471 + }); 1472 + 1473 + export const zCallWithDescriptionsData = z.object({ 1474 + body: z.never().optional(), 1475 + path: z.never().optional(), 1476 + query: z.object({ 1477 + parameterWithBreaks: z.string().optional(), 1478 + parameterWithBackticks: z.string().optional(), 1479 + parameterWithSlashes: z.string().optional(), 1480 + parameterWithExpressionPlaceholders: z.string().optional(), 1481 + parameterWithQuotes: z.string().optional(), 1482 + parameterWithReservedCharacters: z.string().optional() 1483 + }).optional() 1484 + }); 1485 + 1486 + export const zDeprecatedCallData = z.object({ 1487 + body: z.never().optional(), 1488 + path: z.never().optional(), 1489 + query: z.never().optional(), 1490 + headers: z.object({ 1491 + parameter: z.union([ 1492 + zDeprecatedModel, 1493 + z.null() 1494 + ]) 1495 + }) 1496 + }); 1497 + 1498 + export const zCallWithParametersData = z.object({ 1499 + body: z.union([ 1500 + z.object({}), 1501 + z.null() 1502 + ]), 1503 + path: z.object({ 1504 + parameterPath: z.union([ 1505 + z.string(), 1506 + z.null() 1507 + ]), 1508 + 'api-version': z.union([ 1509 + z.string(), 1510 + z.null() 1511 + ]) 1512 + }), 1513 + query: z.object({ 1514 + foo_ref_enum: zModelWithNestedArrayEnumsDataFooWritable.optional(), 1515 + foo_all_of_enum: zModelWithNestedArrayEnumsDataFooWritable, 1516 + cursor: z.union([ 1517 + z.string(), 1518 + z.null() 1519 + ]) 1520 + }), 1521 + headers: z.object({ 1522 + parameterHeader: z.union([ 1523 + z.string(), 1524 + z.null() 1525 + ]) 1526 + }) 1527 + }); 1528 + 1529 + export const zCallWithWeirdParameterNamesData = z.object({ 1530 + body: z.union([ 1531 + zModelWithString, 1532 + z.null() 1533 + ]), 1534 + path: z.object({ 1535 + 'parameter.path.1': z.string().optional(), 1536 + 'parameter-path-2': z.string().optional(), 1537 + 'PARAMETER-PATH-3': z.string().optional(), 1538 + 'api-version': z.union([ 1539 + z.string(), 1540 + z.null() 1541 + ]) 1542 + }), 1543 + query: z.object({ 1544 + default: z.string().optional(), 1545 + 'parameter-query': z.union([ 1546 + z.string(), 1547 + z.null() 1548 + ]) 1549 + }), 1550 + headers: z.object({ 1551 + 'parameter.header': z.union([ 1552 + z.string(), 1553 + z.null() 1554 + ]) 1555 + }) 1556 + }); 1557 + 1558 + export const zGetCallWithOptionalParamData = z.object({ 1559 + body: zModelWithOneOfEnum, 1560 + path: z.never().optional(), 1561 + query: z.object({ 1562 + page: z.number().optional() 1563 + }).optional() 1564 + }); 1565 + 1566 + export const zPostCallWithOptionalParamData = z.object({ 1567 + body: z.object({ 1568 + offset: z.union([ 1569 + z.number(), 1570 + z.null() 1571 + ]).optional() 1572 + }).optional(), 1573 + path: z.never().optional(), 1574 + query: z.object({ 1575 + parameter: zPageable 1576 + }) 1577 + }); 1578 + 1579 + export const zPostCallWithOptionalParamResponse = z.union([ 1580 + z.number(), 1581 + z.void() 1582 + ]); 1583 + 1584 + export const zPostApiVbyApiVersionRequestBodyData = z.object({ 1585 + body: zSimpleRequestBody.optional(), 1586 + path: z.never().optional(), 1587 + query: z.object({ 1588 + parameter: z.string().optional() 1589 + }).optional() 1590 + }); 1591 + 1592 + export const zPostApiVbyApiVersionFormDataData = z.object({ 1593 + body: zSimpleFormData.optional(), 1594 + path: z.never().optional(), 1595 + query: z.object({ 1596 + parameter: z.string().optional() 1597 + }).optional() 1598 + }); 1599 + 1600 + export const zCallWithDefaultParametersData = z.object({ 1601 + body: z.never().optional(), 1602 + path: z.never().optional(), 1603 + query: z.object({ 1604 + parameterString: z.union([ 1605 + z.string().default('Hello World!'), 1606 + z.null() 1607 + ]).optional().default('Hello World!'), 1608 + parameterNumber: z.union([ 1609 + z.number().default(123), 1610 + z.null() 1611 + ]).optional().default(123), 1612 + parameterBoolean: z.union([ 1613 + z.boolean().default(true), 1614 + z.null() 1615 + ]).optional().default(true), 1616 + parameterEnum: z.enum([ 1617 + 'Success', 1618 + 'Warning', 1619 + 'Error' 1620 + ]).optional(), 1621 + parameterModel: z.union([ 1622 + zModelWithString, 1623 + z.null() 1624 + ]).optional() 1625 + }).optional() 1626 + }); 1627 + 1628 + export const zCallWithDefaultOptionalParametersData = z.object({ 1629 + body: z.never().optional(), 1630 + path: z.never().optional(), 1631 + query: z.object({ 1632 + parameterString: z.string().optional().default('Hello World!'), 1633 + parameterNumber: z.number().optional().default(123), 1634 + parameterBoolean: z.boolean().optional().default(true), 1635 + parameterEnum: z.enum([ 1636 + 'Success', 1637 + 'Warning', 1638 + 'Error' 1639 + ]).optional(), 1640 + parameterModel: zModelWithString.optional() 1641 + }).optional() 1642 + }); 1643 + 1644 + export const zCallToTestOrderOfParamsData = z.object({ 1645 + body: z.never().optional(), 1646 + path: z.never().optional(), 1647 + query: z.object({ 1648 + parameterOptionalStringWithDefault: z.string().optional().default('Hello World!'), 1649 + parameterOptionalStringWithEmptyDefault: z.string().optional().default(''), 1650 + parameterOptionalStringWithNoDefault: z.string().optional(), 1651 + parameterStringWithDefault: z.string().default('Hello World!'), 1652 + parameterStringWithEmptyDefault: z.string().default(''), 1653 + parameterStringWithNoDefault: z.string(), 1654 + parameterStringNullableWithNoDefault: z.union([ 1655 + z.string(), 1656 + z.null() 1657 + ]).optional(), 1658 + parameterStringNullableWithDefault: z.union([ 1659 + z.string(), 1660 + z.null() 1661 + ]).optional().default(null) 1662 + }) 1663 + }); 1664 + 1665 + export const zDuplicateNameData = z.object({ 1666 + body: z.never().optional(), 1667 + path: z.never().optional(), 1668 + query: z.never().optional() 1669 + }); 1670 + 1671 + export const zDuplicateName2Data = z.object({ 1672 + body: z.never().optional(), 1673 + path: z.never().optional(), 1674 + query: z.never().optional() 1675 + }); 1676 + 1677 + export const zDuplicateName3Data = z.object({ 1678 + body: z.never().optional(), 1679 + path: z.never().optional(), 1680 + query: z.never().optional() 1681 + }); 1682 + 1683 + export const zDuplicateName4Data = z.object({ 1684 + body: z.never().optional(), 1685 + path: z.never().optional(), 1686 + query: z.never().optional() 1687 + }); 1688 + 1689 + export const zCallWithNoContentResponseData = z.object({ 1690 + body: z.never().optional(), 1691 + path: z.never().optional(), 1692 + query: z.never().optional() 1693 + }); 1694 + 1695 + /** 1696 + * Success 1697 + */ 1698 + export const zCallWithNoContentResponseResponse = z.void(); 1699 + 1700 + export const zCallWithResponseAndNoContentResponseData = z.object({ 1701 + body: z.never().optional(), 1702 + path: z.never().optional(), 1703 + query: z.never().optional() 1704 + }); 1705 + 1706 + export const zCallWithResponseAndNoContentResponseResponse = z.union([ 1707 + z.number(), 1708 + z.void() 1709 + ]); 1710 + 1711 + export const zDummyAData = z.object({ 1712 + body: z.never().optional(), 1713 + path: z.never().optional(), 1714 + query: z.never().optional() 1715 + }); 1716 + 1717 + export const zDummyAResponse = z400; 1718 + 1719 + export const zDummyBData = z.object({ 1720 + body: z.never().optional(), 1721 + path: z.never().optional(), 1722 + query: z.never().optional() 1723 + }); 1724 + 1725 + /** 1726 + * Success 1727 + */ 1728 + export const zDummyBResponse = z.void(); 1729 + 1730 + export const zCallWithResponseData = z.object({ 1731 + body: z.never().optional(), 1732 + path: z.never().optional(), 1733 + query: z.never().optional() 1734 + }); 1735 + 1736 + export const zCallWithResponseResponse = zImport; 1737 + 1738 + export const zCallWithDuplicateResponsesData = z.object({ 1739 + body: z.never().optional(), 1740 + path: z.never().optional(), 1741 + query: z.never().optional() 1742 + }); 1743 + 1744 + export const zCallWithDuplicateResponsesResponse = z.union([ 1745 + zModelWithBoolean.and(zModelWithInteger), 1746 + zModelWithString 1747 + ]); 1748 + 1749 + export const zCallWithResponsesData = z.object({ 1750 + body: z.never().optional(), 1751 + path: z.never().optional(), 1752 + query: z.never().optional() 1753 + }); 1754 + 1755 + export const zCallWithResponsesResponse = z.union([ 1756 + z.object({ 1757 + '@namespace.string': z.string().readonly().optional(), 1758 + '@namespace.integer': z.number().int().readonly().optional(), 1759 + value: z.array(zModelWithString).readonly().optional() 1760 + }), 1761 + zModelThatExtends, 1762 + zModelThatExtendsExtends 1763 + ]); 1764 + 1765 + export const zCollectionFormatData = z.object({ 1766 + body: z.never().optional(), 1767 + path: z.never().optional(), 1768 + query: z.object({ 1769 + parameterArrayCSV: z.union([ 1770 + z.array(z.string()), 1771 + z.null() 1772 + ]), 1773 + parameterArraySSV: z.union([ 1774 + z.array(z.string()), 1775 + z.null() 1776 + ]), 1777 + parameterArrayTSV: z.union([ 1778 + z.array(z.string()), 1779 + z.null() 1780 + ]), 1781 + parameterArrayPipes: z.union([ 1782 + z.array(z.string()), 1783 + z.null() 1784 + ]), 1785 + parameterArrayMulti: z.union([ 1786 + z.array(z.string()), 1787 + z.null() 1788 + ]) 1789 + }) 1790 + }); 1791 + 1792 + export const zTypesData = z.object({ 1793 + body: z.never().optional(), 1794 + path: z.object({ 1795 + id: z.number().int().optional() 1796 + }).optional(), 1797 + query: z.object({ 1798 + parameterNumber: z.number().default(123), 1799 + parameterString: z.union([ 1800 + z.string().default('default'), 1801 + z.null() 1802 + ]).default('default'), 1803 + parameterBoolean: z.union([ 1804 + z.boolean().default(true), 1805 + z.null() 1806 + ]).default(true), 1807 + parameterObject: z.union([ 1808 + z.object({}), 1809 + z.null() 1810 + ]).default(null), 1811 + parameterArray: z.union([ 1812 + z.array(z.string()), 1813 + z.null() 1814 + ]), 1815 + parameterDictionary: z.union([ 1816 + z.object({}), 1817 + z.null() 1818 + ]), 1819 + parameterEnum: z.union([ 1820 + z.literal('Success'), 1821 + z.literal('Warning'), 1822 + z.literal('Error'), 1823 + z.null() 1824 + ]) 1825 + }) 1826 + }); 1827 + 1828 + export const zTypesResponse = z.union([ 1829 + z.number(), 1830 + z.string(), 1831 + z.boolean(), 1832 + z.object({}) 1833 + ]); 1834 + 1835 + export const zUploadFileData = z.object({ 1836 + body: z.string(), 1837 + path: z.object({ 1838 + 'api-version': z.union([ 1839 + z.string(), 1840 + z.null() 1841 + ]) 1842 + }), 1843 + query: z.never().optional() 1844 + }); 1845 + 1846 + export const zUploadFileResponse = z.boolean(); 1847 + 1848 + export const zFileResponseData = z.object({ 1849 + body: z.never().optional(), 1850 + path: z.object({ 1851 + id: z.string(), 1852 + 'api-version': z.string() 1853 + }), 1854 + query: z.never().optional() 1855 + }); 1856 + 1857 + /** 1858 + * Success 1859 + */ 1860 + export const zFileResponseResponse = z.string(); 1861 + 1862 + export const zComplexTypesData = z.object({ 1863 + body: z.never().optional(), 1864 + path: z.never().optional(), 1865 + query: z.object({ 1866 + parameterObject: z.object({ 1867 + first: z.object({ 1868 + second: z.object({ 1869 + third: z.string().optional() 1870 + }).optional() 1871 + }).optional() 1872 + }), 1873 + parameterReference: zModelWithString 1874 + }) 1875 + }); 1876 + 1877 + /** 1878 + * Successful response 1879 + */ 1880 + export const zComplexTypesResponse = z.array(zModelWithString); 1881 + 1882 + export const zMultipartResponseData = z.object({ 1883 + body: z.never().optional(), 1884 + path: z.never().optional(), 1885 + query: z.never().optional() 1886 + }); 1887 + 1888 + /** 1889 + * OK 1890 + */ 1891 + export const zMultipartResponseResponse = z.object({ 1892 + file: z.string().optional(), 1893 + metadata: z.object({ 1894 + foo: z.string().optional(), 1895 + bar: z.string().optional() 1896 + }).optional() 1897 + }); 1898 + 1899 + export const zMultipartRequestData = z.object({ 1900 + body: z.object({ 1901 + content: z.string().optional(), 1902 + data: z.union([ 1903 + zModelWithString, 1904 + z.null() 1905 + ]).optional() 1906 + }).optional(), 1907 + path: z.never().optional(), 1908 + query: z.never().optional() 1909 + }); 1910 + 1911 + export const zComplexParamsData = z.object({ 1912 + body: z.object({ 1913 + key: z.union([ 1914 + z.string().max(64).regex(/^[a-zA-Z0-9_]*$/).readonly(), 1915 + z.null() 1916 + ]).readonly(), 1917 + name: z.union([ 1918 + z.string().max(255), 1919 + z.null() 1920 + ]), 1921 + enabled: z.boolean().optional().default(true), 1922 + type: z.enum([ 1923 + 'Monkey', 1924 + 'Horse', 1925 + 'Bird' 1926 + ]), 1927 + listOfModels: z.union([ 1928 + z.array(zModelWithString), 1929 + z.null() 1930 + ]).optional(), 1931 + listOfStrings: z.union([ 1932 + z.array(z.string()), 1933 + z.null() 1934 + ]).optional(), 1935 + parameters: z.union([ 1936 + zModelWithString, 1937 + zModelWithEnum, 1938 + zModelWithArray, 1939 + zModelWithDictionary 1940 + ]), 1941 + user: z.object({ 1942 + id: z.number().int().readonly().optional(), 1943 + name: z.union([ 1944 + z.string().readonly(), 1945 + z.null() 1946 + ]).readonly().optional() 1947 + }).readonly().optional() 1948 + }).optional(), 1949 + path: z.object({ 1950 + id: z.number().int(), 1951 + 'api-version': z.string() 1952 + }), 1953 + query: z.never().optional() 1954 + }); 1955 + 1956 + /** 1957 + * Success 1958 + */ 1959 + export const zComplexParamsResponse = zModelWithString; 1960 + 1961 + export const zCallWithResultFromHeaderData = z.object({ 1962 + body: z.never().optional(), 1963 + path: z.never().optional(), 1964 + query: z.never().optional() 1965 + }); 1966 + 1967 + export const zTestErrorCodeData = z.object({ 1968 + body: z.never().optional(), 1969 + path: z.never().optional(), 1970 + query: z.object({ 1971 + status: z.number().int() 1972 + }) 1973 + }); 1974 + 1975 + export const zNonAsciiæøåÆøÅöôêÊ字符串Data = z.object({ 1976 + body: z.never().optional(), 1977 + path: z.never().optional(), 1978 + query: z.object({ 1979 + 'nonAsciiParamæøåÆØÅöôêÊ': z.number().int() 1980 + }) 1981 + }); 1982 + 1983 + /** 1984 + * Successful response 1985 + */ 1986 + export const zNonAsciiæøåÆøÅöôêÊ字符串Response = z.array(zNonAsciiStringæøåÆøÅöôêÊ字符串); 1987 + 1988 + export const zPutWithFormUrlEncodedData = z.object({ 1989 + body: zArrayWithStringsWritable, 1990 + path: z.never().optional(), 1991 + query: z.never().optional() 1992 + });
+24
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v3/type-format-zod/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod'; 4 + 5 + export const zFoo = z.object({ 6 + bar: z.number().int().optional(), 7 + foo: z.coerce.bigint().default(BigInt(0)), 8 + id: z.string() 9 + }); 10 + 11 + export const zBar = z.object({ 12 + foo: z.number().int() 13 + }); 14 + 15 + export const zPostFooData = z.object({ 16 + body: z.never().optional(), 17 + path: z.never().optional(), 18 + query: z.never().optional() 19 + }); 20 + 21 + /** 22 + * OK 23 + */ 24 + export const zPostFooResponse = zFoo;
+1992
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/default/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod/v4'; 4 + 5 + /** 6 + * Model with number-only name 7 + */ 8 + export const z400 = z.string(); 9 + 10 + /** 11 + * Testing multiline comments in string: First line 12 + * Second line 13 + * 14 + * Fourth line 15 + */ 16 + export const zCamelCaseCommentWithBreaks = z.int(); 17 + 18 + /** 19 + * Testing multiline comments in string: First line 20 + * Second line 21 + * 22 + * Fourth line 23 + */ 24 + export const zCommentWithBreaks = z.int(); 25 + 26 + /** 27 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 28 + */ 29 + export const zCommentWithBackticks = z.int(); 30 + 31 + /** 32 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 33 + */ 34 + export const zCommentWithBackticksAndQuotes = z.int(); 35 + 36 + /** 37 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 38 + */ 39 + export const zCommentWithSlashes = z.int(); 40 + 41 + /** 42 + * Testing expression placeholders in string: ${expression} should work 43 + */ 44 + export const zCommentWithExpressionPlaceholders = z.int(); 45 + 46 + /** 47 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 48 + */ 49 + export const zCommentWithQuotes = z.int(); 50 + 51 + /** 52 + * Testing reserved characters in string: * inline * and ** inline ** should work 53 + */ 54 + export const zCommentWithReservedCharacters = z.int(); 55 + 56 + /** 57 + * This is a simple number 58 + */ 59 + export const zSimpleInteger = z.int(); 60 + 61 + /** 62 + * This is a simple boolean 63 + */ 64 + export const zSimpleBoolean = z.boolean(); 65 + 66 + /** 67 + * This is a simple string 68 + */ 69 + export const zSimpleString = z.string(); 70 + 71 + /** 72 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 73 + */ 74 + export const zNonAsciiStringæøåÆøÅöôêÊ字符串 = z.string(); 75 + 76 + /** 77 + * This is a simple file 78 + */ 79 + export const zSimpleFile = z.string(); 80 + 81 + /** 82 + * This is a model with one string property 83 + */ 84 + export const zModelWithString = z.object({ 85 + prop: z.optional(z.string()) 86 + }); 87 + 88 + /** 89 + * This is a simple reference 90 + */ 91 + export const zSimpleReference = zModelWithString; 92 + 93 + /** 94 + * This is a simple string 95 + */ 96 + export const zSimpleStringWithPattern = z.union([ 97 + z.string().max(64).regex(/^[a-zA-Z0-9_]*$/), 98 + z.null() 99 + ]); 100 + 101 + /** 102 + * This is a simple enum with strings 103 + */ 104 + export const zEnumWithStrings = z.enum([ 105 + 'Success', 106 + 'Warning', 107 + 'Error', 108 + "'Single Quote'", 109 + '"Double Quotes"', 110 + 'Non-ascii: øæåôöØÆÅÔÖ字符串' 111 + ]); 112 + 113 + export const zEnumWithReplacedCharacters = z.enum([ 114 + "'Single Quote'", 115 + '"Double Quotes"', 116 + 'øæåôöØÆÅÔÖ字符串', 117 + '' 118 + ]); 119 + 120 + /** 121 + * This is a simple enum with numbers 122 + */ 123 + export const zEnumWithNumbers = z.unknown(); 124 + 125 + /** 126 + * Success=1,Warning=2,Error=3 127 + */ 128 + export const zEnumFromDescription = z.number(); 129 + 130 + /** 131 + * This is a simple enum with numbers 132 + */ 133 + export const zEnumWithExtensions = z.unknown(); 134 + 135 + export const zEnumWithXEnumNames = z.unknown(); 136 + 137 + /** 138 + * This is a simple array with numbers 139 + */ 140 + export const zArrayWithNumbers = z.array(z.int()); 141 + 142 + /** 143 + * This is a simple array with booleans 144 + */ 145 + export const zArrayWithBooleans = z.array(z.boolean()); 146 + 147 + /** 148 + * This is a simple array with strings 149 + */ 150 + export const zArrayWithStrings = z.array(z.string()).default(['test']); 151 + 152 + /** 153 + * This is a simple array with references 154 + */ 155 + export const zArrayWithReferences = z.array(zModelWithString); 156 + 157 + /** 158 + * This is a simple array containing an array 159 + */ 160 + export const zArrayWithArray = z.array(z.array(zModelWithString)); 161 + 162 + /** 163 + * This is a simple array with properties 164 + */ 165 + export const zArrayWithProperties = z.array(z.object({ 166 + '16x16': z.optional(zCamelCaseCommentWithBreaks), 167 + bar: z.optional(z.string()) 168 + })); 169 + 170 + /** 171 + * This is a simple array with any of properties 172 + */ 173 + export const zArrayWithAnyOfProperties = z.array(z.union([ 174 + z.object({ 175 + foo: z.optional(z.string()).default('test') 176 + }), 177 + z.object({ 178 + bar: z.optional(z.string()) 179 + }) 180 + ])); 181 + 182 + export const zAnyOfAnyAndNull = z.object({ 183 + data: z.optional(z.union([ 184 + z.unknown(), 185 + z.null() 186 + ])) 187 + }); 188 + 189 + /** 190 + * This is a simple array with any of properties 191 + */ 192 + export const zAnyOfArrays = z.object({ 193 + results: z.optional(z.array(z.union([ 194 + z.object({ 195 + foo: z.optional(z.string()) 196 + }), 197 + z.object({ 198 + bar: z.optional(z.string()) 199 + }) 200 + ]))) 201 + }); 202 + 203 + /** 204 + * This is a string dictionary 205 + */ 206 + export const zDictionaryWithString = z.object({}); 207 + 208 + export const zDictionaryWithPropertiesAndAdditionalProperties = z.object({ 209 + foo: z.optional(z.number()), 210 + bar: z.optional(z.boolean()) 211 + }); 212 + 213 + /** 214 + * This is a string reference 215 + */ 216 + export const zDictionaryWithReference = z.object({}); 217 + 218 + /** 219 + * This is a complex dictionary 220 + */ 221 + export const zDictionaryWithArray = z.object({}); 222 + 223 + /** 224 + * This is a string dictionary 225 + */ 226 + export const zDictionaryWithDictionary = z.record(z.string(), z.object({})); 227 + 228 + /** 229 + * This is a complex dictionary 230 + */ 231 + export const zDictionaryWithProperties = z.record(z.string(), z.object({ 232 + foo: z.optional(z.string()), 233 + bar: z.optional(z.string()) 234 + })); 235 + 236 + /** 237 + * This is a model with one number property 238 + */ 239 + export const zModelWithInteger = z.object({ 240 + prop: z.optional(z.int()) 241 + }); 242 + 243 + /** 244 + * This is a model with one boolean property 245 + */ 246 + export const zModelWithBoolean = z.object({ 247 + prop: z.optional(z.boolean()) 248 + }); 249 + 250 + /** 251 + * This is a model with one string property 252 + */ 253 + export const zModelWithStringError = z.object({ 254 + prop: z.optional(z.string()) 255 + }); 256 + 257 + /** 258 + * `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) 259 + */ 260 + export const zModelFromZendesk = z.string(); 261 + 262 + /** 263 + * This is a model with one string property 264 + */ 265 + export const zModelWithNullableString = z.object({ 266 + nullableProp1: z.optional(z.union([ 267 + z.string(), 268 + z.null() 269 + ])), 270 + nullableRequiredProp1: z.union([ 271 + z.string(), 272 + z.null() 273 + ]), 274 + nullableProp2: z.optional(z.union([ 275 + z.string(), 276 + z.null() 277 + ])), 278 + nullableRequiredProp2: z.union([ 279 + z.string(), 280 + z.null() 281 + ]), 282 + 'foo_bar-enum': z.optional(z.enum([ 283 + 'Success', 284 + 'Warning', 285 + 'Error', 286 + 'ØÆÅ字符串' 287 + ])) 288 + }); 289 + 290 + /** 291 + * This is a model with one enum 292 + */ 293 + export const zModelWithEnum = z.object({ 294 + 'foo_bar-enum': z.optional(z.enum([ 295 + 'Success', 296 + 'Warning', 297 + 'Error', 298 + 'ØÆÅ字符串' 299 + ])), 300 + statusCode: z.optional(z.enum([ 301 + '100', 302 + '200 FOO', 303 + '300 FOO_BAR', 304 + '400 foo-bar', 305 + '500 foo.bar', 306 + '600 foo&bar' 307 + ])), 308 + bool: z.optional(z.unknown()) 309 + }); 310 + 311 + /** 312 + * This is a model with one enum with escaped name 313 + */ 314 + export const zModelWithEnumWithHyphen = z.object({ 315 + 'foo-bar-baz-qux': z.optional(z.enum([ 316 + '3.0' 317 + ])) 318 + }); 319 + 320 + /** 321 + * This is a model with one enum 322 + */ 323 + export const zModelWithEnumFromDescription = z.object({ 324 + test: z.optional(z.int()) 325 + }); 326 + 327 + /** 328 + * This is a model with nested enums 329 + */ 330 + export const zModelWithNestedEnums = z.object({ 331 + dictionaryWithEnum: z.optional(z.object({})), 332 + dictionaryWithEnumFromDescription: z.optional(z.object({})), 333 + arrayWithEnum: z.optional(z.array(z.enum([ 334 + 'Success', 335 + 'Warning', 336 + 'Error' 337 + ]))), 338 + arrayWithDescription: z.optional(z.array(z.int())), 339 + 'foo_bar-enum': z.optional(z.enum([ 340 + 'Success', 341 + 'Warning', 342 + 'Error', 343 + 'ØÆÅ字符串' 344 + ])) 345 + }); 346 + 347 + /** 348 + * This is a model with one nested property 349 + */ 350 + export const zModelWithProperties = z.object({ 351 + required: z.string(), 352 + requiredAndReadOnly: z.string().readonly(), 353 + requiredAndNullable: z.union([ 354 + z.string(), 355 + z.null() 356 + ]), 357 + string: z.optional(z.string()), 358 + number: z.optional(z.number()), 359 + boolean: z.optional(z.boolean()), 360 + reference: z.optional(zModelWithString), 361 + 'property with space': z.optional(z.string()), 362 + default: z.optional(z.string()), 363 + try: z.optional(z.string()), 364 + '@namespace.string': z.optional(z.string().readonly()), 365 + '@namespace.integer': z.optional(z.int().readonly()) 366 + }); 367 + 368 + /** 369 + * This is a model with one property containing a reference 370 + */ 371 + export const zModelWithReference = z.object({ 372 + prop: z.optional(zModelWithProperties) 373 + }); 374 + 375 + export const zModelWithReadOnlyAndWriteOnly = z.object({ 376 + foo: z.string(), 377 + bar: z.string().readonly() 378 + }); 379 + 380 + /** 381 + * This is a model with one property containing an array 382 + */ 383 + export const zModelWithArrayReadOnlyAndWriteOnly = z.object({ 384 + prop: z.optional(z.array(zModelWithReadOnlyAndWriteOnly)), 385 + propWithFile: z.optional(z.array(z.string())), 386 + propWithNumber: z.optional(z.array(z.number())) 387 + }); 388 + 389 + /** 390 + * This is a model with one property containing an array 391 + */ 392 + export const zModelWithArray = z.object({ 393 + prop: z.optional(z.array(zModelWithString)), 394 + propWithFile: z.optional(z.array(z.string())), 395 + propWithNumber: z.optional(z.array(z.number())) 396 + }); 397 + 398 + /** 399 + * This is a model with one property containing a dictionary 400 + */ 401 + export const zModelWithDictionary = z.object({ 402 + prop: z.optional(z.object({})) 403 + }); 404 + 405 + /** 406 + * This is a deprecated model with a deprecated property 407 + * @deprecated 408 + */ 409 + export const zDeprecatedModel = z.object({ 410 + prop: z.optional(z.string()) 411 + }); 412 + 413 + /** 414 + * This is a model with one property containing a circular reference 415 + */ 416 + export const zModelWithCircularReference = z.object({ 417 + prop: z.optional(z.lazy(() => { 418 + return zModelWithCircularReference; 419 + })) 420 + }); 421 + 422 + /** 423 + * This is a model with one property with a 'one of' relationship 424 + */ 425 + export const zCompositionWithOneOf = z.object({ 426 + propA: z.optional(z.union([ 427 + zModelWithString, 428 + zModelWithEnum, 429 + zModelWithArray, 430 + zModelWithDictionary 431 + ])) 432 + }); 433 + 434 + /** 435 + * This is a model with one property with a 'one of' relationship where the options are not $ref 436 + */ 437 + export const zCompositionWithOneOfAnonymous = z.object({ 438 + propA: z.optional(z.union([ 439 + z.object({ 440 + propA: z.optional(z.string()) 441 + }), 442 + z.string(), 443 + z.int() 444 + ])) 445 + }); 446 + 447 + /** 448 + * Circle 449 + */ 450 + export const zModelCircle = z.object({ 451 + kind: z.string(), 452 + radius: z.optional(z.number()) 453 + }); 454 + 455 + /** 456 + * Square 457 + */ 458 + export const zModelSquare = z.object({ 459 + kind: z.string(), 460 + sideLength: z.optional(z.number()) 461 + }); 462 + 463 + /** 464 + * This is a model with one property with a 'one of' relationship where the options are not $ref 465 + */ 466 + export const zCompositionWithOneOfDiscriminator = z.union([ 467 + z.object({ 468 + kind: z.literal('circle') 469 + }).and(zModelCircle), 470 + z.object({ 471 + kind: z.literal('square') 472 + }).and(zModelSquare) 473 + ]); 474 + 475 + /** 476 + * This is a model with one property with a 'any of' relationship 477 + */ 478 + export const zCompositionWithAnyOf = z.object({ 479 + propA: z.optional(z.union([ 480 + zModelWithString, 481 + zModelWithEnum, 482 + zModelWithArray, 483 + zModelWithDictionary 484 + ])) 485 + }); 486 + 487 + /** 488 + * This is a model with one property with a 'any of' relationship where the options are not $ref 489 + */ 490 + export const zCompositionWithAnyOfAnonymous = z.object({ 491 + propA: z.optional(z.union([ 492 + z.object({ 493 + propA: z.optional(z.string()) 494 + }), 495 + z.string(), 496 + z.int() 497 + ])) 498 + }); 499 + 500 + /** 501 + * This is a model with nested 'any of' property with a type null 502 + */ 503 + export const zCompositionWithNestedAnyAndTypeNull = z.object({ 504 + propA: z.optional(z.union([ 505 + z.array(z.union([ 506 + zModelWithDictionary, 507 + z.null() 508 + ])), 509 + z.array(z.union([ 510 + zModelWithArray, 511 + z.null() 512 + ])) 513 + ])) 514 + }); 515 + 516 + export const z3eNum1Период = z.enum([ 517 + 'Bird', 518 + 'Dog' 519 + ]); 520 + 521 + export const zConstValue = z.literal('ConstValue'); 522 + 523 + /** 524 + * This is a model with one property with a 'any of' relationship where the options are not $ref 525 + */ 526 + export const zCompositionWithNestedAnyOfAndNull = z.object({ 527 + propA: z.optional(z.union([ 528 + z.array(z.union([ 529 + z3eNum1Период, 530 + zConstValue 531 + ])), 532 + z.null() 533 + ])) 534 + }); 535 + 536 + /** 537 + * This is a model with one property with a 'one of' relationship 538 + */ 539 + export const zCompositionWithOneOfAndNullable = z.object({ 540 + propA: z.optional(z.union([ 541 + z.object({ 542 + boolean: z.optional(z.boolean()) 543 + }), 544 + zModelWithEnum, 545 + zModelWithArray, 546 + zModelWithDictionary, 547 + z.null() 548 + ])) 549 + }); 550 + 551 + /** 552 + * This is a model that contains a simple dictionary within composition 553 + */ 554 + export const zCompositionWithOneOfAndSimpleDictionary = z.object({ 555 + propA: z.optional(z.union([ 556 + z.boolean(), 557 + z.object({}) 558 + ])) 559 + }); 560 + 561 + /** 562 + * This is a model that contains a dictionary of simple arrays within composition 563 + */ 564 + export const zCompositionWithOneOfAndSimpleArrayDictionary = z.object({ 565 + propA: z.optional(z.union([ 566 + z.boolean(), 567 + z.object({}) 568 + ])) 569 + }); 570 + 571 + /** 572 + * This is a model that contains a dictionary of complex arrays (composited) within composition 573 + */ 574 + export const zCompositionWithOneOfAndComplexArrayDictionary = z.object({ 575 + propA: z.optional(z.union([ 576 + z.boolean(), 577 + z.object({}) 578 + ])) 579 + }); 580 + 581 + /** 582 + * This is a model with one property with a 'all of' relationship 583 + */ 584 + export const zCompositionWithAllOfAndNullable = z.object({ 585 + propA: z.optional(z.union([ 586 + z.object({ 587 + boolean: z.optional(z.boolean()) 588 + }).and(zModelWithEnum).and(zModelWithArray).and(zModelWithDictionary), 589 + z.null() 590 + ])) 591 + }); 592 + 593 + /** 594 + * This is a model with one property with a 'any of' relationship 595 + */ 596 + export const zCompositionWithAnyOfAndNullable = z.object({ 597 + propA: z.optional(z.union([ 598 + z.object({ 599 + boolean: z.optional(z.boolean()) 600 + }), 601 + zModelWithEnum, 602 + zModelWithArray, 603 + zModelWithDictionary, 604 + z.null() 605 + ])) 606 + }); 607 + 608 + /** 609 + * This is a base model with two simple optional properties 610 + */ 611 + export const zCompositionBaseModel = z.object({ 612 + firstName: z.optional(z.string()), 613 + lastname: z.optional(z.string()) 614 + }); 615 + 616 + /** 617 + * This is a model that extends the base model 618 + */ 619 + export const zCompositionExtendedModel = zCompositionBaseModel.and(z.object({ 620 + age: z.number(), 621 + firstName: z.string(), 622 + lastname: z.string() 623 + })); 624 + 625 + /** 626 + * This is a model with one nested property 627 + */ 628 + export const zModelWithNestedProperties = z.object({ 629 + first: z.union([ 630 + z.object({ 631 + second: z.union([ 632 + z.object({ 633 + third: z.union([ 634 + z.string().readonly(), 635 + z.null() 636 + ]).readonly() 637 + }).readonly(), 638 + z.null() 639 + ]).readonly() 640 + }).readonly(), 641 + z.null() 642 + ]).readonly() 643 + }); 644 + 645 + /** 646 + * This is a model with duplicated properties 647 + */ 648 + export const zModelWithDuplicateProperties = z.object({ 649 + prop: z.optional(zModelWithString) 650 + }); 651 + 652 + /** 653 + * This is a model with ordered properties 654 + */ 655 + export const zModelWithOrderedProperties = z.object({ 656 + zebra: z.optional(z.string()), 657 + apple: z.optional(z.string()), 658 + hawaii: z.optional(z.string()) 659 + }); 660 + 661 + /** 662 + * This is a model with duplicated imports 663 + */ 664 + export const zModelWithDuplicateImports = z.object({ 665 + propA: z.optional(zModelWithString), 666 + propB: z.optional(zModelWithString), 667 + propC: z.optional(zModelWithString) 668 + }); 669 + 670 + /** 671 + * This is a model that extends another model 672 + */ 673 + export const zModelThatExtends = zModelWithString.and(z.object({ 674 + propExtendsA: z.optional(z.string()), 675 + propExtendsB: z.optional(zModelWithString) 676 + })); 677 + 678 + /** 679 + * This is a model that extends another model 680 + */ 681 + export const zModelThatExtendsExtends = zModelWithString.and(zModelThatExtends).and(z.object({ 682 + propExtendsC: z.optional(z.string()), 683 + propExtendsD: z.optional(zModelWithString) 684 + })); 685 + 686 + /** 687 + * This is a model that contains a some patterns 688 + */ 689 + export const zModelWithPattern = z.object({ 690 + key: z.string().max(64).regex(/^[a-zA-Z0-9_]*$/), 691 + name: z.string().max(255), 692 + enabled: z.optional(z.boolean().readonly()), 693 + modified: z.optional(z.iso.datetime().readonly()), 694 + id: z.optional(z.string().regex(/^\d{2}-\d{3}-\d{4}$/)), 695 + text: z.optional(z.string().regex(/^\w+$/)), 696 + patternWithSingleQuotes: z.optional(z.string().regex(/^[a-zA-Z0-9']*$/)), 697 + patternWithNewline: z.optional(z.string().regex(/aaa\nbbb/)), 698 + patternWithBacktick: z.optional(z.string().regex(/aaa`bbb/)) 699 + }); 700 + 701 + export const zFile = z.object({ 702 + id: z.optional(z.string().min(1).readonly()), 703 + updated_at: z.optional(z.iso.datetime().readonly()), 704 + created_at: z.optional(z.iso.datetime().readonly()), 705 + mime: z.string().min(1).max(24), 706 + file: z.optional(z.url().readonly()) 707 + }); 708 + 709 + export const zDefault = z.object({ 710 + name: z.optional(z.string()) 711 + }); 712 + 713 + export const zPageable = z.object({ 714 + page: z.optional(z.int().gte(0)).default(0), 715 + size: z.optional(z.int().gte(1)), 716 + sort: z.optional(z.array(z.string())) 717 + }); 718 + 719 + /** 720 + * This is a free-form object without additionalProperties. 721 + */ 722 + export const zFreeFormObjectWithoutAdditionalProperties = z.object({}); 723 + 724 + /** 725 + * This is a free-form object with additionalProperties: true. 726 + */ 727 + export const zFreeFormObjectWithAdditionalPropertiesEqTrue = z.object({}); 728 + 729 + /** 730 + * This is a free-form object with additionalProperties: {}. 731 + */ 732 + export const zFreeFormObjectWithAdditionalPropertiesEqEmptyObject = z.object({}); 733 + 734 + export const zModelWithConst = z.object({ 735 + String: z.optional(z.literal('String')), 736 + number: z.optional(z.literal(0)), 737 + null: z.optional(z.null()), 738 + withType: z.optional(z.literal('Some string')) 739 + }); 740 + 741 + /** 742 + * This is a model with one property and additionalProperties: true 743 + */ 744 + export const zModelWithAdditionalPropertiesEqTrue = z.object({ 745 + prop: z.optional(z.string()) 746 + }); 747 + 748 + export const zNestedAnyOfArraysNullable = z.object({ 749 + nullableArray: z.optional(z.union([ 750 + z.array(z.union([ 751 + z.string(), 752 + z.boolean() 753 + ])), 754 + z.null() 755 + ])) 756 + }); 757 + 758 + /** 759 + * This is a reusable parameter 760 + */ 761 + export const zSimpleParameter = z.unknown(); 762 + 763 + export const zCompositionWithOneOfAndProperties = z.intersection(z.union([ 764 + z.object({ 765 + foo: zSimpleParameter 766 + }), 767 + z.object({ 768 + bar: zNonAsciiStringæøåÆøÅöôêÊ字符串 769 + }) 770 + ]), z.object({ 771 + baz: z.union([ 772 + z.int().gte(0), 773 + z.null() 774 + ]), 775 + qux: z.int().gte(0) 776 + })); 777 + 778 + /** 779 + * An object that can be null 780 + */ 781 + export const zNullableObject = z.union([ 782 + z.object({ 783 + foo: z.optional(z.string()) 784 + }), 785 + z.null() 786 + ]).default(null); 787 + 788 + /** 789 + * Some % character 790 + */ 791 + export const zCharactersInDescription = z.string(); 792 + 793 + export const zModelWithNullableObject = z.object({ 794 + data: z.optional(zNullableObject) 795 + }); 796 + 797 + export const zModelWithOneOfEnum = z.union([ 798 + z.object({ 799 + foo: z.enum([ 800 + 'Bar' 801 + ]) 802 + }), 803 + z.object({ 804 + foo: z.enum([ 805 + 'Baz' 806 + ]) 807 + }), 808 + z.object({ 809 + foo: z.enum([ 810 + 'Qux' 811 + ]) 812 + }), 813 + z.object({ 814 + content: z.iso.datetime(), 815 + foo: z.enum([ 816 + 'Quux' 817 + ]) 818 + }), 819 + z.object({ 820 + content: z.tuple([ 821 + z.iso.datetime(), 822 + z.string() 823 + ]), 824 + foo: z.enum([ 825 + 'Corge' 826 + ]) 827 + }) 828 + ]); 829 + 830 + export const zModelWithNestedArrayEnumsDataFoo = z.enum([ 831 + 'foo', 832 + 'bar' 833 + ]); 834 + 835 + export const zModelWithNestedArrayEnumsDataBar = z.enum([ 836 + 'baz', 837 + 'qux' 838 + ]); 839 + 840 + export const zModelWithNestedArrayEnumsData = z.object({ 841 + foo: z.optional(z.array(zModelWithNestedArrayEnumsDataFoo)), 842 + bar: z.optional(z.array(zModelWithNestedArrayEnumsDataBar)) 843 + }); 844 + 845 + export const zModelWithNestedArrayEnums = z.object({ 846 + array_strings: z.optional(z.array(z.string())), 847 + data: z.optional(zModelWithNestedArrayEnumsData) 848 + }); 849 + 850 + export const zModelWithNestedCompositionEnums = z.object({ 851 + foo: z.optional(zModelWithNestedArrayEnumsDataFoo) 852 + }); 853 + 854 + export const zModelWithConstantSizeArray = z.tuple([ 855 + z.number(), 856 + z.number() 857 + ]); 858 + 859 + export const zModelWithAnyOfConstantSizeArray = z.tuple([ 860 + z.union([ 861 + z.number(), 862 + z.string() 863 + ]), 864 + z.union([ 865 + z.number(), 866 + z.string() 867 + ]), 868 + z.union([ 869 + z.number(), 870 + z.string() 871 + ]) 872 + ]); 873 + 874 + export const zModelWithPrefixItemsConstantSizeArray = z.tuple([ 875 + zModelWithInteger, 876 + z.union([ 877 + z.number(), 878 + z.string() 879 + ]), 880 + z.string() 881 + ]); 882 + 883 + export const zModelWithAnyOfConstantSizeArrayNullable = z.tuple([ 884 + z.union([ 885 + z.number(), 886 + z.null(), 887 + z.string() 888 + ]), 889 + z.union([ 890 + z.number(), 891 + z.null(), 892 + z.string() 893 + ]), 894 + z.union([ 895 + z.number(), 896 + z.null(), 897 + z.string() 898 + ]) 899 + ]); 900 + 901 + /** 902 + * Model with restricted keyword name 903 + */ 904 + export const zImport = z.string(); 905 + 906 + export const zModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = z.tuple([ 907 + z.union([ 908 + z.number(), 909 + zImport 910 + ]), 911 + z.union([ 912 + z.number(), 913 + zImport 914 + ]) 915 + ]); 916 + 917 + export const zModelWithAnyOfConstantSizeArrayAndIntersect = z.tuple([ 918 + z.intersection(z.number(), z.string()), 919 + z.intersection(z.number(), z.string()) 920 + ]); 921 + 922 + export const zModelWithNumericEnumUnion = z.object({ 923 + value: z.optional(z.unknown()) 924 + }); 925 + 926 + /** 927 + * Some description with `back ticks` 928 + */ 929 + export const zModelWithBackticksInDescription = z.object({ 930 + template: z.optional(z.string()) 931 + }); 932 + 933 + export const zModelWithOneOfAndProperties = z.intersection(z.union([ 934 + zSimpleParameter, 935 + zNonAsciiStringæøåÆøÅöôêÊ字符串 936 + ]), z.object({ 937 + baz: z.union([ 938 + z.int().gte(0), 939 + z.null() 940 + ]), 941 + qux: z.int().gte(0) 942 + })); 943 + 944 + /** 945 + * Model used to test deduplication strategy (unused) 946 + */ 947 + export const zParameterSimpleParameterUnused = z.string(); 948 + 949 + /** 950 + * Model used to test deduplication strategy 951 + */ 952 + export const zPostServiceWithEmptyTagResponse = z.string(); 953 + 954 + /** 955 + * Model used to test deduplication strategy 956 + */ 957 + export const zPostServiceWithEmptyTagResponse2 = z.string(); 958 + 959 + /** 960 + * Model used to test deduplication strategy 961 + */ 962 + export const zDeleteFooData = z.string(); 963 + 964 + /** 965 + * Model used to test deduplication strategy 966 + */ 967 + export const zDeleteFooData2 = z.string(); 968 + 969 + export const zSchemaWithFormRestrictedKeys = z.object({ 970 + description: z.optional(z.string()), 971 + 'x-enum-descriptions': z.optional(z.string()), 972 + 'x-enum-varnames': z.optional(z.string()), 973 + 'x-enumNames': z.optional(z.string()), 974 + title: z.optional(z.string()), 975 + object: z.optional(z.object({ 976 + description: z.optional(z.string()), 977 + 'x-enum-descriptions': z.optional(z.string()), 978 + 'x-enum-varnames': z.optional(z.string()), 979 + 'x-enumNames': z.optional(z.string()), 980 + title: z.optional(z.string()) 981 + })), 982 + array: z.optional(z.array(z.object({ 983 + description: z.optional(z.string()), 984 + 'x-enum-descriptions': z.optional(z.string()), 985 + 'x-enum-varnames': z.optional(z.string()), 986 + 'x-enumNames': z.optional(z.string()), 987 + title: z.optional(z.string()) 988 + }))) 989 + }); 990 + 991 + /** 992 + * This schema was giving PascalCase transformations a hard time 993 + */ 994 + export const zIoK8sApimachineryPkgApisMetaV1Preconditions = z.object({ 995 + resourceVersion: z.optional(z.string()), 996 + uid: z.optional(z.string()) 997 + }); 998 + 999 + /** 1000 + * This schema was giving PascalCase transformations a hard time 1001 + */ 1002 + export const zIoK8sApimachineryPkgApisMetaV1DeleteOptions = z.object({ 1003 + preconditions: z.optional(zIoK8sApimachineryPkgApisMetaV1Preconditions) 1004 + }); 1005 + 1006 + export const zAdditionalPropertiesUnknownIssue = z.object({}); 1007 + 1008 + export const zAdditionalPropertiesUnknownIssue2 = z.object({}); 1009 + 1010 + export const zAdditionalPropertiesUnknownIssue3 = z.intersection(z.string(), z.object({ 1011 + entries: z.object({}) 1012 + })); 1013 + 1014 + export const zAdditionalPropertiesIntegerIssue = z.object({ 1015 + value: z.int() 1016 + }); 1017 + 1018 + export const zGenericSchemaDuplicateIssue1SystemBoolean = z.object({ 1019 + item: z.optional(z.boolean()), 1020 + error: z.optional(z.union([ 1021 + z.string(), 1022 + z.null() 1023 + ])), 1024 + hasError: z.optional(z.boolean().readonly()), 1025 + data: z.optional(z.object({})) 1026 + }); 1027 + 1028 + export const zGenericSchemaDuplicateIssue1SystemString = z.object({ 1029 + item: z.optional(z.union([ 1030 + z.string(), 1031 + z.null() 1032 + ])), 1033 + error: z.optional(z.union([ 1034 + z.string(), 1035 + z.null() 1036 + ])), 1037 + hasError: z.optional(z.boolean().readonly()) 1038 + }); 1039 + 1040 + export const zOneOfAllOfIssue = z.union([ 1041 + z.intersection(z.union([ 1042 + zConstValue, 1043 + zGenericSchemaDuplicateIssue1SystemBoolean 1044 + ]), z3eNum1Период), 1045 + zGenericSchemaDuplicateIssue1SystemString 1046 + ]); 1047 + 1048 + /** 1049 + * Model with number-only name 1050 + */ 1051 + export const z400Writable = z.string(); 1052 + 1053 + /** 1054 + * Testing multiline comments in string: First line 1055 + * Second line 1056 + * 1057 + * Fourth line 1058 + */ 1059 + export const zCamelCaseCommentWithBreaksWritable = z.int(); 1060 + 1061 + /** 1062 + * Testing multiline comments in string: First line 1063 + * Second line 1064 + * 1065 + * Fourth line 1066 + */ 1067 + export const zCommentWithBreaksWritable = z.int(); 1068 + 1069 + /** 1070 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1071 + */ 1072 + export const zCommentWithBackticksWritable = z.int(); 1073 + 1074 + /** 1075 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 1076 + */ 1077 + export const zCommentWithBackticksAndQuotesWritable = z.int(); 1078 + 1079 + /** 1080 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1081 + */ 1082 + export const zCommentWithSlashesWritable = z.int(); 1083 + 1084 + /** 1085 + * Testing expression placeholders in string: ${expression} should work 1086 + */ 1087 + export const zCommentWithExpressionPlaceholdersWritable = z.int(); 1088 + 1089 + /** 1090 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1091 + */ 1092 + export const zCommentWithQuotesWritable = z.int(); 1093 + 1094 + /** 1095 + * Testing reserved characters in string: * inline * and ** inline ** should work 1096 + */ 1097 + export const zCommentWithReservedCharactersWritable = z.int(); 1098 + 1099 + /** 1100 + * This is a simple number 1101 + */ 1102 + export const zSimpleIntegerWritable = z.int(); 1103 + 1104 + /** 1105 + * This is a simple boolean 1106 + */ 1107 + export const zSimpleBooleanWritable = z.boolean(); 1108 + 1109 + /** 1110 + * This is a simple string 1111 + */ 1112 + export const zSimpleStringWritable = z.string(); 1113 + 1114 + /** 1115 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 1116 + */ 1117 + export const zNonAsciiStringæøåÆøÅöôêÊ字符串Writable = z.string(); 1118 + 1119 + /** 1120 + * This is a simple file 1121 + */ 1122 + export const zSimpleFileWritable = z.string(); 1123 + 1124 + /** 1125 + * This is a simple string 1126 + */ 1127 + export const zSimpleStringWithPatternWritable = z.union([ 1128 + z.string().max(64).regex(/^[a-zA-Z0-9_]*$/), 1129 + z.null() 1130 + ]); 1131 + 1132 + /** 1133 + * This is a simple enum with strings 1134 + */ 1135 + export const zEnumWithStringsWritable = z.enum([ 1136 + 'Success', 1137 + 'Warning', 1138 + 'Error', 1139 + "'Single Quote'", 1140 + '"Double Quotes"', 1141 + 'Non-ascii: øæåôöØÆÅÔÖ字符串' 1142 + ]); 1143 + 1144 + export const zEnumWithReplacedCharactersWritable = z.enum([ 1145 + "'Single Quote'", 1146 + '"Double Quotes"', 1147 + 'øæåôöØÆÅÔÖ字符串', 1148 + '' 1149 + ]); 1150 + 1151 + /** 1152 + * This is a simple enum with numbers 1153 + */ 1154 + export const zEnumWithNumbersWritable = z.unknown(); 1155 + 1156 + /** 1157 + * Success=1,Warning=2,Error=3 1158 + */ 1159 + export const zEnumFromDescriptionWritable = z.number(); 1160 + 1161 + /** 1162 + * This is a simple enum with numbers 1163 + */ 1164 + export const zEnumWithExtensionsWritable = z.unknown(); 1165 + 1166 + export const zEnumWithXEnumNamesWritable = z.unknown(); 1167 + 1168 + /** 1169 + * This is a simple array with numbers 1170 + */ 1171 + export const zArrayWithNumbersWritable = z.array(z.int()); 1172 + 1173 + /** 1174 + * This is a simple array with booleans 1175 + */ 1176 + export const zArrayWithBooleansWritable = z.array(z.boolean()); 1177 + 1178 + /** 1179 + * This is a simple array with strings 1180 + */ 1181 + export const zArrayWithStringsWritable = z.array(z.string()).default(['test']); 1182 + 1183 + /** 1184 + * This is a string dictionary 1185 + */ 1186 + export const zDictionaryWithStringWritable = z.object({}); 1187 + 1188 + /** 1189 + * This is a string dictionary 1190 + */ 1191 + export const zDictionaryWithDictionaryWritable = z.record(z.string(), z.object({})); 1192 + 1193 + /** 1194 + * `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) 1195 + */ 1196 + export const zModelFromZendeskWritable = z.string(); 1197 + 1198 + export const zModelWithReadOnlyAndWriteOnlyWritable = z.object({ 1199 + foo: z.string(), 1200 + baz: z.string() 1201 + }); 1202 + 1203 + /** 1204 + * This is a model with one property containing an array 1205 + */ 1206 + export const zModelWithArrayReadOnlyAndWriteOnlyWritable = z.object({ 1207 + prop: z.optional(z.array(zModelWithReadOnlyAndWriteOnlyWritable)), 1208 + propWithFile: z.optional(z.array(z.string())), 1209 + propWithNumber: z.optional(z.array(z.number())) 1210 + }); 1211 + 1212 + export const z3eNum1ПериодWritable = z.enum([ 1213 + 'Bird', 1214 + 'Dog' 1215 + ]); 1216 + 1217 + export const zConstValueWritable = z.literal('ConstValue'); 1218 + 1219 + /** 1220 + * This is a free-form object without additionalProperties. 1221 + */ 1222 + export const zFreeFormObjectWithoutAdditionalPropertiesWritable = z.object({}); 1223 + 1224 + /** 1225 + * This is a free-form object with additionalProperties: true. 1226 + */ 1227 + export const zFreeFormObjectWithAdditionalPropertiesEqTrueWritable = z.object({}); 1228 + 1229 + /** 1230 + * This is a free-form object with additionalProperties: {}. 1231 + */ 1232 + export const zFreeFormObjectWithAdditionalPropertiesEqEmptyObjectWritable = z.object({}); 1233 + 1234 + /** 1235 + * Some % character 1236 + */ 1237 + export const zCharactersInDescriptionWritable = z.string(); 1238 + 1239 + export const zModelWithNestedArrayEnumsDataFooWritable = z.enum([ 1240 + 'foo', 1241 + 'bar' 1242 + ]); 1243 + 1244 + export const zModelWithNestedArrayEnumsDataBarWritable = z.enum([ 1245 + 'baz', 1246 + 'qux' 1247 + ]); 1248 + 1249 + export const zModelWithConstantSizeArrayWritable = z.tuple([ 1250 + z.number(), 1251 + z.number() 1252 + ]); 1253 + 1254 + export const zModelWithAnyOfConstantSizeArrayWritable = z.tuple([ 1255 + z.union([ 1256 + z.number(), 1257 + z.string() 1258 + ]), 1259 + z.union([ 1260 + z.number(), 1261 + z.string() 1262 + ]), 1263 + z.union([ 1264 + z.number(), 1265 + z.string() 1266 + ]) 1267 + ]); 1268 + 1269 + export const zModelWithAnyOfConstantSizeArrayNullableWritable = z.tuple([ 1270 + z.union([ 1271 + z.number(), 1272 + z.null(), 1273 + z.string() 1274 + ]), 1275 + z.union([ 1276 + z.number(), 1277 + z.null(), 1278 + z.string() 1279 + ]), 1280 + z.union([ 1281 + z.number(), 1282 + z.null(), 1283 + z.string() 1284 + ]) 1285 + ]); 1286 + 1287 + /** 1288 + * Model with restricted keyword name 1289 + */ 1290 + export const zImportWritable = z.string(); 1291 + 1292 + export const zModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = z.tuple([ 1293 + z.union([ 1294 + z.number(), 1295 + zImportWritable 1296 + ]), 1297 + z.union([ 1298 + z.number(), 1299 + zImportWritable 1300 + ]) 1301 + ]); 1302 + 1303 + export const zModelWithAnyOfConstantSizeArrayAndIntersectWritable = z.tuple([ 1304 + z.intersection(z.number(), z.string()), 1305 + z.intersection(z.number(), z.string()) 1306 + ]); 1307 + 1308 + /** 1309 + * Model used to test deduplication strategy (unused) 1310 + */ 1311 + export const zParameterSimpleParameterUnusedWritable = z.string(); 1312 + 1313 + /** 1314 + * Model used to test deduplication strategy 1315 + */ 1316 + export const zPostServiceWithEmptyTagResponseWritable = z.string(); 1317 + 1318 + /** 1319 + * Model used to test deduplication strategy 1320 + */ 1321 + export const zPostServiceWithEmptyTagResponse2Writable = z.string(); 1322 + 1323 + /** 1324 + * Model used to test deduplication strategy 1325 + */ 1326 + export const zDeleteFooDataWritable = z.string(); 1327 + 1328 + /** 1329 + * Model used to test deduplication strategy 1330 + */ 1331 + export const zDeleteFooData2Writable = z.string(); 1332 + 1333 + export const zAdditionalPropertiesUnknownIssueWritable = z.object({}); 1334 + 1335 + export const zAdditionalPropertiesUnknownIssue2Writable = z.object({}); 1336 + 1337 + export const zOneOfAllOfIssueWritable = z.union([ 1338 + z.intersection(z.union([ 1339 + zConstValueWritable, 1340 + zGenericSchemaDuplicateIssue1SystemBoolean 1341 + ]), z3eNum1Период), 1342 + zGenericSchemaDuplicateIssue1SystemString 1343 + ]); 1344 + 1345 + /** 1346 + * Parameter with illegal characters 1347 + */ 1348 + export const zXFooBar = zModelWithString; 1349 + 1350 + /** 1351 + * A reusable request body 1352 + */ 1353 + export const zSimpleRequestBody = zModelWithString; 1354 + 1355 + /** 1356 + * A reusable request body 1357 + */ 1358 + export const zSimpleFormData = zModelWithString; 1359 + 1360 + export const zExportData = z.object({ 1361 + body: z.optional(z.never()), 1362 + path: z.optional(z.never()), 1363 + query: z.optional(z.never()) 1364 + }); 1365 + 1366 + export const zPatchApiVbyApiVersionNoTagData = z.object({ 1367 + body: z.optional(z.never()), 1368 + path: z.optional(z.never()), 1369 + query: z.optional(z.never()) 1370 + }); 1371 + 1372 + export const zImportData = z.object({ 1373 + body: z.union([ 1374 + zModelWithReadOnlyAndWriteOnlyWritable, 1375 + zModelWithArrayReadOnlyAndWriteOnlyWritable 1376 + ]), 1377 + path: z.optional(z.never()), 1378 + query: z.optional(z.never()) 1379 + }); 1380 + 1381 + export const zImportResponse = z.union([ 1382 + zModelFromZendesk, 1383 + zModelWithReadOnlyAndWriteOnly 1384 + ]); 1385 + 1386 + export const zFooWowData = z.object({ 1387 + body: z.optional(z.never()), 1388 + path: z.optional(z.never()), 1389 + query: z.optional(z.never()) 1390 + }); 1391 + 1392 + export const zApiVVersionODataControllerCountData = z.object({ 1393 + body: z.optional(z.never()), 1394 + path: z.optional(z.never()), 1395 + query: z.optional(z.never()) 1396 + }); 1397 + 1398 + /** 1399 + * Success 1400 + */ 1401 + export const zApiVVersionODataControllerCountResponse = zModelFromZendesk; 1402 + 1403 + export const zGetApiVbyApiVersionSimpleOperationData = z.object({ 1404 + body: z.optional(z.never()), 1405 + path: z.object({ 1406 + foo_param: z.union([ 1407 + z.string(), 1408 + z.uuid() 1409 + ]) 1410 + }), 1411 + query: z.optional(z.never()) 1412 + }); 1413 + 1414 + /** 1415 + * Response is a simple number 1416 + */ 1417 + export const zGetApiVbyApiVersionSimpleOperationResponse = z.number(); 1418 + 1419 + export const zDeleteCallWithoutParametersAndResponseData = z.object({ 1420 + body: z.optional(z.never()), 1421 + path: z.optional(z.never()), 1422 + query: z.optional(z.never()) 1423 + }); 1424 + 1425 + export const zGetCallWithoutParametersAndResponseData = z.object({ 1426 + body: z.optional(z.never()), 1427 + path: z.optional(z.never()), 1428 + query: z.optional(z.never()) 1429 + }); 1430 + 1431 + export const zHeadCallWithoutParametersAndResponseData = z.object({ 1432 + body: z.optional(z.never()), 1433 + path: z.optional(z.never()), 1434 + query: z.optional(z.never()) 1435 + }); 1436 + 1437 + export const zOptionsCallWithoutParametersAndResponseData = z.object({ 1438 + body: z.optional(z.never()), 1439 + path: z.optional(z.never()), 1440 + query: z.optional(z.never()) 1441 + }); 1442 + 1443 + export const zPatchCallWithoutParametersAndResponseData = z.object({ 1444 + body: z.optional(z.never()), 1445 + path: z.optional(z.never()), 1446 + query: z.optional(z.never()) 1447 + }); 1448 + 1449 + export const zPostCallWithoutParametersAndResponseData = z.object({ 1450 + body: z.optional(z.never()), 1451 + path: z.optional(z.never()), 1452 + query: z.optional(z.never()) 1453 + }); 1454 + 1455 + export const zPutCallWithoutParametersAndResponseData = z.object({ 1456 + body: z.optional(z.never()), 1457 + path: z.optional(z.never()), 1458 + query: z.optional(z.never()) 1459 + }); 1460 + 1461 + export const zDeleteFooData3 = z.object({ 1462 + body: z.optional(z.never()), 1463 + path: z.object({ 1464 + foo_param: z.string(), 1465 + BarParam: z.string() 1466 + }), 1467 + query: z.optional(z.never()), 1468 + headers: z.object({ 1469 + 'x-Foo-Bar': zModelWithString 1470 + }) 1471 + }); 1472 + 1473 + export const zCallWithDescriptionsData = z.object({ 1474 + body: z.optional(z.never()), 1475 + path: z.optional(z.never()), 1476 + query: z.optional(z.object({ 1477 + parameterWithBreaks: z.optional(z.string()), 1478 + parameterWithBackticks: z.optional(z.string()), 1479 + parameterWithSlashes: z.optional(z.string()), 1480 + parameterWithExpressionPlaceholders: z.optional(z.string()), 1481 + parameterWithQuotes: z.optional(z.string()), 1482 + parameterWithReservedCharacters: z.optional(z.string()) 1483 + })) 1484 + }); 1485 + 1486 + export const zDeprecatedCallData = z.object({ 1487 + body: z.optional(z.never()), 1488 + path: z.optional(z.never()), 1489 + query: z.optional(z.never()), 1490 + headers: z.object({ 1491 + parameter: z.union([ 1492 + zDeprecatedModel, 1493 + z.null() 1494 + ]) 1495 + }) 1496 + }); 1497 + 1498 + export const zCallWithParametersData = z.object({ 1499 + body: z.union([ 1500 + z.object({}), 1501 + z.null() 1502 + ]), 1503 + path: z.object({ 1504 + parameterPath: z.union([ 1505 + z.string(), 1506 + z.null() 1507 + ]), 1508 + 'api-version': z.union([ 1509 + z.string(), 1510 + z.null() 1511 + ]) 1512 + }), 1513 + query: z.object({ 1514 + foo_ref_enum: z.optional(zModelWithNestedArrayEnumsDataFooWritable), 1515 + foo_all_of_enum: zModelWithNestedArrayEnumsDataFooWritable, 1516 + cursor: z.union([ 1517 + z.string(), 1518 + z.null() 1519 + ]) 1520 + }), 1521 + headers: z.object({ 1522 + parameterHeader: z.union([ 1523 + z.string(), 1524 + z.null() 1525 + ]) 1526 + }) 1527 + }); 1528 + 1529 + export const zCallWithWeirdParameterNamesData = z.object({ 1530 + body: z.union([ 1531 + zModelWithString, 1532 + z.null() 1533 + ]), 1534 + path: z.object({ 1535 + 'parameter.path.1': z.optional(z.string()), 1536 + 'parameter-path-2': z.optional(z.string()), 1537 + 'PARAMETER-PATH-3': z.optional(z.string()), 1538 + 'api-version': z.union([ 1539 + z.string(), 1540 + z.null() 1541 + ]) 1542 + }), 1543 + query: z.object({ 1544 + default: z.optional(z.string()), 1545 + 'parameter-query': z.union([ 1546 + z.string(), 1547 + z.null() 1548 + ]) 1549 + }), 1550 + headers: z.object({ 1551 + 'parameter.header': z.union([ 1552 + z.string(), 1553 + z.null() 1554 + ]) 1555 + }) 1556 + }); 1557 + 1558 + export const zGetCallWithOptionalParamData = z.object({ 1559 + body: zModelWithOneOfEnum, 1560 + path: z.optional(z.never()), 1561 + query: z.optional(z.object({ 1562 + page: z.optional(z.number()) 1563 + })) 1564 + }); 1565 + 1566 + export const zPostCallWithOptionalParamData = z.object({ 1567 + body: z.optional(z.object({ 1568 + offset: z.optional(z.union([ 1569 + z.number(), 1570 + z.null() 1571 + ])) 1572 + })), 1573 + path: z.optional(z.never()), 1574 + query: z.object({ 1575 + parameter: zPageable 1576 + }) 1577 + }); 1578 + 1579 + export const zPostCallWithOptionalParamResponse = z.union([ 1580 + z.number(), 1581 + z.void() 1582 + ]); 1583 + 1584 + export const zPostApiVbyApiVersionRequestBodyData = z.object({ 1585 + body: z.optional(zSimpleRequestBody), 1586 + path: z.optional(z.never()), 1587 + query: z.optional(z.object({ 1588 + parameter: z.optional(z.string()) 1589 + })) 1590 + }); 1591 + 1592 + export const zPostApiVbyApiVersionFormDataData = z.object({ 1593 + body: z.optional(zSimpleFormData), 1594 + path: z.optional(z.never()), 1595 + query: z.optional(z.object({ 1596 + parameter: z.optional(z.string()) 1597 + })) 1598 + }); 1599 + 1600 + export const zCallWithDefaultParametersData = z.object({ 1601 + body: z.optional(z.never()), 1602 + path: z.optional(z.never()), 1603 + query: z.optional(z.object({ 1604 + parameterString: z.optional(z.union([ 1605 + z.string().default('Hello World!'), 1606 + z.null() 1607 + ])).default('Hello World!'), 1608 + parameterNumber: z.optional(z.union([ 1609 + z.number().default(123), 1610 + z.null() 1611 + ])).default(123), 1612 + parameterBoolean: z.optional(z.union([ 1613 + z.boolean().default(true), 1614 + z.null() 1615 + ])).default(true), 1616 + parameterEnum: z.optional(z.enum([ 1617 + 'Success', 1618 + 'Warning', 1619 + 'Error' 1620 + ])), 1621 + parameterModel: z.optional(z.union([ 1622 + zModelWithString, 1623 + z.null() 1624 + ])) 1625 + })) 1626 + }); 1627 + 1628 + export const zCallWithDefaultOptionalParametersData = z.object({ 1629 + body: z.optional(z.never()), 1630 + path: z.optional(z.never()), 1631 + query: z.optional(z.object({ 1632 + parameterString: z.optional(z.string()).default('Hello World!'), 1633 + parameterNumber: z.optional(z.number()).default(123), 1634 + parameterBoolean: z.optional(z.boolean()).default(true), 1635 + parameterEnum: z.optional(z.enum([ 1636 + 'Success', 1637 + 'Warning', 1638 + 'Error' 1639 + ])), 1640 + parameterModel: z.optional(zModelWithString) 1641 + })) 1642 + }); 1643 + 1644 + export const zCallToTestOrderOfParamsData = z.object({ 1645 + body: z.optional(z.never()), 1646 + path: z.optional(z.never()), 1647 + query: z.object({ 1648 + parameterOptionalStringWithDefault: z.optional(z.string()).default('Hello World!'), 1649 + parameterOptionalStringWithEmptyDefault: z.optional(z.string()).default(''), 1650 + parameterOptionalStringWithNoDefault: z.optional(z.string()), 1651 + parameterStringWithDefault: z.string().default('Hello World!'), 1652 + parameterStringWithEmptyDefault: z.string().default(''), 1653 + parameterStringWithNoDefault: z.string(), 1654 + parameterStringNullableWithNoDefault: z.optional(z.union([ 1655 + z.string(), 1656 + z.null() 1657 + ])), 1658 + parameterStringNullableWithDefault: z.optional(z.union([ 1659 + z.string(), 1660 + z.null() 1661 + ])).default(null) 1662 + }) 1663 + }); 1664 + 1665 + export const zDuplicateNameData = z.object({ 1666 + body: z.optional(z.never()), 1667 + path: z.optional(z.never()), 1668 + query: z.optional(z.never()) 1669 + }); 1670 + 1671 + export const zDuplicateName2Data = z.object({ 1672 + body: z.optional(z.never()), 1673 + path: z.optional(z.never()), 1674 + query: z.optional(z.never()) 1675 + }); 1676 + 1677 + export const zDuplicateName3Data = z.object({ 1678 + body: z.optional(z.never()), 1679 + path: z.optional(z.never()), 1680 + query: z.optional(z.never()) 1681 + }); 1682 + 1683 + export const zDuplicateName4Data = z.object({ 1684 + body: z.optional(z.never()), 1685 + path: z.optional(z.never()), 1686 + query: z.optional(z.never()) 1687 + }); 1688 + 1689 + export const zCallWithNoContentResponseData = z.object({ 1690 + body: z.optional(z.never()), 1691 + path: z.optional(z.never()), 1692 + query: z.optional(z.never()) 1693 + }); 1694 + 1695 + /** 1696 + * Success 1697 + */ 1698 + export const zCallWithNoContentResponseResponse = z.void(); 1699 + 1700 + export const zCallWithResponseAndNoContentResponseData = z.object({ 1701 + body: z.optional(z.never()), 1702 + path: z.optional(z.never()), 1703 + query: z.optional(z.never()) 1704 + }); 1705 + 1706 + export const zCallWithResponseAndNoContentResponseResponse = z.union([ 1707 + z.number(), 1708 + z.void() 1709 + ]); 1710 + 1711 + export const zDummyAData = z.object({ 1712 + body: z.optional(z.never()), 1713 + path: z.optional(z.never()), 1714 + query: z.optional(z.never()) 1715 + }); 1716 + 1717 + export const zDummyAResponse = z400; 1718 + 1719 + export const zDummyBData = z.object({ 1720 + body: z.optional(z.never()), 1721 + path: z.optional(z.never()), 1722 + query: z.optional(z.never()) 1723 + }); 1724 + 1725 + /** 1726 + * Success 1727 + */ 1728 + export const zDummyBResponse = z.void(); 1729 + 1730 + export const zCallWithResponseData = z.object({ 1731 + body: z.optional(z.never()), 1732 + path: z.optional(z.never()), 1733 + query: z.optional(z.never()) 1734 + }); 1735 + 1736 + export const zCallWithResponseResponse = zImport; 1737 + 1738 + export const zCallWithDuplicateResponsesData = z.object({ 1739 + body: z.optional(z.never()), 1740 + path: z.optional(z.never()), 1741 + query: z.optional(z.never()) 1742 + }); 1743 + 1744 + export const zCallWithDuplicateResponsesResponse = z.union([ 1745 + zModelWithBoolean.and(zModelWithInteger), 1746 + zModelWithString 1747 + ]); 1748 + 1749 + export const zCallWithResponsesData = z.object({ 1750 + body: z.optional(z.never()), 1751 + path: z.optional(z.never()), 1752 + query: z.optional(z.never()) 1753 + }); 1754 + 1755 + export const zCallWithResponsesResponse = z.union([ 1756 + z.object({ 1757 + '@namespace.string': z.optional(z.string().readonly()), 1758 + '@namespace.integer': z.optional(z.int().readonly()), 1759 + value: z.optional(z.array(zModelWithString).readonly()) 1760 + }), 1761 + zModelThatExtends, 1762 + zModelThatExtendsExtends 1763 + ]); 1764 + 1765 + export const zCollectionFormatData = z.object({ 1766 + body: z.optional(z.never()), 1767 + path: z.optional(z.never()), 1768 + query: z.object({ 1769 + parameterArrayCSV: z.union([ 1770 + z.array(z.string()), 1771 + z.null() 1772 + ]), 1773 + parameterArraySSV: z.union([ 1774 + z.array(z.string()), 1775 + z.null() 1776 + ]), 1777 + parameterArrayTSV: z.union([ 1778 + z.array(z.string()), 1779 + z.null() 1780 + ]), 1781 + parameterArrayPipes: z.union([ 1782 + z.array(z.string()), 1783 + z.null() 1784 + ]), 1785 + parameterArrayMulti: z.union([ 1786 + z.array(z.string()), 1787 + z.null() 1788 + ]) 1789 + }) 1790 + }); 1791 + 1792 + export const zTypesData = z.object({ 1793 + body: z.optional(z.never()), 1794 + path: z.optional(z.object({ 1795 + id: z.optional(z.int()) 1796 + })), 1797 + query: z.object({ 1798 + parameterNumber: z.number().default(123), 1799 + parameterString: z.union([ 1800 + z.string().default('default'), 1801 + z.null() 1802 + ]).default('default'), 1803 + parameterBoolean: z.union([ 1804 + z.boolean().default(true), 1805 + z.null() 1806 + ]).default(true), 1807 + parameterObject: z.union([ 1808 + z.object({}), 1809 + z.null() 1810 + ]).default(null), 1811 + parameterArray: z.union([ 1812 + z.array(z.string()), 1813 + z.null() 1814 + ]), 1815 + parameterDictionary: z.union([ 1816 + z.object({}), 1817 + z.null() 1818 + ]), 1819 + parameterEnum: z.union([ 1820 + z.literal('Success'), 1821 + z.literal('Warning'), 1822 + z.literal('Error'), 1823 + z.null() 1824 + ]) 1825 + }) 1826 + }); 1827 + 1828 + export const zTypesResponse = z.union([ 1829 + z.number(), 1830 + z.string(), 1831 + z.boolean(), 1832 + z.object({}) 1833 + ]); 1834 + 1835 + export const zUploadFileData = z.object({ 1836 + body: z.string(), 1837 + path: z.object({ 1838 + 'api-version': z.union([ 1839 + z.string(), 1840 + z.null() 1841 + ]) 1842 + }), 1843 + query: z.optional(z.never()) 1844 + }); 1845 + 1846 + export const zUploadFileResponse = z.boolean(); 1847 + 1848 + export const zFileResponseData = z.object({ 1849 + body: z.optional(z.never()), 1850 + path: z.object({ 1851 + id: z.string(), 1852 + 'api-version': z.string() 1853 + }), 1854 + query: z.optional(z.never()) 1855 + }); 1856 + 1857 + /** 1858 + * Success 1859 + */ 1860 + export const zFileResponseResponse = z.string(); 1861 + 1862 + export const zComplexTypesData = z.object({ 1863 + body: z.optional(z.never()), 1864 + path: z.optional(z.never()), 1865 + query: z.object({ 1866 + parameterObject: z.object({ 1867 + first: z.optional(z.object({ 1868 + second: z.optional(z.object({ 1869 + third: z.optional(z.string()) 1870 + })) 1871 + })) 1872 + }), 1873 + parameterReference: zModelWithString 1874 + }) 1875 + }); 1876 + 1877 + /** 1878 + * Successful response 1879 + */ 1880 + export const zComplexTypesResponse = z.array(zModelWithString); 1881 + 1882 + export const zMultipartResponseData = z.object({ 1883 + body: z.optional(z.never()), 1884 + path: z.optional(z.never()), 1885 + query: z.optional(z.never()) 1886 + }); 1887 + 1888 + /** 1889 + * OK 1890 + */ 1891 + export const zMultipartResponseResponse = z.object({ 1892 + file: z.optional(z.string()), 1893 + metadata: z.optional(z.object({ 1894 + foo: z.optional(z.string()), 1895 + bar: z.optional(z.string()) 1896 + })) 1897 + }); 1898 + 1899 + export const zMultipartRequestData = z.object({ 1900 + body: z.optional(z.object({ 1901 + content: z.optional(z.string()), 1902 + data: z.optional(z.union([ 1903 + zModelWithString, 1904 + z.null() 1905 + ])) 1906 + })), 1907 + path: z.optional(z.never()), 1908 + query: z.optional(z.never()) 1909 + }); 1910 + 1911 + export const zComplexParamsData = z.object({ 1912 + body: z.optional(z.object({ 1913 + key: z.union([ 1914 + z.string().max(64).regex(/^[a-zA-Z0-9_]*$/).readonly(), 1915 + z.null() 1916 + ]).readonly(), 1917 + name: z.union([ 1918 + z.string().max(255), 1919 + z.null() 1920 + ]), 1921 + enabled: z.optional(z.boolean()).default(true), 1922 + type: z.enum([ 1923 + 'Monkey', 1924 + 'Horse', 1925 + 'Bird' 1926 + ]), 1927 + listOfModels: z.optional(z.union([ 1928 + z.array(zModelWithString), 1929 + z.null() 1930 + ])), 1931 + listOfStrings: z.optional(z.union([ 1932 + z.array(z.string()), 1933 + z.null() 1934 + ])), 1935 + parameters: z.union([ 1936 + zModelWithString, 1937 + zModelWithEnum, 1938 + zModelWithArray, 1939 + zModelWithDictionary 1940 + ]), 1941 + user: z.optional(z.object({ 1942 + id: z.optional(z.int().readonly()), 1943 + name: z.optional(z.union([ 1944 + z.string().readonly(), 1945 + z.null() 1946 + ]).readonly()) 1947 + }).readonly()) 1948 + })), 1949 + path: z.object({ 1950 + id: z.int(), 1951 + 'api-version': z.string() 1952 + }), 1953 + query: z.optional(z.never()) 1954 + }); 1955 + 1956 + /** 1957 + * Success 1958 + */ 1959 + export const zComplexParamsResponse = zModelWithString; 1960 + 1961 + export const zCallWithResultFromHeaderData = z.object({ 1962 + body: z.optional(z.never()), 1963 + path: z.optional(z.never()), 1964 + query: z.optional(z.never()) 1965 + }); 1966 + 1967 + export const zTestErrorCodeData = z.object({ 1968 + body: z.optional(z.never()), 1969 + path: z.optional(z.never()), 1970 + query: z.object({ 1971 + status: z.int() 1972 + }) 1973 + }); 1974 + 1975 + export const zNonAsciiæøåÆøÅöôêÊ字符串Data = z.object({ 1976 + body: z.optional(z.never()), 1977 + path: z.optional(z.never()), 1978 + query: z.object({ 1979 + 'nonAsciiParamæøåÆØÅöôêÊ': z.int() 1980 + }) 1981 + }); 1982 + 1983 + /** 1984 + * Successful response 1985 + */ 1986 + export const zNonAsciiæøåÆøÅöôêÊ字符串Response = z.array(zNonAsciiStringæøåÆøÅöôêÊ字符串); 1987 + 1988 + export const zPutWithFormUrlEncodedData = z.object({ 1989 + body: zArrayWithStringsWritable, 1990 + path: z.optional(z.never()), 1991 + query: z.optional(z.never()) 1992 + });
+24
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/type-format-zod/zod.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { z } from 'zod/v4'; 4 + 5 + export const zFoo = z.object({ 6 + bar: z.optional(z.int()), 7 + foo: z.coerce.bigint().default(BigInt(0)), 8 + id: z.string() 9 + }); 10 + 11 + export const zBar = z.object({ 12 + foo: z.int() 13 + }); 14 + 15 + export const zPostFooData = z.object({ 16 + body: z.optional(z.never()), 17 + path: z.optional(z.never()), 18 + query: z.optional(z.never()) 19 + }); 20 + 21 + /** 22 + * OK 23 + */ 24 + export const zPostFooResponse = zFoo;
+78
packages/openapi-ts-tests/zod/v3/test/3.0.x.test.ts
··· 1 + import fs from 'node:fs'; 2 + import path from 'node:path'; 3 + 4 + import { createClient } from '@hey-api/openapi-ts'; 5 + import { describe, expect, it } from 'vitest'; 6 + 7 + import { getFilePaths } from '../../../utils'; 8 + import { 9 + createZodConfig, 10 + getSnapshotsPath, 11 + getTempSnapshotsPath, 12 + zodVersions, 13 + } from './utils'; 14 + 15 + const version = '3.0.x'; 16 + 17 + for (const zodVersion of zodVersions) { 18 + const outputDir = path.join( 19 + getTempSnapshotsPath(), 20 + version, 21 + zodVersion.folder, 22 + ); 23 + const snapshotsDir = path.join( 24 + getSnapshotsPath(), 25 + version, 26 + zodVersion.folder, 27 + ); 28 + 29 + describe(`OpenAPI ${version}`, () => { 30 + const createConfig = createZodConfig({ 31 + openApiVersion: version, 32 + outputDir, 33 + zodVersion, 34 + }); 35 + 36 + const scenarios = [ 37 + { 38 + config: createConfig({ 39 + input: 'array-items-one-of-length-1.yaml', 40 + output: 'array-items-one-of-length-1', 41 + }), 42 + description: 43 + 'generates correct array when items are oneOf array with single item', 44 + }, 45 + { 46 + config: createConfig({ 47 + input: 'enum-null.json', 48 + output: 'enum-null', 49 + }), 50 + description: 'handles null enums', 51 + }, 52 + { 53 + config: createConfig({ 54 + input: 'validators.json', 55 + output: 'validators', 56 + }), 57 + description: 'generates validator schemas', 58 + }, 59 + ]; 60 + 61 + it.each(scenarios)('$description', async ({ config }) => { 62 + await createClient(config); 63 + 64 + const outputPath = 65 + typeof config.output === 'string' ? config.output : config.output.path; 66 + const filePaths = getFilePaths(outputPath); 67 + 68 + await Promise.all( 69 + filePaths.map(async (filePath) => { 70 + const fileContent = fs.readFileSync(filePath, 'utf-8'); 71 + await expect(fileContent).toMatchFileSnapshot( 72 + path.join(snapshotsDir, filePath.slice(outputDir.length + 1)), 73 + ); 74 + }), 75 + ); 76 + }); 77 + }); 78 + }
+20 -65
packages/openapi-ts-tests/zod/v3/test/3.1.x.test.ts
··· 1 1 import fs from 'node:fs'; 2 2 import path from 'node:path'; 3 - import { fileURLToPath } from 'node:url'; 4 3 5 - import { createClient, type UserConfig } from '@hey-api/openapi-ts'; 4 + import { createClient } from '@hey-api/openapi-ts'; 6 5 import { describe, expect, it } from 'vitest'; 7 6 8 - import { getFilePaths, getSpecsPath } from '../../../utils'; 9 - 10 - const __filename = fileURLToPath(import.meta.url); 11 - const __dirname = path.dirname(__filename); 7 + import { getFilePaths } from '../../../utils'; 8 + import { 9 + createZodConfig, 10 + getSnapshotsPath, 11 + getTempSnapshotsPath, 12 + zodVersions, 13 + } from './utils'; 12 14 13 15 const version = '3.1.x'; 14 16 15 - const zodVersions = [ 16 - { 17 - compatibilityVersion: 3, 18 - folder: 'v3', 19 - }, 20 - { 21 - compatibilityVersion: 4, 22 - folder: 'v4', 23 - }, 24 - { 25 - compatibilityVersion: 'mini', 26 - folder: 'mini', 27 - }, 28 - ] as const; 29 - 30 17 for (const zodVersion of zodVersions) { 31 18 const outputDir = path.join( 32 - __dirname, 33 - '..', 34 - '.gen', 35 - 'snapshots', 19 + getTempSnapshotsPath(), 20 + version, 21 + zodVersion.folder, 22 + ); 23 + const snapshotsDir = path.join( 24 + getSnapshotsPath(), 36 25 version, 37 26 zodVersion.folder, 38 27 ); 39 28 40 29 describe(`OpenAPI ${version}`, () => { 41 - const createConfig = (userConfig: UserConfig): UserConfig => { 42 - const inputPath = path.join( 43 - getSpecsPath(), 44 - version, 45 - typeof userConfig.input === 'string' 46 - ? userConfig.input 47 - : (userConfig.input.path as string), 48 - ); 49 - return { 50 - plugins: [ 51 - { 52 - compatibilityVersion: zodVersion.compatibilityVersion, 53 - name: 'zod', 54 - }, 55 - ], 56 - ...userConfig, 57 - input: 58 - typeof userConfig.input === 'string' 59 - ? inputPath 60 - : { 61 - ...userConfig.input, 62 - path: inputPath, 63 - }, 64 - logs: { 65 - level: 'silent', 66 - }, 67 - output: path.join( 68 - outputDir, 69 - typeof userConfig.output === 'string' ? userConfig.output : '', 70 - ), 71 - }; 72 - }; 30 + const createConfig = createZodConfig({ 31 + openApiVersion: version, 32 + outputDir, 33 + zodVersion, 34 + }); 73 35 74 36 const scenarios = [ 75 37 { ··· 189 151 filePaths.map(async (filePath) => { 190 152 const fileContent = fs.readFileSync(filePath, 'utf-8'); 191 153 await expect(fileContent).toMatchFileSnapshot( 192 - path.join( 193 - __dirname, 194 - '..', 195 - '__snapshots__', 196 - version, 197 - zodVersion.folder, 198 - filePath.slice(outputDir.length + 1), 199 - ), 154 + path.join(snapshotsDir, filePath.slice(outputDir.length + 1)), 200 155 ); 201 156 }), 202 157 );
+74
packages/openapi-ts-tests/zod/v3/test/openapi.test.ts
··· 1 + import fs from 'node:fs'; 2 + import path from 'node:path'; 3 + 4 + import { createClient } from '@hey-api/openapi-ts'; 5 + import { describe, expect, it } from 'vitest'; 6 + 7 + import { getFilePaths } from '../../../utils'; 8 + import { 9 + createZodConfig, 10 + getSnapshotsPath, 11 + getTempSnapshotsPath, 12 + zodVersions, 13 + } from './utils'; 14 + 15 + const versions = ['2.0.x', '3.0.x', '3.1.x']; 16 + 17 + for (const version of versions) { 18 + for (const zodVersion of zodVersions) { 19 + const outputDir = path.join( 20 + getTempSnapshotsPath(), 21 + version, 22 + zodVersion.folder, 23 + ); 24 + const snapshotsDir = path.join( 25 + getSnapshotsPath(), 26 + version, 27 + zodVersion.folder, 28 + ); 29 + 30 + describe(`OpenAPI ${version}`, () => { 31 + const createConfig = createZodConfig({ 32 + openApiVersion: version, 33 + outputDir, 34 + zodVersion, 35 + }); 36 + 37 + const scenarios = [ 38 + { 39 + config: createConfig({ 40 + input: 'full.yaml', 41 + output: 'default', 42 + }), 43 + description: 'generate Zod schemas with Zod plugin', 44 + }, 45 + { 46 + config: createConfig({ 47 + input: 'type-format.yaml', 48 + output: 'type-format-zod', 49 + }), 50 + description: 'handles various schema types and formats', 51 + }, 52 + ]; 53 + 54 + it.each(scenarios)('$description', async ({ config }) => { 55 + await createClient(config); 56 + 57 + const outputPath = 58 + typeof config.output === 'string' 59 + ? config.output 60 + : config.output.path; 61 + const filePaths = getFilePaths(outputPath); 62 + 63 + await Promise.all( 64 + filePaths.map(async (filePath) => { 65 + const fileContent = fs.readFileSync(filePath, 'utf-8'); 66 + await expect(fileContent).toMatchFileSnapshot( 67 + path.join(snapshotsDir, filePath.slice(outputDir.length + 1)), 68 + ); 69 + }), 70 + ); 71 + }); 72 + }); 73 + } 74 + }
+73
packages/openapi-ts-tests/zod/v3/test/utils.ts
··· 1 + import path from 'node:path'; 2 + import { fileURLToPath } from 'node:url'; 3 + 4 + import { type UserConfig } from '@hey-api/openapi-ts'; 5 + 6 + import { getSpecsPath } from '../../../utils'; 7 + 8 + const __filename = fileURLToPath(import.meta.url); 9 + const __dirname = path.dirname(__filename); 10 + 11 + export const createZodConfig = 12 + ({ 13 + openApiVersion, 14 + outputDir, 15 + zodVersion, 16 + }: { 17 + openApiVersion: string; 18 + outputDir: string; 19 + zodVersion: (typeof zodVersions)[number]; 20 + }) => 21 + (userConfig: UserConfig): UserConfig => { 22 + const inputPath = path.join( 23 + getSpecsPath(), 24 + openApiVersion, 25 + typeof userConfig.input === 'string' 26 + ? userConfig.input 27 + : (userConfig.input.path as string), 28 + ); 29 + return { 30 + plugins: [ 31 + { 32 + compatibilityVersion: zodVersion.compatibilityVersion, 33 + name: 'zod', 34 + }, 35 + ], 36 + ...userConfig, 37 + input: 38 + typeof userConfig.input === 'string' 39 + ? inputPath 40 + : { 41 + ...userConfig.input, 42 + path: inputPath, 43 + }, 44 + logs: { 45 + level: 'silent', 46 + }, 47 + output: path.join( 48 + outputDir, 49 + typeof userConfig.output === 'string' ? userConfig.output : '', 50 + ), 51 + }; 52 + }; 53 + 54 + export const getSnapshotsPath = (): string => 55 + path.join(__dirname, '..', '__snapshots__'); 56 + 57 + export const getTempSnapshotsPath = (): string => 58 + path.join(__dirname, '..', '.gen', 'snapshots'); 59 + 60 + export const zodVersions = [ 61 + { 62 + compatibilityVersion: 3, 63 + folder: 'v3', 64 + }, 65 + { 66 + compatibilityVersion: 4, 67 + folder: 'v4', 68 + }, 69 + { 70 + compatibilityVersion: 'mini', 71 + folder: 'mini', 72 + }, 73 + ] as const;