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

Configure Feed

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

Merge pull request #2100 from hey-api/feat/validators-parameters

feat(validators): generate schemas for request parameters

authored by

Lubos and committed by
GitHub
0f4c2301 4de9fc93

+2515 -131
+5
.changeset/pretty-sloths-yawn.md
··· 1 + --- 2 + '@hey-api/openapi-ts': patch 3 + --- 4 + 5 + feat(validators): generate schemas for request parameters
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
-6
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/fastify/default/types.gen.ts
··· 968 968 */ 969 969 parameterBoolean: boolean; 970 970 /** 971 - * This is an object parameter 972 - */ 973 - parameterObject: { 974 - [key: string]: unknown; 975 - }; 976 - /** 977 971 * This is an array parameter 978 972 */ 979 973 parameterArray: Array<string>;
+283
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/valibot/default/valibot.gen.ts
··· 395 395 reference_code: v.optional(v.string()) 396 396 }); 397 397 398 + /** 399 + * Testing multiline comments in string: First line 400 + * Second line 401 + * 402 + * Fourth line 403 + */ 404 + export const vCallWithDescriptionsParameterParameterWithBreaks = v.string(); 405 + 406 + /** 407 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 408 + */ 409 + export const vCallWithDescriptionsParameterParameterWithBackticks = v.string(); 410 + 411 + /** 412 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 413 + */ 414 + export const vCallWithDescriptionsParameterParameterWithSlashes = v.string(); 415 + 416 + /** 417 + * Testing expression placeholders in string: ${expression} should work 418 + */ 419 + export const vCallWithDescriptionsParameterParameterWithExpressionPlaceholders = v.string(); 420 + 421 + /** 422 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 423 + */ 424 + export const vCallWithDescriptionsParameterParameterWithQuotes = v.string(); 425 + 426 + /** 427 + * Testing reserved characters in string: * inline * and ** inline ** should work 428 + */ 429 + export const vCallWithDescriptionsParameterParameterWithReservedCharacters = v.string(); 430 + 431 + /** 432 + * This is the parameter that goes into the header 433 + */ 434 + export const vCallWithParametersParameterParameterHeader = v.string(); 435 + 436 + /** 437 + * This is the parameter that goes into the path 438 + */ 439 + export const vCallWithParametersParameterParameterPath = v.string(); 440 + 441 + /** 442 + * api-version should be required in standalone clients 443 + */ 444 + export const vCallWithParametersParameterApiVersion = v.string(); 445 + 446 + /** 447 + * This is the parameter that goes into the query params 448 + */ 449 + export const vCallWithParametersParameterParameterQuery = v.string(); 450 + 451 + /** 452 + * This is the parameter that goes into the request header 453 + */ 454 + export const vCallWithWeirdParameterNamesParameterParameterHeader = v.string(); 455 + 456 + /** 457 + * This is the parameter that goes into the path 458 + */ 459 + export const vCallWithWeirdParameterNamesParameterParameterPath1 = v.string(); 460 + 461 + /** 462 + * This is the parameter that goes into the path 463 + */ 464 + export const vCallWithWeirdParameterNamesParameterParameterPath2 = v.string(); 465 + 466 + /** 467 + * This is the parameter that goes into the path 468 + */ 469 + export const vCallWithWeirdParameterNamesParameterParameterPath3 = v.string(); 470 + 471 + /** 472 + * api-version should be required in standalone clients 473 + */ 474 + export const vCallWithWeirdParameterNamesParameterApiVersion = v.string(); 475 + 476 + /** 477 + * This is the parameter with a reserved keyword 478 + */ 479 + export const vCallWithWeirdParameterNamesParameterDefault = v.string(); 480 + 481 + /** 482 + * This is the parameter that goes into the request query params 483 + */ 484 + export const vCallWithWeirdParameterNamesParameterParameterQuery = v.string(); 485 + 486 + /** 487 + * This is a simple string with default value 488 + */ 489 + export const vCallWithDefaultParametersParameterParameterString = v.optional(v.string(), 'Hello World!'); 490 + 491 + /** 492 + * This is a simple number with default value 493 + */ 494 + export const vCallWithDefaultParametersParameterParameterNumber = v.optional(v.number(), 123); 495 + 496 + /** 497 + * This is a simple boolean with default value 498 + */ 499 + export const vCallWithDefaultParametersParameterParameterBoolean = v.optional(v.boolean(), true); 500 + 501 + /** 502 + * This is a simple enum with default value 503 + */ 504 + export const vCallWithDefaultParametersParameterParameterEnum = v.picklist([ 505 + 'Success', 506 + 'Warning', 507 + 'Error' 508 + ]); 509 + 510 + /** 511 + * This is a model with one string property 512 + */ 513 + export const vCallWithDefaultParametersParameterParameterModel = v.optional(v.object({ 514 + prop: v.optional(v.string()) 515 + }), { 516 + prop: 'Hello World!' 517 + }); 518 + 519 + /** 520 + * This is a simple string that is optional with default value 521 + */ 522 + export const vCallWithDefaultOptionalParametersParameterParameterString = v.optional(v.string(), 'Hello World!'); 523 + 524 + /** 525 + * This is a simple number that is optional with default value 526 + */ 527 + export const vCallWithDefaultOptionalParametersParameterParameterNumber = v.optional(v.number(), 123); 528 + 529 + /** 530 + * This is a simple boolean that is optional with default value 531 + */ 532 + export const vCallWithDefaultOptionalParametersParameterParameterBoolean = v.optional(v.boolean(), true); 533 + 534 + /** 535 + * This is a simple enum that is optional with default value 536 + */ 537 + export const vCallWithDefaultOptionalParametersParameterParameterEnum = v.picklist([ 538 + 'Success', 539 + 'Warning', 540 + 'Error' 541 + ]); 542 + 543 + /** 544 + * This is a optional string with default 545 + */ 546 + export const vCallToTestOrderOfParamsParameterParameterOptionalStringWithDefault = v.optional(v.string(), 'Hello World!'); 547 + 548 + /** 549 + * This is a optional string with empty default 550 + */ 551 + export const vCallToTestOrderOfParamsParameterParameterOptionalStringWithEmptyDefault = v.optional(v.string(), ''); 552 + 553 + /** 554 + * This is a optional string with no default 555 + */ 556 + export const vCallToTestOrderOfParamsParameterParameterOptionalStringWithNoDefault = v.string(); 557 + 558 + /** 559 + * This is a string with default 560 + */ 561 + export const vCallToTestOrderOfParamsParameterParameterStringWithDefault = v.optional(v.string(), 'Hello World!'); 562 + 563 + /** 564 + * This is a string with empty default 565 + */ 566 + export const vCallToTestOrderOfParamsParameterParameterStringWithEmptyDefault = v.optional(v.string(), ''); 567 + 568 + /** 569 + * This is a string with no default 570 + */ 571 + export const vCallToTestOrderOfParamsParameterParameterStringWithNoDefault = v.string(); 572 + 573 + /** 574 + * This is a string that can be null with no default 575 + */ 576 + export const vCallToTestOrderOfParamsParameterParameterStringNullableWithNoDefault = v.union([ 577 + v.string(), 578 + v.null() 579 + ]); 580 + 581 + /** 582 + * This is a string that can be null with default 583 + */ 584 + export const vCallToTestOrderOfParamsParameterParameterStringNullableWithDefault = v.optional(v.union([ 585 + v.string(), 586 + v.null() 587 + ]), null); 588 + 398 589 export const vCallWithResponseAndNoContentResponseResponse = v.union([ 399 590 v.number(), 400 591 v.unknown() ··· 420 611 vModelThatExtendsExtends 421 612 ]); 422 613 614 + /** 615 + * This is an array parameter that is sent as csv format (comma-separated values) 616 + */ 617 + export const vCollectionFormatParameterParameterArrayCsv = v.array(v.string()); 618 + 619 + /** 620 + * This is an array parameter that is sent as ssv format (space-separated values) 621 + */ 622 + export const vCollectionFormatParameterParameterArraySsv = v.array(v.string()); 623 + 624 + /** 625 + * This is an array parameter that is sent as tsv format (tab-separated values) 626 + */ 627 + export const vCollectionFormatParameterParameterArrayTsv = v.array(v.string()); 628 + 629 + /** 630 + * This is an array parameter that is sent as pipes format (pipe-separated values) 631 + */ 632 + export const vCollectionFormatParameterParameterArrayPipes = v.array(v.string()); 633 + 634 + /** 635 + * This is an array parameter that is sent as multi format (multiple parameter instances) 636 + */ 637 + export const vCollectionFormatParameterParameterArrayMulti = v.array(v.string()); 638 + 639 + /** 640 + * This is a number parameter 641 + */ 642 + export const vTypesParameterId = v.pipe(v.number(), v.integer()); 643 + 644 + /** 645 + * This is a number parameter 646 + */ 647 + export const vTypesParameterParameterNumber = v.optional(v.number(), 123); 648 + 649 + /** 650 + * This is a string parameter 651 + */ 652 + export const vTypesParameterParameterString = v.optional(v.string(), 'default'); 653 + 654 + /** 655 + * This is a boolean parameter 656 + */ 657 + export const vTypesParameterParameterBoolean = v.optional(v.boolean(), true); 658 + 659 + /** 660 + * This is an array parameter 661 + */ 662 + export const vTypesParameterParameterArray = v.array(v.string()); 663 + 664 + /** 665 + * This is a dictionary parameter 666 + */ 667 + export const vTypesParameterParameterDictionary = v.object({}); 668 + 669 + /** 670 + * This is an enum parameter 671 + */ 672 + export const vTypesParameterParameterEnum = v.picklist([ 673 + 'Success', 674 + 'Warning', 675 + 'Error' 676 + ]); 677 + 423 678 export const vTypesResponse = v.union([ 424 679 v.number(), 425 680 v.string(), ··· 428 683 ]); 429 684 430 685 /** 686 + * Parameter containing object 687 + */ 688 + export const vComplexTypesParameterParameterObject = v.object({ 689 + first: v.optional(v.object({ 690 + second: v.optional(v.object({ 691 + third: v.optional(v.string()) 692 + })) 693 + })) 694 + }); 695 + 696 + /** 697 + * This is a model with one string property 698 + */ 699 + export const vComplexTypesParameterParameterReference = v.object({ 700 + prop: v.optional(v.string()) 701 + }); 702 + 703 + /** 431 704 * Successful response 432 705 */ 433 706 export const vComplexTypesResponse = v.array(vModelWithString); 707 + 708 + /** 709 + * Status code to return 710 + */ 711 + export const vTestErrorCodeParameterStatus = v.string(); 712 + 713 + /** 714 + * Dummy input param 715 + */ 716 + export const vNonAsciiæøåÆøÅöôêÊ字符串ParameterNonAsciiParamæøåÆøÅöôêÊ = v.pipe(v.number(), v.integer()); 434 717 435 718 /** 436 719 * Successful response
+283
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/zod/default/zod.gen.ts
··· 388 388 reference_code: z.string().optional() 389 389 }); 390 390 391 + /** 392 + * Testing multiline comments in string: First line 393 + * Second line 394 + * 395 + * Fourth line 396 + */ 397 + export const zCallWithDescriptionsParameterParameterWithBreaks = z.string(); 398 + 399 + /** 400 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 401 + */ 402 + export const zCallWithDescriptionsParameterParameterWithBackticks = z.string(); 403 + 404 + /** 405 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 406 + */ 407 + export const zCallWithDescriptionsParameterParameterWithSlashes = z.string(); 408 + 409 + /** 410 + * Testing expression placeholders in string: ${expression} should work 411 + */ 412 + export const zCallWithDescriptionsParameterParameterWithExpressionPlaceholders = z.string(); 413 + 414 + /** 415 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 416 + */ 417 + export const zCallWithDescriptionsParameterParameterWithQuotes = z.string(); 418 + 419 + /** 420 + * Testing reserved characters in string: * inline * and ** inline ** should work 421 + */ 422 + export const zCallWithDescriptionsParameterParameterWithReservedCharacters = z.string(); 423 + 424 + /** 425 + * This is the parameter that goes into the header 426 + */ 427 + export const zCallWithParametersParameterParameterHeader = z.string(); 428 + 429 + /** 430 + * This is the parameter that goes into the path 431 + */ 432 + export const zCallWithParametersParameterParameterPath = z.string(); 433 + 434 + /** 435 + * api-version should be required in standalone clients 436 + */ 437 + export const zCallWithParametersParameterApiVersion = z.string(); 438 + 439 + /** 440 + * This is the parameter that goes into the query params 441 + */ 442 + export const zCallWithParametersParameterParameterQuery = z.string(); 443 + 444 + /** 445 + * This is the parameter that goes into the request header 446 + */ 447 + export const zCallWithWeirdParameterNamesParameterParameterHeader = z.string(); 448 + 449 + /** 450 + * This is the parameter that goes into the path 451 + */ 452 + export const zCallWithWeirdParameterNamesParameterParameterPath1 = z.string(); 453 + 454 + /** 455 + * This is the parameter that goes into the path 456 + */ 457 + export const zCallWithWeirdParameterNamesParameterParameterPath2 = z.string(); 458 + 459 + /** 460 + * This is the parameter that goes into the path 461 + */ 462 + export const zCallWithWeirdParameterNamesParameterParameterPath3 = z.string(); 463 + 464 + /** 465 + * api-version should be required in standalone clients 466 + */ 467 + export const zCallWithWeirdParameterNamesParameterApiVersion = z.string(); 468 + 469 + /** 470 + * This is the parameter with a reserved keyword 471 + */ 472 + export const zCallWithWeirdParameterNamesParameterDefault = z.string(); 473 + 474 + /** 475 + * This is the parameter that goes into the request query params 476 + */ 477 + export const zCallWithWeirdParameterNamesParameterParameterQuery = z.string(); 478 + 479 + /** 480 + * This is a simple string with default value 481 + */ 482 + export const zCallWithDefaultParametersParameterParameterString = z.string().default('Hello World!'); 483 + 484 + /** 485 + * This is a simple number with default value 486 + */ 487 + export const zCallWithDefaultParametersParameterParameterNumber = z.number().default(123); 488 + 489 + /** 490 + * This is a simple boolean with default value 491 + */ 492 + export const zCallWithDefaultParametersParameterParameterBoolean = z.boolean().default(true); 493 + 494 + /** 495 + * This is a simple enum with default value 496 + */ 497 + export const zCallWithDefaultParametersParameterParameterEnum = z.enum([ 498 + 'Success', 499 + 'Warning', 500 + 'Error' 501 + ]); 502 + 503 + /** 504 + * This is a model with one string property 505 + */ 506 + export const zCallWithDefaultParametersParameterParameterModel = z.object({ 507 + prop: z.string().optional() 508 + }).default({ 509 + prop: 'Hello World!' 510 + }); 511 + 512 + /** 513 + * This is a simple string that is optional with default value 514 + */ 515 + export const zCallWithDefaultOptionalParametersParameterParameterString = z.string().default('Hello World!'); 516 + 517 + /** 518 + * This is a simple number that is optional with default value 519 + */ 520 + export const zCallWithDefaultOptionalParametersParameterParameterNumber = z.number().default(123); 521 + 522 + /** 523 + * This is a simple boolean that is optional with default value 524 + */ 525 + export const zCallWithDefaultOptionalParametersParameterParameterBoolean = z.boolean().default(true); 526 + 527 + /** 528 + * This is a simple enum that is optional with default value 529 + */ 530 + export const zCallWithDefaultOptionalParametersParameterParameterEnum = z.enum([ 531 + 'Success', 532 + 'Warning', 533 + 'Error' 534 + ]); 535 + 536 + /** 537 + * This is a optional string with default 538 + */ 539 + export const zCallToTestOrderOfParamsParameterParameterOptionalStringWithDefault = z.string().default('Hello World!'); 540 + 541 + /** 542 + * This is a optional string with empty default 543 + */ 544 + export const zCallToTestOrderOfParamsParameterParameterOptionalStringWithEmptyDefault = z.string().default(''); 545 + 546 + /** 547 + * This is a optional string with no default 548 + */ 549 + export const zCallToTestOrderOfParamsParameterParameterOptionalStringWithNoDefault = z.string(); 550 + 551 + /** 552 + * This is a string with default 553 + */ 554 + export const zCallToTestOrderOfParamsParameterParameterStringWithDefault = z.string().default('Hello World!'); 555 + 556 + /** 557 + * This is a string with empty default 558 + */ 559 + export const zCallToTestOrderOfParamsParameterParameterStringWithEmptyDefault = z.string().default(''); 560 + 561 + /** 562 + * This is a string with no default 563 + */ 564 + export const zCallToTestOrderOfParamsParameterParameterStringWithNoDefault = z.string(); 565 + 566 + /** 567 + * This is a string that can be null with no default 568 + */ 569 + export const zCallToTestOrderOfParamsParameterParameterStringNullableWithNoDefault = z.union([ 570 + z.string(), 571 + z.null() 572 + ]); 573 + 574 + /** 575 + * This is a string that can be null with default 576 + */ 577 + export const zCallToTestOrderOfParamsParameterParameterStringNullableWithDefault = z.union([ 578 + z.string(), 579 + z.null() 580 + ]).default(null); 581 + 391 582 export const zCallWithResponseAndNoContentResponseResponse = z.union([ 392 583 z.number(), 393 584 z.unknown() ··· 413 604 zModelThatExtendsExtends 414 605 ]); 415 606 607 + /** 608 + * This is an array parameter that is sent as csv format (comma-separated values) 609 + */ 610 + export const zCollectionFormatParameterParameterArrayCsv = z.array(z.string()); 611 + 612 + /** 613 + * This is an array parameter that is sent as ssv format (space-separated values) 614 + */ 615 + export const zCollectionFormatParameterParameterArraySsv = z.array(z.string()); 616 + 617 + /** 618 + * This is an array parameter that is sent as tsv format (tab-separated values) 619 + */ 620 + export const zCollectionFormatParameterParameterArrayTsv = z.array(z.string()); 621 + 622 + /** 623 + * This is an array parameter that is sent as pipes format (pipe-separated values) 624 + */ 625 + export const zCollectionFormatParameterParameterArrayPipes = z.array(z.string()); 626 + 627 + /** 628 + * This is an array parameter that is sent as multi format (multiple parameter instances) 629 + */ 630 + export const zCollectionFormatParameterParameterArrayMulti = z.array(z.string()); 631 + 632 + /** 633 + * This is a number parameter 634 + */ 635 + export const zTypesParameterId = z.number().int(); 636 + 637 + /** 638 + * This is a number parameter 639 + */ 640 + export const zTypesParameterParameterNumber = z.number().default(123); 641 + 642 + /** 643 + * This is a string parameter 644 + */ 645 + export const zTypesParameterParameterString = z.string().default('default'); 646 + 647 + /** 648 + * This is a boolean parameter 649 + */ 650 + export const zTypesParameterParameterBoolean = z.boolean().default(true); 651 + 652 + /** 653 + * This is an array parameter 654 + */ 655 + export const zTypesParameterParameterArray = z.array(z.string()); 656 + 657 + /** 658 + * This is a dictionary parameter 659 + */ 660 + export const zTypesParameterParameterDictionary = z.object({}); 661 + 662 + /** 663 + * This is an enum parameter 664 + */ 665 + export const zTypesParameterParameterEnum = z.enum([ 666 + 'Success', 667 + 'Warning', 668 + 'Error' 669 + ]); 670 + 416 671 export const zTypesResponse = z.union([ 417 672 z.number(), 418 673 z.string(), ··· 421 676 ]); 422 677 423 678 /** 679 + * Parameter containing object 680 + */ 681 + export const zComplexTypesParameterParameterObject = z.object({ 682 + first: z.object({ 683 + second: z.object({ 684 + third: z.string().optional() 685 + }).optional() 686 + }).optional() 687 + }); 688 + 689 + /** 690 + * This is a model with one string property 691 + */ 692 + export const zComplexTypesParameterParameterReference = z.object({ 693 + prop: z.string().optional() 694 + }); 695 + 696 + /** 424 697 * Successful response 425 698 */ 426 699 export const zComplexTypesResponse = z.array(zModelWithString); 700 + 701 + /** 702 + * Status code to return 703 + */ 704 + export const zTestErrorCodeParameterStatus = z.string(); 705 + 706 + /** 707 + * Dummy input param 708 + */ 709 + export const zNonAsciiæøåÆøÅöôêÊ字符串ParameterNonAsciiParamæøåÆøÅöôêÊ = z.number().int(); 427 710 428 711 /** 429 712 * Successful response
+446
packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/valibot/default/valibot.gen.ts
··· 1058 1058 vGenericSchemaDuplicateIssue1SystemString 1059 1059 ]); 1060 1060 1061 + /** 1062 + * Parameter with illegal characters 1063 + */ 1064 + export const vXFooBar = vModelWithString; 1065 + 1061 1066 export const vSimpleRequestBody = vModelWithString; 1062 1067 1063 1068 export const vSimpleFormData = vModelWithString; ··· 1078 1083 export const vApiVVersionODataControllerCountResponse = vModelFromZendesk; 1079 1084 1080 1085 /** 1086 + * foo in method 1087 + */ 1088 + export const vGetApiVbyApiVersionSimpleOperationParameterFooParam = v.string(); 1089 + 1090 + /** 1081 1091 * Response is a simple number 1082 1092 */ 1083 1093 export const vGetApiVbyApiVersionSimpleOperationResponse = v.number(); 1084 1094 1085 1095 /** 1096 + * foo in method 1097 + */ 1098 + export const vDeleteFooParameterFooParam = v.string(); 1099 + 1100 + /** 1101 + * bar in method 1102 + */ 1103 + export const vDeleteFooParameterBarParam = v.string(); 1104 + 1105 + /** 1106 + * Parameter with illegal characters 1107 + */ 1108 + export const vDeleteFooParameterXFooBar = vModelWithString; 1109 + 1110 + /** 1111 + * Testing multiline comments in string: First line 1112 + * Second line 1113 + * 1114 + * Fourth line 1115 + */ 1116 + export const vCallWithDescriptionsParameterParameterWithBreaks = v.string(); 1117 + 1118 + /** 1119 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1120 + */ 1121 + export const vCallWithDescriptionsParameterParameterWithBackticks = v.string(); 1122 + 1123 + /** 1124 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1125 + */ 1126 + export const vCallWithDescriptionsParameterParameterWithSlashes = v.string(); 1127 + 1128 + /** 1129 + * Testing expression placeholders in string: ${expression} should work 1130 + */ 1131 + export const vCallWithDescriptionsParameterParameterWithExpressionPlaceholders = v.string(); 1132 + 1133 + /** 1134 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1135 + */ 1136 + export const vCallWithDescriptionsParameterParameterWithQuotes = v.string(); 1137 + 1138 + /** 1139 + * Testing reserved characters in string: * inline * and ** inline ** should work 1140 + */ 1141 + export const vCallWithDescriptionsParameterParameterWithReservedCharacters = v.string(); 1142 + 1143 + /** 1144 + * This parameter is deprecated 1145 + * @deprecated 1146 + */ 1147 + export const vDeprecatedCallParameterParameter = v.union([ 1148 + vDeprecatedModel, 1149 + v.null() 1150 + ]); 1151 + 1152 + /** 1086 1153 * This is the parameter that goes into the body 1087 1154 */ 1088 1155 export const vCallWithParametersData = v.union([ ··· 1091 1158 ]); 1092 1159 1093 1160 /** 1161 + * This is the parameter that goes into the cookie 1162 + */ 1163 + export const vCallWithParametersParameterParameterCookie = v.union([ 1164 + v.string(), 1165 + v.null() 1166 + ]); 1167 + 1168 + /** 1169 + * This is the parameter that goes into the header 1170 + */ 1171 + export const vCallWithParametersParameterParameterHeader = v.union([ 1172 + v.string(), 1173 + v.null() 1174 + ]); 1175 + 1176 + /** 1177 + * This is the parameter that goes into the path 1178 + */ 1179 + export const vCallWithParametersParameterParameterPath = v.union([ 1180 + v.string(), 1181 + v.null() 1182 + ]); 1183 + 1184 + /** 1185 + * api-version should be required in standalone clients 1186 + */ 1187 + export const vCallWithParametersParameterApiVersion = v.union([ 1188 + v.string(), 1189 + v.null() 1190 + ]); 1191 + 1192 + export const vCallWithParametersParameterFooRefEnum = vModelWithNestedArrayEnumsDataFoo; 1193 + 1194 + export const vCallWithParametersParameterFooAllOfEnum = vModelWithNestedArrayEnumsDataFoo; 1195 + 1196 + /** 1197 + * This is the parameter that goes into the query params 1198 + */ 1199 + export const vCallWithParametersParameterCursor = v.union([ 1200 + v.string(), 1201 + v.null() 1202 + ]); 1203 + 1204 + /** 1094 1205 * This is the parameter that goes into the body 1095 1206 */ 1096 1207 export const vCallWithWeirdParameterNamesData = v.union([ ··· 1099 1210 ]); 1100 1211 1101 1212 /** 1213 + * This is the parameter that goes into the cookie 1214 + */ 1215 + export const vCallWithWeirdParameterNamesParameterParameterCookie = v.union([ 1216 + v.string(), 1217 + v.null() 1218 + ]); 1219 + 1220 + /** 1221 + * This is the parameter that goes into the request header 1222 + */ 1223 + export const vCallWithWeirdParameterNamesParameterParameterHeader = v.union([ 1224 + v.string(), 1225 + v.null() 1226 + ]); 1227 + 1228 + /** 1229 + * This is the parameter that goes into the path 1230 + */ 1231 + export const vCallWithWeirdParameterNamesParameterParameterPath1 = v.string(); 1232 + 1233 + /** 1234 + * This is the parameter that goes into the path 1235 + */ 1236 + export const vCallWithWeirdParameterNamesParameterParameterPath2 = v.string(); 1237 + 1238 + /** 1239 + * This is the parameter that goes into the path 1240 + */ 1241 + export const vCallWithWeirdParameterNamesParameterParameterPath3 = v.string(); 1242 + 1243 + /** 1244 + * api-version should be required in standalone clients 1245 + */ 1246 + export const vCallWithWeirdParameterNamesParameterApiVersion = v.union([ 1247 + v.string(), 1248 + v.null() 1249 + ]); 1250 + 1251 + /** 1252 + * This is the parameter with a reserved keyword 1253 + */ 1254 + export const vCallWithWeirdParameterNamesParameterDefault = v.string(); 1255 + 1256 + /** 1257 + * This is the parameter that goes into the request query params 1258 + */ 1259 + export const vCallWithWeirdParameterNamesParameterParameterQuery = v.union([ 1260 + v.string(), 1261 + v.null() 1262 + ]); 1263 + 1264 + /** 1102 1265 * This is a required parameter 1103 1266 */ 1104 1267 export const vGetCallWithOptionalParamData = vModelWithOneOfEnum; 1268 + 1269 + /** 1270 + * This is an optional parameter 1271 + */ 1272 + export const vGetCallWithOptionalParamParameterPage = v.number(); 1105 1273 1106 1274 /** 1107 1275 * This is an optional parameter ··· 1113 1281 ])) 1114 1282 }); 1115 1283 1284 + /** 1285 + * This is a required parameter 1286 + */ 1287 + export const vPostCallWithOptionalParamParameterParameter = vPageable; 1288 + 1116 1289 export const vPostCallWithOptionalParamResponse = v.union([ 1117 1290 v.number(), 1118 1291 v.void() ··· 1124 1297 export const vPostApiVbyApiVersionRequestBodyData = vSimpleRequestBody; 1125 1298 1126 1299 /** 1300 + * This is a reusable parameter 1301 + */ 1302 + export const vPostApiVbyApiVersionRequestBodyParameterParameter = v.string(); 1303 + 1304 + /** 1127 1305 * A reusable request body 1128 1306 */ 1129 1307 export const vPostApiVbyApiVersionFormDataData = vSimpleFormData; 1130 1308 1131 1309 /** 1310 + * This is a reusable parameter 1311 + */ 1312 + export const vPostApiVbyApiVersionFormDataParameterParameter = v.string(); 1313 + 1314 + /** 1315 + * This is a simple string with default value 1316 + */ 1317 + export const vCallWithDefaultParametersParameterParameterString = v.optional(v.union([ 1318 + v.optional(v.string(), 'Hello World!'), 1319 + v.null() 1320 + ]), 'Hello World!'); 1321 + 1322 + /** 1323 + * This is a simple number with default value 1324 + */ 1325 + export const vCallWithDefaultParametersParameterParameterNumber = v.optional(v.union([ 1326 + v.optional(v.number(), 123), 1327 + v.null() 1328 + ]), 123); 1329 + 1330 + /** 1331 + * This is a simple boolean with default value 1332 + */ 1333 + export const vCallWithDefaultParametersParameterParameterBoolean = v.optional(v.union([ 1334 + v.optional(v.boolean(), true), 1335 + v.null() 1336 + ]), true); 1337 + 1338 + /** 1339 + * This is a simple enum with default value 1340 + */ 1341 + export const vCallWithDefaultParametersParameterParameterEnum = v.picklist([ 1342 + 'Success', 1343 + 'Warning', 1344 + 'Error' 1345 + ]); 1346 + 1347 + /** 1348 + * This is a simple model with default value 1349 + */ 1350 + export const vCallWithDefaultParametersParameterParameterModel = v.union([ 1351 + vModelWithString, 1352 + v.null() 1353 + ]); 1354 + 1355 + /** 1356 + * This is a simple string that is optional with default value 1357 + */ 1358 + export const vCallWithDefaultOptionalParametersParameterParameterString = v.optional(v.string(), 'Hello World!'); 1359 + 1360 + /** 1361 + * This is a simple number that is optional with default value 1362 + */ 1363 + export const vCallWithDefaultOptionalParametersParameterParameterNumber = v.optional(v.number(), 123); 1364 + 1365 + /** 1366 + * This is a simple boolean that is optional with default value 1367 + */ 1368 + export const vCallWithDefaultOptionalParametersParameterParameterBoolean = v.optional(v.boolean(), true); 1369 + 1370 + /** 1371 + * This is a simple enum that is optional with default value 1372 + */ 1373 + export const vCallWithDefaultOptionalParametersParameterParameterEnum = v.picklist([ 1374 + 'Success', 1375 + 'Warning', 1376 + 'Error' 1377 + ]); 1378 + 1379 + /** 1380 + * This is a simple model that is optional with default value 1381 + */ 1382 + export const vCallWithDefaultOptionalParametersParameterParameterModel = vModelWithString; 1383 + 1384 + /** 1385 + * This is a optional string with default 1386 + */ 1387 + export const vCallToTestOrderOfParamsParameterParameterOptionalStringWithDefault = v.optional(v.string(), 'Hello World!'); 1388 + 1389 + /** 1390 + * This is a optional string with empty default 1391 + */ 1392 + export const vCallToTestOrderOfParamsParameterParameterOptionalStringWithEmptyDefault = v.optional(v.string(), ''); 1393 + 1394 + /** 1395 + * This is a optional string with no default 1396 + */ 1397 + export const vCallToTestOrderOfParamsParameterParameterOptionalStringWithNoDefault = v.string(); 1398 + 1399 + /** 1400 + * This is a string with default 1401 + */ 1402 + export const vCallToTestOrderOfParamsParameterParameterStringWithDefault = v.optional(v.string(), 'Hello World!'); 1403 + 1404 + /** 1405 + * This is a string with empty default 1406 + */ 1407 + export const vCallToTestOrderOfParamsParameterParameterStringWithEmptyDefault = v.optional(v.string(), ''); 1408 + 1409 + /** 1410 + * This is a string with no default 1411 + */ 1412 + export const vCallToTestOrderOfParamsParameterParameterStringWithNoDefault = v.string(); 1413 + 1414 + /** 1415 + * This is a string that can be null with no default 1416 + */ 1417 + export const vCallToTestOrderOfParamsParameterParameterStringNullableWithNoDefault = v.union([ 1418 + v.string(), 1419 + v.null() 1420 + ]); 1421 + 1422 + /** 1423 + * This is a string that can be null with default 1424 + */ 1425 + export const vCallToTestOrderOfParamsParameterParameterStringNullableWithDefault = v.optional(v.union([ 1426 + v.string(), 1427 + v.null() 1428 + ]), null); 1429 + 1430 + /** 1132 1431 * Success 1133 1432 */ 1134 1433 export const vCallWithNoContentResponseResponse = v.void(); ··· 1165 1464 vModelThatExtendsExtends 1166 1465 ]); 1167 1466 1467 + /** 1468 + * This is an array parameter that is sent as csv format (comma-separated values) 1469 + */ 1470 + export const vCollectionFormatParameterParameterArrayCsv = v.union([ 1471 + v.array(v.string()), 1472 + v.null() 1473 + ]); 1474 + 1475 + /** 1476 + * This is an array parameter that is sent as ssv format (space-separated values) 1477 + */ 1478 + export const vCollectionFormatParameterParameterArraySsv = v.union([ 1479 + v.array(v.string()), 1480 + v.null() 1481 + ]); 1482 + 1483 + /** 1484 + * This is an array parameter that is sent as tsv format (tab-separated values) 1485 + */ 1486 + export const vCollectionFormatParameterParameterArrayTsv = v.union([ 1487 + v.array(v.string()), 1488 + v.null() 1489 + ]); 1490 + 1491 + /** 1492 + * This is an array parameter that is sent as pipes format (pipe-separated values) 1493 + */ 1494 + export const vCollectionFormatParameterParameterArrayPipes = v.union([ 1495 + v.array(v.string()), 1496 + v.null() 1497 + ]); 1498 + 1499 + /** 1500 + * This is an array parameter that is sent as multi format (multiple parameter instances) 1501 + */ 1502 + export const vCollectionFormatParameterParameterArrayMulti = v.union([ 1503 + v.array(v.string()), 1504 + v.null() 1505 + ]); 1506 + 1507 + /** 1508 + * This is a number parameter 1509 + */ 1510 + export const vTypesParameterId = v.pipe(v.number(), v.integer()); 1511 + 1512 + /** 1513 + * This is a number parameter 1514 + */ 1515 + export const vTypesParameterParameterNumber = v.optional(v.number(), 123); 1516 + 1517 + /** 1518 + * This is a string parameter 1519 + */ 1520 + export const vTypesParameterParameterString = v.optional(v.union([ 1521 + v.optional(v.string(), 'default'), 1522 + v.null() 1523 + ]), 'default'); 1524 + 1525 + /** 1526 + * This is a boolean parameter 1527 + */ 1528 + export const vTypesParameterParameterBoolean = v.optional(v.union([ 1529 + v.optional(v.boolean(), true), 1530 + v.null() 1531 + ]), true); 1532 + 1533 + /** 1534 + * This is an object parameter 1535 + */ 1536 + export const vTypesParameterParameterObject = v.optional(v.union([ 1537 + v.object({}), 1538 + v.null() 1539 + ]), null); 1540 + 1541 + /** 1542 + * This is an array parameter 1543 + */ 1544 + export const vTypesParameterParameterArray = v.union([ 1545 + v.array(v.string()), 1546 + v.null() 1547 + ]); 1548 + 1549 + /** 1550 + * This is a dictionary parameter 1551 + */ 1552 + export const vTypesParameterParameterDictionary = v.union([ 1553 + v.object({}), 1554 + v.null() 1555 + ]); 1556 + 1557 + /** 1558 + * This is an enum parameter 1559 + */ 1560 + export const vTypesParameterParameterEnum = v.picklist([ 1561 + 'Success', 1562 + 'Warning', 1563 + 'Error' 1564 + ]); 1565 + 1168 1566 export const vTypesResponse = v.union([ 1169 1567 v.number(), 1170 1568 v.string(), ··· 1174 1572 1175 1573 export const vUploadFileData = v.string(); 1176 1574 1575 + /** 1576 + * api-version should be required in standalone clients 1577 + */ 1578 + export const vUploadFileParameterApiVersion = v.union([ 1579 + v.string(), 1580 + v.null() 1581 + ]); 1582 + 1177 1583 export const vUploadFileResponse = v.boolean(); 1178 1584 1585 + export const vFileResponseParameterId = v.string(); 1586 + 1587 + /** 1588 + * api-version should be required in standalone clients 1589 + */ 1590 + export const vFileResponseParameterApiVersion = v.string(); 1591 + 1179 1592 /** 1180 1593 * Success 1181 1594 */ 1182 1595 export const vFileResponseResponse = v.string(); 1183 1596 1184 1597 /** 1598 + * Parameter containing object 1599 + */ 1600 + export const vComplexTypesParameterParameterObject = v.object({ 1601 + first: v.optional(v.object({ 1602 + second: v.optional(v.object({ 1603 + third: v.optional(v.string()) 1604 + })) 1605 + })) 1606 + }); 1607 + 1608 + /** 1609 + * Parameter containing reference 1610 + */ 1611 + export const vComplexTypesParameterParameterReference = vModelWithString; 1612 + 1613 + /** 1185 1614 * Successful response 1186 1615 */ 1187 1616 export const vComplexTypesResponse = v.array(vModelWithString); ··· 1243 1672 }), v.readonly())) 1244 1673 }); 1245 1674 1675 + export const vComplexParamsParameterId = v.pipe(v.number(), v.integer()); 1676 + 1677 + /** 1678 + * api-version should be required in standalone clients 1679 + */ 1680 + export const vComplexParamsParameterApiVersion = v.string(); 1681 + 1246 1682 /** 1247 1683 * Success 1248 1684 */ 1249 1685 export const vComplexParamsResponse = vModelWithString; 1686 + 1687 + /** 1688 + * Status code to return 1689 + */ 1690 + export const vTestErrorCodeParameterStatus = v.pipe(v.number(), v.integer()); 1691 + 1692 + /** 1693 + * Dummy input param 1694 + */ 1695 + export const vNonAsciiæøåÆøÅöôêÊ字符串ParameterNonAsciiParamæøåÆøÅöôêÊ = v.pipe(v.number(), v.integer()); 1250 1696 1251 1697 /** 1252 1698 * Successful response
+446
packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/zod/default/zod.gen.ts
··· 972 972 zGenericSchemaDuplicateIssue1SystemString 973 973 ]); 974 974 975 + /** 976 + * Parameter with illegal characters 977 + */ 978 + export const zXFooBar = zModelWithString; 979 + 975 980 export const zSimpleRequestBody = zModelWithString; 976 981 977 982 export const zSimpleFormData = zModelWithString; ··· 992 997 export const zApiVVersionODataControllerCountResponse = zModelFromZendesk; 993 998 994 999 /** 1000 + * foo in method 1001 + */ 1002 + export const zGetApiVbyApiVersionSimpleOperationParameterFooParam = z.string(); 1003 + 1004 + /** 995 1005 * Response is a simple number 996 1006 */ 997 1007 export const zGetApiVbyApiVersionSimpleOperationResponse = z.number(); 998 1008 999 1009 /** 1010 + * foo in method 1011 + */ 1012 + export const zDeleteFooParameterFooParam = z.string(); 1013 + 1014 + /** 1015 + * bar in method 1016 + */ 1017 + export const zDeleteFooParameterBarParam = z.string(); 1018 + 1019 + /** 1020 + * Parameter with illegal characters 1021 + */ 1022 + export const zDeleteFooParameterXFooBar = zModelWithString; 1023 + 1024 + /** 1025 + * Testing multiline comments in string: First line 1026 + * Second line 1027 + * 1028 + * Fourth line 1029 + */ 1030 + export const zCallWithDescriptionsParameterParameterWithBreaks = z.string(); 1031 + 1032 + /** 1033 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1034 + */ 1035 + export const zCallWithDescriptionsParameterParameterWithBackticks = z.string(); 1036 + 1037 + /** 1038 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1039 + */ 1040 + export const zCallWithDescriptionsParameterParameterWithSlashes = z.string(); 1041 + 1042 + /** 1043 + * Testing expression placeholders in string: ${expression} should work 1044 + */ 1045 + export const zCallWithDescriptionsParameterParameterWithExpressionPlaceholders = z.string(); 1046 + 1047 + /** 1048 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1049 + */ 1050 + export const zCallWithDescriptionsParameterParameterWithQuotes = z.string(); 1051 + 1052 + /** 1053 + * Testing reserved characters in string: * inline * and ** inline ** should work 1054 + */ 1055 + export const zCallWithDescriptionsParameterParameterWithReservedCharacters = z.string(); 1056 + 1057 + /** 1058 + * This parameter is deprecated 1059 + * @deprecated 1060 + */ 1061 + export const zDeprecatedCallParameterParameter = z.union([ 1062 + zDeprecatedModel, 1063 + z.null() 1064 + ]); 1065 + 1066 + /** 1000 1067 * This is the parameter that goes into the body 1001 1068 */ 1002 1069 export const zCallWithParametersData = z.union([ ··· 1005 1072 ]); 1006 1073 1007 1074 /** 1075 + * This is the parameter that goes into the cookie 1076 + */ 1077 + export const zCallWithParametersParameterParameterCookie = z.union([ 1078 + z.string(), 1079 + z.null() 1080 + ]); 1081 + 1082 + /** 1083 + * This is the parameter that goes into the header 1084 + */ 1085 + export const zCallWithParametersParameterParameterHeader = z.union([ 1086 + z.string(), 1087 + z.null() 1088 + ]); 1089 + 1090 + /** 1091 + * This is the parameter that goes into the path 1092 + */ 1093 + export const zCallWithParametersParameterParameterPath = z.union([ 1094 + z.string(), 1095 + z.null() 1096 + ]); 1097 + 1098 + /** 1099 + * api-version should be required in standalone clients 1100 + */ 1101 + export const zCallWithParametersParameterApiVersion = z.union([ 1102 + z.string(), 1103 + z.null() 1104 + ]); 1105 + 1106 + export const zCallWithParametersParameterFooRefEnum = zModelWithNestedArrayEnumsDataFoo; 1107 + 1108 + export const zCallWithParametersParameterFooAllOfEnum = zModelWithNestedArrayEnumsDataFoo; 1109 + 1110 + /** 1111 + * This is the parameter that goes into the query params 1112 + */ 1113 + export const zCallWithParametersParameterCursor = z.union([ 1114 + z.string(), 1115 + z.null() 1116 + ]); 1117 + 1118 + /** 1008 1119 * This is the parameter that goes into the body 1009 1120 */ 1010 1121 export const zCallWithWeirdParameterNamesData = z.union([ ··· 1013 1124 ]); 1014 1125 1015 1126 /** 1127 + * This is the parameter that goes into the cookie 1128 + */ 1129 + export const zCallWithWeirdParameterNamesParameterParameterCookie = z.union([ 1130 + z.string(), 1131 + z.null() 1132 + ]); 1133 + 1134 + /** 1135 + * This is the parameter that goes into the request header 1136 + */ 1137 + export const zCallWithWeirdParameterNamesParameterParameterHeader = z.union([ 1138 + z.string(), 1139 + z.null() 1140 + ]); 1141 + 1142 + /** 1143 + * This is the parameter that goes into the path 1144 + */ 1145 + export const zCallWithWeirdParameterNamesParameterParameterPath1 = z.string(); 1146 + 1147 + /** 1148 + * This is the parameter that goes into the path 1149 + */ 1150 + export const zCallWithWeirdParameterNamesParameterParameterPath2 = z.string(); 1151 + 1152 + /** 1153 + * This is the parameter that goes into the path 1154 + */ 1155 + export const zCallWithWeirdParameterNamesParameterParameterPath3 = z.string(); 1156 + 1157 + /** 1158 + * api-version should be required in standalone clients 1159 + */ 1160 + export const zCallWithWeirdParameterNamesParameterApiVersion = z.union([ 1161 + z.string(), 1162 + z.null() 1163 + ]); 1164 + 1165 + /** 1166 + * This is the parameter with a reserved keyword 1167 + */ 1168 + export const zCallWithWeirdParameterNamesParameterDefault = z.string(); 1169 + 1170 + /** 1171 + * This is the parameter that goes into the request query params 1172 + */ 1173 + export const zCallWithWeirdParameterNamesParameterParameterQuery = z.union([ 1174 + z.string(), 1175 + z.null() 1176 + ]); 1177 + 1178 + /** 1016 1179 * This is a required parameter 1017 1180 */ 1018 1181 export const zGetCallWithOptionalParamData = zModelWithOneOfEnum; 1182 + 1183 + /** 1184 + * This is an optional parameter 1185 + */ 1186 + export const zGetCallWithOptionalParamParameterPage = z.number(); 1019 1187 1020 1188 /** 1021 1189 * This is an optional parameter ··· 1027 1195 ]).optional() 1028 1196 }); 1029 1197 1198 + /** 1199 + * This is a required parameter 1200 + */ 1201 + export const zPostCallWithOptionalParamParameterParameter = zPageable; 1202 + 1030 1203 export const zPostCallWithOptionalParamResponse = z.union([ 1031 1204 z.number(), 1032 1205 z.void() ··· 1038 1211 export const zPostApiVbyApiVersionRequestBodyData = zSimpleRequestBody; 1039 1212 1040 1213 /** 1214 + * This is a reusable parameter 1215 + */ 1216 + export const zPostApiVbyApiVersionRequestBodyParameterParameter = z.string(); 1217 + 1218 + /** 1041 1219 * A reusable request body 1042 1220 */ 1043 1221 export const zPostApiVbyApiVersionFormDataData = zSimpleFormData; 1044 1222 1045 1223 /** 1224 + * This is a reusable parameter 1225 + */ 1226 + export const zPostApiVbyApiVersionFormDataParameterParameter = z.string(); 1227 + 1228 + /** 1229 + * This is a simple string with default value 1230 + */ 1231 + export const zCallWithDefaultParametersParameterParameterString = z.union([ 1232 + z.string().default('Hello World!'), 1233 + z.null() 1234 + ]).default('Hello World!'); 1235 + 1236 + /** 1237 + * This is a simple number with default value 1238 + */ 1239 + export const zCallWithDefaultParametersParameterParameterNumber = z.union([ 1240 + z.number().default(123), 1241 + z.null() 1242 + ]).default(123); 1243 + 1244 + /** 1245 + * This is a simple boolean with default value 1246 + */ 1247 + export const zCallWithDefaultParametersParameterParameterBoolean = z.union([ 1248 + z.boolean().default(true), 1249 + z.null() 1250 + ]).default(true); 1251 + 1252 + /** 1253 + * This is a simple enum with default value 1254 + */ 1255 + export const zCallWithDefaultParametersParameterParameterEnum = z.enum([ 1256 + 'Success', 1257 + 'Warning', 1258 + 'Error' 1259 + ]); 1260 + 1261 + /** 1262 + * This is a simple model with default value 1263 + */ 1264 + export const zCallWithDefaultParametersParameterParameterModel = z.union([ 1265 + zModelWithString, 1266 + z.null() 1267 + ]); 1268 + 1269 + /** 1270 + * This is a simple string that is optional with default value 1271 + */ 1272 + export const zCallWithDefaultOptionalParametersParameterParameterString = z.string().default('Hello World!'); 1273 + 1274 + /** 1275 + * This is a simple number that is optional with default value 1276 + */ 1277 + export const zCallWithDefaultOptionalParametersParameterParameterNumber = z.number().default(123); 1278 + 1279 + /** 1280 + * This is a simple boolean that is optional with default value 1281 + */ 1282 + export const zCallWithDefaultOptionalParametersParameterParameterBoolean = z.boolean().default(true); 1283 + 1284 + /** 1285 + * This is a simple enum that is optional with default value 1286 + */ 1287 + export const zCallWithDefaultOptionalParametersParameterParameterEnum = z.enum([ 1288 + 'Success', 1289 + 'Warning', 1290 + 'Error' 1291 + ]); 1292 + 1293 + /** 1294 + * This is a simple model that is optional with default value 1295 + */ 1296 + export const zCallWithDefaultOptionalParametersParameterParameterModel = zModelWithString; 1297 + 1298 + /** 1299 + * This is a optional string with default 1300 + */ 1301 + export const zCallToTestOrderOfParamsParameterParameterOptionalStringWithDefault = z.string().default('Hello World!'); 1302 + 1303 + /** 1304 + * This is a optional string with empty default 1305 + */ 1306 + export const zCallToTestOrderOfParamsParameterParameterOptionalStringWithEmptyDefault = z.string().default(''); 1307 + 1308 + /** 1309 + * This is a optional string with no default 1310 + */ 1311 + export const zCallToTestOrderOfParamsParameterParameterOptionalStringWithNoDefault = z.string(); 1312 + 1313 + /** 1314 + * This is a string with default 1315 + */ 1316 + export const zCallToTestOrderOfParamsParameterParameterStringWithDefault = z.string().default('Hello World!'); 1317 + 1318 + /** 1319 + * This is a string with empty default 1320 + */ 1321 + export const zCallToTestOrderOfParamsParameterParameterStringWithEmptyDefault = z.string().default(''); 1322 + 1323 + /** 1324 + * This is a string with no default 1325 + */ 1326 + export const zCallToTestOrderOfParamsParameterParameterStringWithNoDefault = z.string(); 1327 + 1328 + /** 1329 + * This is a string that can be null with no default 1330 + */ 1331 + export const zCallToTestOrderOfParamsParameterParameterStringNullableWithNoDefault = z.union([ 1332 + z.string(), 1333 + z.null() 1334 + ]); 1335 + 1336 + /** 1337 + * This is a string that can be null with default 1338 + */ 1339 + export const zCallToTestOrderOfParamsParameterParameterStringNullableWithDefault = z.union([ 1340 + z.string(), 1341 + z.null() 1342 + ]).default(null); 1343 + 1344 + /** 1046 1345 * Success 1047 1346 */ 1048 1347 export const zCallWithNoContentResponseResponse = z.void(); ··· 1076 1375 zModelThatExtendsExtends 1077 1376 ]); 1078 1377 1378 + /** 1379 + * This is an array parameter that is sent as csv format (comma-separated values) 1380 + */ 1381 + export const zCollectionFormatParameterParameterArrayCsv = z.union([ 1382 + z.array(z.string()), 1383 + z.null() 1384 + ]); 1385 + 1386 + /** 1387 + * This is an array parameter that is sent as ssv format (space-separated values) 1388 + */ 1389 + export const zCollectionFormatParameterParameterArraySsv = z.union([ 1390 + z.array(z.string()), 1391 + z.null() 1392 + ]); 1393 + 1394 + /** 1395 + * This is an array parameter that is sent as tsv format (tab-separated values) 1396 + */ 1397 + export const zCollectionFormatParameterParameterArrayTsv = z.union([ 1398 + z.array(z.string()), 1399 + z.null() 1400 + ]); 1401 + 1402 + /** 1403 + * This is an array parameter that is sent as pipes format (pipe-separated values) 1404 + */ 1405 + export const zCollectionFormatParameterParameterArrayPipes = z.union([ 1406 + z.array(z.string()), 1407 + z.null() 1408 + ]); 1409 + 1410 + /** 1411 + * This is an array parameter that is sent as multi format (multiple parameter instances) 1412 + */ 1413 + export const zCollectionFormatParameterParameterArrayMulti = z.union([ 1414 + z.array(z.string()), 1415 + z.null() 1416 + ]); 1417 + 1418 + /** 1419 + * This is a number parameter 1420 + */ 1421 + export const zTypesParameterId = z.number().int(); 1422 + 1423 + /** 1424 + * This is a number parameter 1425 + */ 1426 + export const zTypesParameterParameterNumber = z.number().default(123); 1427 + 1428 + /** 1429 + * This is a string parameter 1430 + */ 1431 + export const zTypesParameterParameterString = z.union([ 1432 + z.string().default('default'), 1433 + z.null() 1434 + ]).default('default'); 1435 + 1436 + /** 1437 + * This is a boolean parameter 1438 + */ 1439 + export const zTypesParameterParameterBoolean = z.union([ 1440 + z.boolean().default(true), 1441 + z.null() 1442 + ]).default(true); 1443 + 1444 + /** 1445 + * This is an object parameter 1446 + */ 1447 + export const zTypesParameterParameterObject = z.union([ 1448 + z.object({}), 1449 + z.null() 1450 + ]).default(null); 1451 + 1452 + /** 1453 + * This is an array parameter 1454 + */ 1455 + export const zTypesParameterParameterArray = z.union([ 1456 + z.array(z.string()), 1457 + z.null() 1458 + ]); 1459 + 1460 + /** 1461 + * This is a dictionary parameter 1462 + */ 1463 + export const zTypesParameterParameterDictionary = z.union([ 1464 + z.object({}), 1465 + z.null() 1466 + ]); 1467 + 1468 + /** 1469 + * This is an enum parameter 1470 + */ 1471 + export const zTypesParameterParameterEnum = z.enum([ 1472 + 'Success', 1473 + 'Warning', 1474 + 'Error' 1475 + ]); 1476 + 1079 1477 export const zTypesResponse = z.union([ 1080 1478 z.number(), 1081 1479 z.string(), ··· 1085 1483 1086 1484 export const zUploadFileData = z.string(); 1087 1485 1486 + /** 1487 + * api-version should be required in standalone clients 1488 + */ 1489 + export const zUploadFileParameterApiVersion = z.union([ 1490 + z.string(), 1491 + z.null() 1492 + ]); 1493 + 1088 1494 export const zUploadFileResponse = z.boolean(); 1089 1495 1496 + export const zFileResponseParameterId = z.string(); 1497 + 1498 + /** 1499 + * api-version should be required in standalone clients 1500 + */ 1501 + export const zFileResponseParameterApiVersion = z.string(); 1502 + 1090 1503 /** 1091 1504 * Success 1092 1505 */ 1093 1506 export const zFileResponseResponse = z.string(); 1094 1507 1095 1508 /** 1509 + * Parameter containing object 1510 + */ 1511 + export const zComplexTypesParameterParameterObject = z.object({ 1512 + first: z.object({ 1513 + second: z.object({ 1514 + third: z.string().optional() 1515 + }).optional() 1516 + }).optional() 1517 + }); 1518 + 1519 + /** 1520 + * Parameter containing reference 1521 + */ 1522 + export const zComplexTypesParameterParameterReference = zModelWithString; 1523 + 1524 + /** 1096 1525 * Successful response 1097 1526 */ 1098 1527 export const zComplexTypesResponse = z.array(zModelWithString); ··· 1154 1583 }).readonly().optional() 1155 1584 }); 1156 1585 1586 + export const zComplexParamsParameterId = z.number().int(); 1587 + 1588 + /** 1589 + * api-version should be required in standalone clients 1590 + */ 1591 + export const zComplexParamsParameterApiVersion = z.string(); 1592 + 1157 1593 /** 1158 1594 * Success 1159 1595 */ 1160 1596 export const zComplexParamsResponse = zModelWithString; 1597 + 1598 + /** 1599 + * Status code to return 1600 + */ 1601 + export const zTestErrorCodeParameterStatus = z.number().int(); 1602 + 1603 + /** 1604 + * Dummy input param 1605 + */ 1606 + export const zNonAsciiæøåÆøÅöôêÊ字符串ParameterNonAsciiParamæøåÆøÅöôêÊ = z.number().int(); 1161 1607 1162 1608 /** 1163 1609 * Successful response
+447
packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/valibot/default/valibot.gen.ts
··· 1057 1057 ]); 1058 1058 1059 1059 /** 1060 + * Parameter with illegal characters 1061 + */ 1062 + export const vXFooBar = vModelWithString; 1063 + 1064 + /** 1060 1065 * A reusable request body 1061 1066 */ 1062 1067 export const vSimpleRequestBody = vModelWithString; ··· 1082 1087 export const vApiVVersionODataControllerCountResponse = vModelFromZendesk; 1083 1088 1084 1089 /** 1090 + * foo in method 1091 + */ 1092 + export const vGetApiVbyApiVersionSimpleOperationParameterFooParam = v.string(); 1093 + 1094 + /** 1085 1095 * Response is a simple number 1086 1096 */ 1087 1097 export const vGetApiVbyApiVersionSimpleOperationResponse = v.number(); 1088 1098 1089 1099 /** 1100 + * foo in method 1101 + */ 1102 + export const vDeleteFooParameterFooParam = v.string(); 1103 + 1104 + /** 1105 + * bar in method 1106 + */ 1107 + export const vDeleteFooParameterBarParam = v.string(); 1108 + 1109 + /** 1110 + * Parameter with illegal characters 1111 + */ 1112 + export const vDeleteFooParameterXFooBar = vModelWithString; 1113 + 1114 + /** 1115 + * Testing multiline comments in string: First line 1116 + * Second line 1117 + * 1118 + * Fourth line 1119 + */ 1120 + export const vCallWithDescriptionsParameterParameterWithBreaks = v.string(); 1121 + 1122 + /** 1123 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1124 + */ 1125 + export const vCallWithDescriptionsParameterParameterWithBackticks = v.string(); 1126 + 1127 + /** 1128 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1129 + */ 1130 + export const vCallWithDescriptionsParameterParameterWithSlashes = v.string(); 1131 + 1132 + /** 1133 + * Testing expression placeholders in string: ${expression} should work 1134 + */ 1135 + export const vCallWithDescriptionsParameterParameterWithExpressionPlaceholders = v.string(); 1136 + 1137 + /** 1138 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1139 + */ 1140 + export const vCallWithDescriptionsParameterParameterWithQuotes = v.string(); 1141 + 1142 + /** 1143 + * Testing reserved characters in string: * inline * and ** inline ** should work 1144 + */ 1145 + export const vCallWithDescriptionsParameterParameterWithReservedCharacters = v.string(); 1146 + 1147 + /** 1148 + * This parameter is deprecated 1149 + * @deprecated 1150 + */ 1151 + export const vDeprecatedCallParameterParameter = v.union([ 1152 + vDeprecatedModel, 1153 + v.null() 1154 + ]); 1155 + 1156 + /** 1090 1157 * This is the parameter that goes into the body 1091 1158 */ 1092 1159 export const vCallWithParametersData = v.union([ ··· 1095 1162 ]); 1096 1163 1097 1164 /** 1165 + * This is the parameter that goes into the cookie 1166 + */ 1167 + export const vCallWithParametersParameterParameterCookie = v.union([ 1168 + v.string(), 1169 + v.null() 1170 + ]); 1171 + 1172 + /** 1173 + * This is the parameter that goes into the header 1174 + */ 1175 + export const vCallWithParametersParameterParameterHeader = v.union([ 1176 + v.string(), 1177 + v.null() 1178 + ]); 1179 + 1180 + /** 1181 + * This is the parameter that goes into the path 1182 + */ 1183 + export const vCallWithParametersParameterParameterPath = v.union([ 1184 + v.string(), 1185 + v.null() 1186 + ]); 1187 + 1188 + /** 1189 + * api-version should be required in standalone clients 1190 + */ 1191 + export const vCallWithParametersParameterApiVersion = v.union([ 1192 + v.string(), 1193 + v.null() 1194 + ]); 1195 + 1196 + export const vCallWithParametersParameterFooRefEnum = vModelWithNestedArrayEnumsDataFoo; 1197 + 1198 + export const vCallWithParametersParameterFooAllOfEnum = vModelWithNestedArrayEnumsDataFoo; 1199 + 1200 + /** 1201 + * This is the parameter that goes into the query params 1202 + */ 1203 + export const vCallWithParametersParameterCursor = v.union([ 1204 + v.string(), 1205 + v.null() 1206 + ]); 1207 + 1208 + /** 1098 1209 * This is the parameter that goes into the body 1099 1210 */ 1100 1211 export const vCallWithWeirdParameterNamesData = v.union([ ··· 1103 1214 ]); 1104 1215 1105 1216 /** 1217 + * This is the parameter that goes into the cookie 1218 + */ 1219 + export const vCallWithWeirdParameterNamesParameterParameterCookie = v.union([ 1220 + v.string(), 1221 + v.null() 1222 + ]); 1223 + 1224 + /** 1225 + * This is the parameter that goes into the request header 1226 + */ 1227 + export const vCallWithWeirdParameterNamesParameterParameterHeader = v.union([ 1228 + v.string(), 1229 + v.null() 1230 + ]); 1231 + 1232 + /** 1233 + * This is the parameter that goes into the path 1234 + */ 1235 + export const vCallWithWeirdParameterNamesParameterParameterPath1 = v.string(); 1236 + 1237 + /** 1238 + * This is the parameter that goes into the path 1239 + */ 1240 + export const vCallWithWeirdParameterNamesParameterParameterPath2 = v.string(); 1241 + 1242 + /** 1243 + * This is the parameter that goes into the path 1244 + */ 1245 + export const vCallWithWeirdParameterNamesParameterParameterPath3 = v.string(); 1246 + 1247 + /** 1248 + * api-version should be required in standalone clients 1249 + */ 1250 + export const vCallWithWeirdParameterNamesParameterApiVersion = v.union([ 1251 + v.string(), 1252 + v.null() 1253 + ]); 1254 + 1255 + /** 1256 + * This is the parameter with a reserved keyword 1257 + */ 1258 + export const vCallWithWeirdParameterNamesParameterDefault = v.string(); 1259 + 1260 + /** 1261 + * This is the parameter that goes into the request query params 1262 + */ 1263 + export const vCallWithWeirdParameterNamesParameterParameterQuery = v.union([ 1264 + v.string(), 1265 + v.null() 1266 + ]); 1267 + 1268 + /** 1106 1269 * This is a required parameter 1107 1270 */ 1108 1271 export const vGetCallWithOptionalParamData = vModelWithOneOfEnum; 1272 + 1273 + /** 1274 + * This is an optional parameter 1275 + */ 1276 + export const vGetCallWithOptionalParamParameterPage = v.number(); 1109 1277 1110 1278 /** 1111 1279 * This is an optional parameter ··· 1117 1285 ])) 1118 1286 }); 1119 1287 1288 + /** 1289 + * This is a required parameter 1290 + */ 1291 + export const vPostCallWithOptionalParamParameterParameter = vPageable; 1292 + 1120 1293 export const vPostCallWithOptionalParamResponse = v.union([ 1121 1294 v.number(), 1122 1295 v.void() ··· 1128 1301 export const vPostApiVbyApiVersionRequestBodyData = vSimpleRequestBody; 1129 1302 1130 1303 /** 1304 + * This is a reusable parameter 1305 + */ 1306 + export const vPostApiVbyApiVersionRequestBodyParameterParameter = v.string(); 1307 + 1308 + /** 1131 1309 * A reusable request body 1132 1310 */ 1133 1311 export const vPostApiVbyApiVersionFormDataData = vSimpleFormData; 1134 1312 1135 1313 /** 1314 + * This is a reusable parameter 1315 + */ 1316 + export const vPostApiVbyApiVersionFormDataParameterParameter = v.string(); 1317 + 1318 + /** 1319 + * This is a simple string with default value 1320 + */ 1321 + export const vCallWithDefaultParametersParameterParameterString = v.optional(v.union([ 1322 + v.optional(v.string(), 'Hello World!'), 1323 + v.null() 1324 + ]), 'Hello World!'); 1325 + 1326 + /** 1327 + * This is a simple number with default value 1328 + */ 1329 + export const vCallWithDefaultParametersParameterParameterNumber = v.optional(v.union([ 1330 + v.optional(v.number(), 123), 1331 + v.null() 1332 + ]), 123); 1333 + 1334 + /** 1335 + * This is a simple boolean with default value 1336 + */ 1337 + export const vCallWithDefaultParametersParameterParameterBoolean = v.optional(v.union([ 1338 + v.optional(v.boolean(), true), 1339 + v.null() 1340 + ]), true); 1341 + 1342 + /** 1343 + * This is a simple enum with default value 1344 + */ 1345 + export const vCallWithDefaultParametersParameterParameterEnum = v.picklist([ 1346 + 'Success', 1347 + 'Warning', 1348 + 'Error' 1349 + ]); 1350 + 1351 + /** 1352 + * This is a simple model with default value 1353 + */ 1354 + export const vCallWithDefaultParametersParameterParameterModel = v.union([ 1355 + vModelWithString, 1356 + v.null() 1357 + ]); 1358 + 1359 + /** 1360 + * This is a simple string that is optional with default value 1361 + */ 1362 + export const vCallWithDefaultOptionalParametersParameterParameterString = v.optional(v.string(), 'Hello World!'); 1363 + 1364 + /** 1365 + * This is a simple number that is optional with default value 1366 + */ 1367 + export const vCallWithDefaultOptionalParametersParameterParameterNumber = v.optional(v.number(), 123); 1368 + 1369 + /** 1370 + * This is a simple boolean that is optional with default value 1371 + */ 1372 + export const vCallWithDefaultOptionalParametersParameterParameterBoolean = v.optional(v.boolean(), true); 1373 + 1374 + /** 1375 + * This is a simple enum that is optional with default value 1376 + */ 1377 + export const vCallWithDefaultOptionalParametersParameterParameterEnum = v.picklist([ 1378 + 'Success', 1379 + 'Warning', 1380 + 'Error' 1381 + ]); 1382 + 1383 + /** 1384 + * This is a simple model that is optional with default value 1385 + */ 1386 + export const vCallWithDefaultOptionalParametersParameterParameterModel = vModelWithString; 1387 + 1388 + /** 1389 + * This is a optional string with default 1390 + */ 1391 + export const vCallToTestOrderOfParamsParameterParameterOptionalStringWithDefault = v.optional(v.string(), 'Hello World!'); 1392 + 1393 + /** 1394 + * This is a optional string with empty default 1395 + */ 1396 + export const vCallToTestOrderOfParamsParameterParameterOptionalStringWithEmptyDefault = v.optional(v.string(), ''); 1397 + 1398 + /** 1399 + * This is a optional string with no default 1400 + */ 1401 + export const vCallToTestOrderOfParamsParameterParameterOptionalStringWithNoDefault = v.string(); 1402 + 1403 + /** 1404 + * This is a string with default 1405 + */ 1406 + export const vCallToTestOrderOfParamsParameterParameterStringWithDefault = v.optional(v.string(), 'Hello World!'); 1407 + 1408 + /** 1409 + * This is a string with empty default 1410 + */ 1411 + export const vCallToTestOrderOfParamsParameterParameterStringWithEmptyDefault = v.optional(v.string(), ''); 1412 + 1413 + /** 1414 + * This is a string with no default 1415 + */ 1416 + export const vCallToTestOrderOfParamsParameterParameterStringWithNoDefault = v.string(); 1417 + 1418 + /** 1419 + * This is a string that can be null with no default 1420 + */ 1421 + export const vCallToTestOrderOfParamsParameterParameterStringNullableWithNoDefault = v.union([ 1422 + v.string(), 1423 + v.null() 1424 + ]); 1425 + 1426 + /** 1427 + * This is a string that can be null with default 1428 + */ 1429 + export const vCallToTestOrderOfParamsParameterParameterStringNullableWithDefault = v.optional(v.union([ 1430 + v.string(), 1431 + v.null() 1432 + ]), null); 1433 + 1434 + /** 1136 1435 * Success 1137 1436 */ 1138 1437 export const vCallWithNoContentResponseResponse = v.void(); ··· 1169 1468 vModelThatExtendsExtends 1170 1469 ]); 1171 1470 1471 + /** 1472 + * This is an array parameter that is sent as csv format (comma-separated values) 1473 + */ 1474 + export const vCollectionFormatParameterParameterArrayCsv = v.union([ 1475 + v.array(v.string()), 1476 + v.null() 1477 + ]); 1478 + 1479 + /** 1480 + * This is an array parameter that is sent as ssv format (space-separated values) 1481 + */ 1482 + export const vCollectionFormatParameterParameterArraySsv = v.union([ 1483 + v.array(v.string()), 1484 + v.null() 1485 + ]); 1486 + 1487 + /** 1488 + * This is an array parameter that is sent as tsv format (tab-separated values) 1489 + */ 1490 + export const vCollectionFormatParameterParameterArrayTsv = v.union([ 1491 + v.array(v.string()), 1492 + v.null() 1493 + ]); 1494 + 1495 + /** 1496 + * This is an array parameter that is sent as pipes format (pipe-separated values) 1497 + */ 1498 + export const vCollectionFormatParameterParameterArrayPipes = v.union([ 1499 + v.array(v.string()), 1500 + v.null() 1501 + ]); 1502 + 1503 + /** 1504 + * This is an array parameter that is sent as multi format (multiple parameter instances) 1505 + */ 1506 + export const vCollectionFormatParameterParameterArrayMulti = v.union([ 1507 + v.array(v.string()), 1508 + v.null() 1509 + ]); 1510 + 1511 + /** 1512 + * This is a number parameter 1513 + */ 1514 + export const vTypesParameterId = v.pipe(v.number(), v.integer()); 1515 + 1516 + /** 1517 + * This is a number parameter 1518 + */ 1519 + export const vTypesParameterParameterNumber = v.optional(v.number(), 123); 1520 + 1521 + /** 1522 + * This is a string parameter 1523 + */ 1524 + export const vTypesParameterParameterString = v.optional(v.union([ 1525 + v.optional(v.string(), 'default'), 1526 + v.null() 1527 + ]), 'default'); 1528 + 1529 + /** 1530 + * This is a boolean parameter 1531 + */ 1532 + export const vTypesParameterParameterBoolean = v.optional(v.union([ 1533 + v.optional(v.boolean(), true), 1534 + v.null() 1535 + ]), true); 1536 + 1537 + /** 1538 + * This is an object parameter 1539 + */ 1540 + export const vTypesParameterParameterObject = v.optional(v.union([ 1541 + v.object({}), 1542 + v.null() 1543 + ]), null); 1544 + 1545 + /** 1546 + * This is an array parameter 1547 + */ 1548 + export const vTypesParameterParameterArray = v.union([ 1549 + v.array(v.string()), 1550 + v.null() 1551 + ]); 1552 + 1553 + /** 1554 + * This is a dictionary parameter 1555 + */ 1556 + export const vTypesParameterParameterDictionary = v.union([ 1557 + v.object({}), 1558 + v.null() 1559 + ]); 1560 + 1561 + /** 1562 + * This is an enum parameter 1563 + */ 1564 + export const vTypesParameterParameterEnum = v.union([ 1565 + v.literal('Success'), 1566 + v.literal('Warning'), 1567 + v.literal('Error'), 1568 + v.null() 1569 + ]); 1570 + 1172 1571 export const vTypesResponse = v.union([ 1173 1572 v.number(), 1174 1573 v.string(), ··· 1178 1577 1179 1578 export const vUploadFileData = v.string(); 1180 1579 1580 + /** 1581 + * api-version should be required in standalone clients 1582 + */ 1583 + export const vUploadFileParameterApiVersion = v.union([ 1584 + v.string(), 1585 + v.null() 1586 + ]); 1587 + 1181 1588 export const vUploadFileResponse = v.boolean(); 1182 1589 1590 + export const vFileResponseParameterId = v.string(); 1591 + 1592 + /** 1593 + * api-version should be required in standalone clients 1594 + */ 1595 + export const vFileResponseParameterApiVersion = v.string(); 1596 + 1183 1597 /** 1184 1598 * Success 1185 1599 */ 1186 1600 export const vFileResponseResponse = v.string(); 1187 1601 1188 1602 /** 1603 + * Parameter containing object 1604 + */ 1605 + export const vComplexTypesParameterParameterObject = v.object({ 1606 + first: v.optional(v.object({ 1607 + second: v.optional(v.object({ 1608 + third: v.optional(v.string()) 1609 + })) 1610 + })) 1611 + }); 1612 + 1613 + /** 1614 + * Parameter containing reference 1615 + */ 1616 + export const vComplexTypesParameterParameterReference = vModelWithString; 1617 + 1618 + /** 1189 1619 * Successful response 1190 1620 */ 1191 1621 export const vComplexTypesResponse = v.array(vModelWithString); ··· 1247 1677 }), v.readonly())) 1248 1678 }); 1249 1679 1680 + export const vComplexParamsParameterId = v.pipe(v.number(), v.integer()); 1681 + 1682 + /** 1683 + * api-version should be required in standalone clients 1684 + */ 1685 + export const vComplexParamsParameterApiVersion = v.string(); 1686 + 1250 1687 /** 1251 1688 * Success 1252 1689 */ 1253 1690 export const vComplexParamsResponse = vModelWithString; 1691 + 1692 + /** 1693 + * Status code to return 1694 + */ 1695 + export const vTestErrorCodeParameterStatus = v.pipe(v.number(), v.integer()); 1696 + 1697 + /** 1698 + * Dummy input param 1699 + */ 1700 + export const vNonAsciiæøåÆøÅöôêÊ字符串ParameterNonAsciiParamæøåÆøÅöôêÊ = v.pipe(v.number(), v.integer()); 1254 1701 1255 1702 /** 1256 1703 * Successful response
+447
packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/zod/default/zod.gen.ts
··· 964 964 ]); 965 965 966 966 /** 967 + * Parameter with illegal characters 968 + */ 969 + export const zXFooBar = zModelWithString; 970 + 971 + /** 967 972 * A reusable request body 968 973 */ 969 974 export const zSimpleRequestBody = zModelWithString; ··· 989 994 export const zApiVVersionODataControllerCountResponse = zModelFromZendesk; 990 995 991 996 /** 997 + * foo in method 998 + */ 999 + export const zGetApiVbyApiVersionSimpleOperationParameterFooParam = z.string(); 1000 + 1001 + /** 992 1002 * Response is a simple number 993 1003 */ 994 1004 export const zGetApiVbyApiVersionSimpleOperationResponse = z.number(); 995 1005 996 1006 /** 1007 + * foo in method 1008 + */ 1009 + export const zDeleteFooParameterFooParam = z.string(); 1010 + 1011 + /** 1012 + * bar in method 1013 + */ 1014 + export const zDeleteFooParameterBarParam = z.string(); 1015 + 1016 + /** 1017 + * Parameter with illegal characters 1018 + */ 1019 + export const zDeleteFooParameterXFooBar = zModelWithString; 1020 + 1021 + /** 1022 + * Testing multiline comments in string: First line 1023 + * Second line 1024 + * 1025 + * Fourth line 1026 + */ 1027 + export const zCallWithDescriptionsParameterParameterWithBreaks = z.string(); 1028 + 1029 + /** 1030 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1031 + */ 1032 + export const zCallWithDescriptionsParameterParameterWithBackticks = z.string(); 1033 + 1034 + /** 1035 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1036 + */ 1037 + export const zCallWithDescriptionsParameterParameterWithSlashes = z.string(); 1038 + 1039 + /** 1040 + * Testing expression placeholders in string: ${expression} should work 1041 + */ 1042 + export const zCallWithDescriptionsParameterParameterWithExpressionPlaceholders = z.string(); 1043 + 1044 + /** 1045 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1046 + */ 1047 + export const zCallWithDescriptionsParameterParameterWithQuotes = z.string(); 1048 + 1049 + /** 1050 + * Testing reserved characters in string: * inline * and ** inline ** should work 1051 + */ 1052 + export const zCallWithDescriptionsParameterParameterWithReservedCharacters = z.string(); 1053 + 1054 + /** 1055 + * This parameter is deprecated 1056 + * @deprecated 1057 + */ 1058 + export const zDeprecatedCallParameterParameter = z.union([ 1059 + zDeprecatedModel, 1060 + z.null() 1061 + ]); 1062 + 1063 + /** 997 1064 * This is the parameter that goes into the body 998 1065 */ 999 1066 export const zCallWithParametersData = z.union([ ··· 1002 1069 ]); 1003 1070 1004 1071 /** 1072 + * This is the parameter that goes into the cookie 1073 + */ 1074 + export const zCallWithParametersParameterParameterCookie = z.union([ 1075 + z.string(), 1076 + z.null() 1077 + ]); 1078 + 1079 + /** 1080 + * This is the parameter that goes into the header 1081 + */ 1082 + export const zCallWithParametersParameterParameterHeader = z.union([ 1083 + z.string(), 1084 + z.null() 1085 + ]); 1086 + 1087 + /** 1088 + * This is the parameter that goes into the path 1089 + */ 1090 + export const zCallWithParametersParameterParameterPath = z.union([ 1091 + z.string(), 1092 + z.null() 1093 + ]); 1094 + 1095 + /** 1096 + * api-version should be required in standalone clients 1097 + */ 1098 + export const zCallWithParametersParameterApiVersion = z.union([ 1099 + z.string(), 1100 + z.null() 1101 + ]); 1102 + 1103 + export const zCallWithParametersParameterFooRefEnum = zModelWithNestedArrayEnumsDataFoo; 1104 + 1105 + export const zCallWithParametersParameterFooAllOfEnum = zModelWithNestedArrayEnumsDataFoo; 1106 + 1107 + /** 1108 + * This is the parameter that goes into the query params 1109 + */ 1110 + export const zCallWithParametersParameterCursor = z.union([ 1111 + z.string(), 1112 + z.null() 1113 + ]); 1114 + 1115 + /** 1005 1116 * This is the parameter that goes into the body 1006 1117 */ 1007 1118 export const zCallWithWeirdParameterNamesData = z.union([ ··· 1010 1121 ]); 1011 1122 1012 1123 /** 1124 + * This is the parameter that goes into the cookie 1125 + */ 1126 + export const zCallWithWeirdParameterNamesParameterParameterCookie = z.union([ 1127 + z.string(), 1128 + z.null() 1129 + ]); 1130 + 1131 + /** 1132 + * This is the parameter that goes into the request header 1133 + */ 1134 + export const zCallWithWeirdParameterNamesParameterParameterHeader = z.union([ 1135 + z.string(), 1136 + z.null() 1137 + ]); 1138 + 1139 + /** 1140 + * This is the parameter that goes into the path 1141 + */ 1142 + export const zCallWithWeirdParameterNamesParameterParameterPath1 = z.string(); 1143 + 1144 + /** 1145 + * This is the parameter that goes into the path 1146 + */ 1147 + export const zCallWithWeirdParameterNamesParameterParameterPath2 = z.string(); 1148 + 1149 + /** 1150 + * This is the parameter that goes into the path 1151 + */ 1152 + export const zCallWithWeirdParameterNamesParameterParameterPath3 = z.string(); 1153 + 1154 + /** 1155 + * api-version should be required in standalone clients 1156 + */ 1157 + export const zCallWithWeirdParameterNamesParameterApiVersion = z.union([ 1158 + z.string(), 1159 + z.null() 1160 + ]); 1161 + 1162 + /** 1163 + * This is the parameter with a reserved keyword 1164 + */ 1165 + export const zCallWithWeirdParameterNamesParameterDefault = z.string(); 1166 + 1167 + /** 1168 + * This is the parameter that goes into the request query params 1169 + */ 1170 + export const zCallWithWeirdParameterNamesParameterParameterQuery = z.union([ 1171 + z.string(), 1172 + z.null() 1173 + ]); 1174 + 1175 + /** 1013 1176 * This is a required parameter 1014 1177 */ 1015 1178 export const zGetCallWithOptionalParamData = zModelWithOneOfEnum; 1179 + 1180 + /** 1181 + * This is an optional parameter 1182 + */ 1183 + export const zGetCallWithOptionalParamParameterPage = z.number(); 1016 1184 1017 1185 /** 1018 1186 * This is an optional parameter ··· 1024 1192 ]).optional() 1025 1193 }); 1026 1194 1195 + /** 1196 + * This is a required parameter 1197 + */ 1198 + export const zPostCallWithOptionalParamParameterParameter = zPageable; 1199 + 1027 1200 export const zPostCallWithOptionalParamResponse = z.union([ 1028 1201 z.number(), 1029 1202 z.void() ··· 1035 1208 export const zPostApiVbyApiVersionRequestBodyData = zSimpleRequestBody; 1036 1209 1037 1210 /** 1211 + * This is a reusable parameter 1212 + */ 1213 + export const zPostApiVbyApiVersionRequestBodyParameterParameter = z.string(); 1214 + 1215 + /** 1038 1216 * A reusable request body 1039 1217 */ 1040 1218 export const zPostApiVbyApiVersionFormDataData = zSimpleFormData; 1041 1219 1042 1220 /** 1221 + * This is a reusable parameter 1222 + */ 1223 + export const zPostApiVbyApiVersionFormDataParameterParameter = z.string(); 1224 + 1225 + /** 1226 + * This is a simple string with default value 1227 + */ 1228 + export const zCallWithDefaultParametersParameterParameterString = z.union([ 1229 + z.string().default('Hello World!'), 1230 + z.null() 1231 + ]).default('Hello World!'); 1232 + 1233 + /** 1234 + * This is a simple number with default value 1235 + */ 1236 + export const zCallWithDefaultParametersParameterParameterNumber = z.union([ 1237 + z.number().default(123), 1238 + z.null() 1239 + ]).default(123); 1240 + 1241 + /** 1242 + * This is a simple boolean with default value 1243 + */ 1244 + export const zCallWithDefaultParametersParameterParameterBoolean = z.union([ 1245 + z.boolean().default(true), 1246 + z.null() 1247 + ]).default(true); 1248 + 1249 + /** 1250 + * This is a simple enum with default value 1251 + */ 1252 + export const zCallWithDefaultParametersParameterParameterEnum = z.enum([ 1253 + 'Success', 1254 + 'Warning', 1255 + 'Error' 1256 + ]); 1257 + 1258 + /** 1259 + * This is a simple model with default value 1260 + */ 1261 + export const zCallWithDefaultParametersParameterParameterModel = z.union([ 1262 + zModelWithString, 1263 + z.null() 1264 + ]); 1265 + 1266 + /** 1267 + * This is a simple string that is optional with default value 1268 + */ 1269 + export const zCallWithDefaultOptionalParametersParameterParameterString = z.string().default('Hello World!'); 1270 + 1271 + /** 1272 + * This is a simple number that is optional with default value 1273 + */ 1274 + export const zCallWithDefaultOptionalParametersParameterParameterNumber = z.number().default(123); 1275 + 1276 + /** 1277 + * This is a simple boolean that is optional with default value 1278 + */ 1279 + export const zCallWithDefaultOptionalParametersParameterParameterBoolean = z.boolean().default(true); 1280 + 1281 + /** 1282 + * This is a simple enum that is optional with default value 1283 + */ 1284 + export const zCallWithDefaultOptionalParametersParameterParameterEnum = z.enum([ 1285 + 'Success', 1286 + 'Warning', 1287 + 'Error' 1288 + ]); 1289 + 1290 + /** 1291 + * This is a simple model that is optional with default value 1292 + */ 1293 + export const zCallWithDefaultOptionalParametersParameterParameterModel = zModelWithString; 1294 + 1295 + /** 1296 + * This is a optional string with default 1297 + */ 1298 + export const zCallToTestOrderOfParamsParameterParameterOptionalStringWithDefault = z.string().default('Hello World!'); 1299 + 1300 + /** 1301 + * This is a optional string with empty default 1302 + */ 1303 + export const zCallToTestOrderOfParamsParameterParameterOptionalStringWithEmptyDefault = z.string().default(''); 1304 + 1305 + /** 1306 + * This is a optional string with no default 1307 + */ 1308 + export const zCallToTestOrderOfParamsParameterParameterOptionalStringWithNoDefault = z.string(); 1309 + 1310 + /** 1311 + * This is a string with default 1312 + */ 1313 + export const zCallToTestOrderOfParamsParameterParameterStringWithDefault = z.string().default('Hello World!'); 1314 + 1315 + /** 1316 + * This is a string with empty default 1317 + */ 1318 + export const zCallToTestOrderOfParamsParameterParameterStringWithEmptyDefault = z.string().default(''); 1319 + 1320 + /** 1321 + * This is a string with no default 1322 + */ 1323 + export const zCallToTestOrderOfParamsParameterParameterStringWithNoDefault = z.string(); 1324 + 1325 + /** 1326 + * This is a string that can be null with no default 1327 + */ 1328 + export const zCallToTestOrderOfParamsParameterParameterStringNullableWithNoDefault = z.union([ 1329 + z.string(), 1330 + z.null() 1331 + ]); 1332 + 1333 + /** 1334 + * This is a string that can be null with default 1335 + */ 1336 + export const zCallToTestOrderOfParamsParameterParameterStringNullableWithDefault = z.union([ 1337 + z.string(), 1338 + z.null() 1339 + ]).default(null); 1340 + 1341 + /** 1043 1342 * Success 1044 1343 */ 1045 1344 export const zCallWithNoContentResponseResponse = z.void(); ··· 1073 1372 zModelThatExtendsExtends 1074 1373 ]); 1075 1374 1375 + /** 1376 + * This is an array parameter that is sent as csv format (comma-separated values) 1377 + */ 1378 + export const zCollectionFormatParameterParameterArrayCsv = z.union([ 1379 + z.array(z.string()), 1380 + z.null() 1381 + ]); 1382 + 1383 + /** 1384 + * This is an array parameter that is sent as ssv format (space-separated values) 1385 + */ 1386 + export const zCollectionFormatParameterParameterArraySsv = z.union([ 1387 + z.array(z.string()), 1388 + z.null() 1389 + ]); 1390 + 1391 + /** 1392 + * This is an array parameter that is sent as tsv format (tab-separated values) 1393 + */ 1394 + export const zCollectionFormatParameterParameterArrayTsv = z.union([ 1395 + z.array(z.string()), 1396 + z.null() 1397 + ]); 1398 + 1399 + /** 1400 + * This is an array parameter that is sent as pipes format (pipe-separated values) 1401 + */ 1402 + export const zCollectionFormatParameterParameterArrayPipes = z.union([ 1403 + z.array(z.string()), 1404 + z.null() 1405 + ]); 1406 + 1407 + /** 1408 + * This is an array parameter that is sent as multi format (multiple parameter instances) 1409 + */ 1410 + export const zCollectionFormatParameterParameterArrayMulti = z.union([ 1411 + z.array(z.string()), 1412 + z.null() 1413 + ]); 1414 + 1415 + /** 1416 + * This is a number parameter 1417 + */ 1418 + export const zTypesParameterId = z.number().int(); 1419 + 1420 + /** 1421 + * This is a number parameter 1422 + */ 1423 + export const zTypesParameterParameterNumber = z.number().default(123); 1424 + 1425 + /** 1426 + * This is a string parameter 1427 + */ 1428 + export const zTypesParameterParameterString = z.union([ 1429 + z.string().default('default'), 1430 + z.null() 1431 + ]).default('default'); 1432 + 1433 + /** 1434 + * This is a boolean parameter 1435 + */ 1436 + export const zTypesParameterParameterBoolean = z.union([ 1437 + z.boolean().default(true), 1438 + z.null() 1439 + ]).default(true); 1440 + 1441 + /** 1442 + * This is an object parameter 1443 + */ 1444 + export const zTypesParameterParameterObject = z.union([ 1445 + z.object({}), 1446 + z.null() 1447 + ]).default(null); 1448 + 1449 + /** 1450 + * This is an array parameter 1451 + */ 1452 + export const zTypesParameterParameterArray = z.union([ 1453 + z.array(z.string()), 1454 + z.null() 1455 + ]); 1456 + 1457 + /** 1458 + * This is a dictionary parameter 1459 + */ 1460 + export const zTypesParameterParameterDictionary = z.union([ 1461 + z.object({}), 1462 + z.null() 1463 + ]); 1464 + 1465 + /** 1466 + * This is an enum parameter 1467 + */ 1468 + export const zTypesParameterParameterEnum = z.union([ 1469 + z.literal('Success'), 1470 + z.literal('Warning'), 1471 + z.literal('Error'), 1472 + z.null() 1473 + ]); 1474 + 1076 1475 export const zTypesResponse = z.union([ 1077 1476 z.number(), 1078 1477 z.string(), ··· 1082 1481 1083 1482 export const zUploadFileData = z.string(); 1084 1483 1484 + /** 1485 + * api-version should be required in standalone clients 1486 + */ 1487 + export const zUploadFileParameterApiVersion = z.union([ 1488 + z.string(), 1489 + z.null() 1490 + ]); 1491 + 1085 1492 export const zUploadFileResponse = z.boolean(); 1086 1493 1494 + export const zFileResponseParameterId = z.string(); 1495 + 1496 + /** 1497 + * api-version should be required in standalone clients 1498 + */ 1499 + export const zFileResponseParameterApiVersion = z.string(); 1500 + 1087 1501 /** 1088 1502 * Success 1089 1503 */ 1090 1504 export const zFileResponseResponse = z.string(); 1091 1505 1092 1506 /** 1507 + * Parameter containing object 1508 + */ 1509 + export const zComplexTypesParameterParameterObject = z.object({ 1510 + first: z.object({ 1511 + second: z.object({ 1512 + third: z.string().optional() 1513 + }).optional() 1514 + }).optional() 1515 + }); 1516 + 1517 + /** 1518 + * Parameter containing reference 1519 + */ 1520 + export const zComplexTypesParameterParameterReference = zModelWithString; 1521 + 1522 + /** 1093 1523 * Successful response 1094 1524 */ 1095 1525 export const zComplexTypesResponse = z.array(zModelWithString); ··· 1151 1581 }).readonly().optional() 1152 1582 }); 1153 1583 1584 + export const zComplexParamsParameterId = z.number().int(); 1585 + 1586 + /** 1587 + * api-version should be required in standalone clients 1588 + */ 1589 + export const zComplexParamsParameterApiVersion = z.string(); 1590 + 1154 1591 /** 1155 1592 * Success 1156 1593 */ 1157 1594 export const zComplexParamsResponse = zModelWithString; 1595 + 1596 + /** 1597 + * Status code to return 1598 + */ 1599 + export const zTestErrorCodeParameterStatus = z.number().int(); 1600 + 1601 + /** 1602 + * Dummy input param 1603 + */ 1604 + export const zNonAsciiæøåÆøÅöôêÊ字符串ParameterNonAsciiParamæøåÆøÅöôêÊ = z.number().int(); 1158 1605 1159 1606 /** 1160 1607 * Successful response
+18 -2
packages/openapi-ts-tests/test/__snapshots__/3.1.x/validators/valibot.gen.ts
··· 22 22 23 23 export const vBaz = v.optional(v.pipe(v.pipe(v.string(), v.regex(/foo\nbar/)), v.readonly()), 'baz'); 24 24 25 - export const vFoo2 = v.object({ 25 + /** 26 + * aaaaa 27 + */ 28 + export const vFoo2 = v.string(); 29 + 30 + export const vFoo3 = v.object({ 26 31 foo: v.optional(vBar) 27 32 }); 28 33 ··· 30 35 foo: v.optional(v.string()) 31 36 }); 32 37 33 - export const vPostFooData = vFoo2; 38 + /** 39 + * aaaaa 40 + */ 41 + export const vPatchFooParameterFoo = v.string(); 42 + 43 + export const vPatchFooParameterBar = vBar; 44 + 45 + export const vPatchFooParameterBaz = v.object({ 46 + baz: v.optional(v.string()) 47 + }); 48 + 49 + export const vPostFooData = vFoo3;
+18 -2
packages/openapi-ts-tests/test/__snapshots__/3.1.x/validators/zod.gen.ts
··· 22 22 23 23 export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 24 24 25 - export const zFoo2 = z.object({ 25 + /** 26 + * aaaaa 27 + */ 28 + export const zFoo2 = z.string(); 29 + 30 + export const zFoo3 = z.object({ 26 31 foo: zBar.optional() 27 32 }); 28 33 ··· 30 35 foo: z.string().optional() 31 36 }); 32 37 33 - export const zPostFooData = zFoo2; 38 + /** 39 + * aaaaa 40 + */ 41 + export const zPatchFooParameterFoo = z.string(); 42 + 43 + export const zPatchFooParameterBar = zBar; 44 + 45 + export const zPatchFooParameterBaz = z.object({ 46 + baz: z.string().optional() 47 + }); 48 + 49 + export const zPostFooData = zFoo3;
+2 -2
packages/openapi-ts-tests/test/openapi-ts.config.ts
··· 44 44 // openapi: '3.1.0', 45 45 // paths: {}, 46 46 // }, 47 - path: path.resolve(__dirname, 'spec', '3.1.x', 'validators.yaml'), 47 + path: path.resolve(__dirname, 'spec', '2.0.x', 'full.json'), 48 48 // path: 'http://localhost:4000/', 49 49 // path: 'https://get.heyapi.dev/', 50 50 // path: 'https://get.heyapi.dev/hey-api/backend?branch=main&version=1.0.0', ··· 110 110 // enumsCase: 'camelCase', 111 111 // enumsConstantsIgnoreNull: true, 112 112 // exportInlineEnums: true, 113 - // identifierCase: 'preserve', 113 + identifierCase: 'snake_case', 114 114 name: '@hey-api/typescript', 115 115 // readOnlyWriteOnlyBehavior: 'off', 116 116 // readableNameBuilder: 'Readable{{name}}',
-8
packages/openapi-ts-tests/test/spec/2.0.x/full.json
··· 660 660 "type": "boolean" 661 661 }, 662 662 { 663 - "description": "This is an object parameter", 664 - "name": "parameterObject", 665 - "in": "query", 666 - "required": true, 667 - "default": null, 668 - "type": "object" 669 - }, 670 - { 671 663 "description": "This is an array parameter", 672 664 "name": "parameterArray", 673 665 "in": "query",
+19 -2
packages/openapi-ts-tests/test/spec/3.1.x/validators.yaml
··· 6 6 /foo: 7 7 patch: 8 8 parameters: 9 + - $ref: '#/components/parameters/Foo' 9 10 - in: query 10 - name: foo 11 - required: true 11 + name: bar 12 + required: false 12 13 schema: 13 14 $ref: '#/components/schemas/Bar' 15 + - in: query 16 + name: baz 17 + required: false 18 + schema: 19 + properties: 20 + baz: 21 + type: string 22 + type: object 14 23 requestBody: 15 24 content: 16 25 'application/json': ··· 30 39 '200': 31 40 description: OK 32 41 components: 42 + parameters: 43 + Foo: 44 + description: aaaaa 45 + name: foo 46 + in: query 47 + required: false 48 + schema: 49 + type: string 33 50 requestBodies: 34 51 Foo: 35 52 required: true
+27 -7
packages/openapi-ts/src/plugins/shared/utils/ref.ts
··· 9 9 id: string; 10 10 } 11 11 12 + // TODO: this needs refactor 12 13 export const operationIrRef = ({ 13 14 case: _case = 'PascalCase', 14 15 config, 15 16 id, 17 + parameterId, 16 18 type, 17 19 }: OperationIRRef & { 18 20 readonly case?: StringCase; 19 21 config: Pick<Config, 'plugins'>; 20 - type: 'data' | 'error' | 'errors' | 'response' | 'responses'; 22 + parameterId?: string; 23 + type: 'data' | 'error' | 'errors' | 'parameter' | 'response' | 'responses'; 21 24 }): string => { 22 25 let affix = ''; 23 26 switch (type) { 24 27 case 'data': 25 28 case 'error': // error union 26 29 case 'errors': // errors map 30 + case 'parameter': 27 31 case 'response': // response union 28 32 case 'responses': // responses map 29 33 affix = `${(type[0] ?? '').toLocaleUpperCase()}${type.slice(1)}`; 30 34 break; 31 35 } 32 - let separator = true; 36 + let separate = true; 33 37 if (config.plugins['@hey-api/typescript']?.identifierCase === 'preserve') { 34 - separator = false; 38 + separate = false; 35 39 } 36 - return `${irRef}${stringCase({ 37 - case: _case, 38 - value: id, 39 - })}${separator ? '-' : ''}${affix}`; 40 + const separator = separate ? '-' : ''; 41 + const parts: Array<string> = [ 42 + irRef, 43 + stringCase({ 44 + case: _case, 45 + value: id, 46 + }), 47 + separator, 48 + affix, 49 + ]; 50 + if (parameterId) { 51 + parts.push(separator); 52 + parts.push( 53 + stringCase({ 54 + case: _case, 55 + value: parameterId, 56 + }), 57 + ); 58 + } 59 + return parts.join(''); 40 60 };
+37
packages/openapi-ts/src/plugins/valibot/plugin.ts
··· 863 863 }); 864 864 } 865 865 866 + if (operation.parameters) { 867 + for (const type in operation.parameters) { 868 + const group = operation.parameters[type as keyof IR.ParametersObject]!; 869 + for (const key in group) { 870 + const parameter = group[key]!; 871 + schemaToValibotSchema({ 872 + $ref: operationIrRef({ 873 + case: 'camelCase', 874 + config: context.config, 875 + id: operation.id, 876 + parameterId: parameter.name, 877 + type: 'parameter', 878 + }), 879 + context, 880 + plugin, 881 + result, 882 + schema: parameter.schema, 883 + }); 884 + } 885 + } 886 + } 887 + 866 888 if (operation.responses) { 867 889 const { response } = operationResponsesMap(operation); 868 890 ··· 1149 1171 operation, 1150 1172 plugin, 1151 1173 result, 1174 + }); 1175 + }); 1176 + 1177 + context.subscribe('parameter', ({ $ref, parameter }) => { 1178 + const result: Result = { 1179 + circularReferenceTracker: new Set(), 1180 + hasCircularReference: false, 1181 + }; 1182 + 1183 + schemaToValibotSchema({ 1184 + $ref, 1185 + context, 1186 + plugin, 1187 + result, 1188 + schema: parameter.schema, 1152 1189 }); 1153 1190 }); 1154 1191
+37
packages/openapi-ts/src/plugins/zod/plugin.ts
··· 830 830 }); 831 831 } 832 832 833 + if (operation.parameters) { 834 + for (const type in operation.parameters) { 835 + const group = operation.parameters[type as keyof IR.ParametersObject]!; 836 + for (const key in group) { 837 + const parameter = group[key]!; 838 + schemaToZodSchema({ 839 + $ref: operationIrRef({ 840 + case: 'camelCase', 841 + config: context.config, 842 + id: operation.id, 843 + parameterId: parameter.name, 844 + type: 'parameter', 845 + }), 846 + context, 847 + plugin, 848 + result, 849 + schema: parameter.schema, 850 + }); 851 + } 852 + } 853 + } 854 + 833 855 if (operation.responses) { 834 856 const { response } = operationResponsesMap(operation); 835 857 ··· 1113 1135 operation, 1114 1136 plugin, 1115 1137 result, 1138 + }); 1139 + }); 1140 + 1141 + context.subscribe('parameter', ({ $ref, parameter }) => { 1142 + const result: Result = { 1143 + circularReferenceTracker: new Set(), 1144 + hasCircularReference: false, 1145 + }; 1146 + 1147 + schemaToZodSchema({ 1148 + $ref, 1149 + context, 1150 + plugin, 1151 + result, 1152 + schema: parameter.schema, 1116 1153 }); 1117 1154 }); 1118 1155