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

Merge pull request #2997 from hey-api/refactor/dsl-type-nodes-6

refactor: valibot plugin use dsl

authored by

Lubos and committed by
GitHub
595ae0ed 7b9a4d05

+1026 -2090
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/valibot.gen.ts
··· 8 8 v.number(), 9 9 v.string(), 10 10 v.bigint() 11 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), BigInt(0)), 11 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), BigInt(0)), 12 12 id: v.string() 13 13 }); 14 14
+47 -69
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/valibot/default/valibot.gen.ts
··· 74 74 * This is a simple enum with strings 75 75 */ 76 76 export const vEnumWithStrings = v.picklist([ 77 - 'Success', 78 - 'Warning', 79 - 'Error', 77 + "Success", 78 + "Warning", 79 + "Error", 80 80 "'Single Quote'", 81 - '"Double Quotes"', 82 - 'Non-ascii: øæåôöØÆÅÔÖ字符串' 81 + "\"Double Quotes\"", 82 + "Non-ascii: øæåôöØÆÅÔÖ字符串" 83 83 ]); 84 84 85 85 /** ··· 197 197 * This is a model with one string property 198 198 */ 199 199 export const vModelWithNullableString = v.object({ 200 - nullableProp: v.optional(v.union([ 201 - v.string(), 202 - v.null() 203 - ])), 204 - nullableRequiredProp: v.union([ 205 - v.string(), 206 - v.null() 207 - ]) 200 + nullableProp: v.optional(v.union([v.string(), v.null()])), 201 + nullableRequiredProp: v.union([v.string(), v.null()]) 208 202 }); 209 203 210 204 /** ··· 212 206 */ 213 207 export const vModelWithEnum = v.object({ 214 208 test: v.optional(v.picklist([ 215 - 'Success', 216 - 'Warning', 217 - 'Error', 218 - 'ØÆÅ字符串' 209 + "Success", 210 + "Warning", 211 + "Error", 212 + "ØÆÅ字符串" 219 213 ])), 220 214 statusCode: v.optional(v.picklist([ 221 - '100', 222 - '200 FOO', 223 - '300 FOO_BAR', 224 - '400 foo-bar', 225 - '500 foo.bar', 226 - '600 foo&bar' 215 + "100", 216 + "200 FOO", 217 + "300 FOO_BAR", 218 + "400 foo-bar", 219 + "500 foo.bar", 220 + "600 foo&bar" 227 221 ])), 228 222 bool: v.optional(v.unknown()) 229 223 }); ··· 240 234 */ 241 235 export const vModelWithNestedEnums = v.object({ 242 236 dictionaryWithEnum: v.optional(v.record(v.string(), v.picklist([ 243 - 'Success', 244 - 'Warning', 245 - 'Error' 237 + "Success", 238 + "Warning", 239 + "Error" 246 240 ]))), 247 241 dictionaryWithEnumFromDescription: v.optional(v.record(v.string(), v.pipe(v.number(), v.integer()))), 248 242 arrayWithEnum: v.optional(v.array(v.picklist([ 249 - 'Success', 250 - 'Warning', 251 - 'Error' 243 + "Success", 244 + "Warning", 245 + "Error" 252 246 ]))), 253 247 arrayWithDescription: v.optional(v.array(v.pipe(v.number(), v.integer()))) 254 248 }); ··· 273 267 * This is a model with one property containing a circular reference 274 268 */ 275 269 export const vModelWithCircularReference: v.GenericSchema = v.object({ 276 - prop: v.optional(v.lazy(() => { 277 - return vModelWithCircularReference; 278 - })) 270 + prop: v.optional(v.lazy(() => vModelWithCircularReference)) 279 271 }); 280 272 281 273 /** ··· 341 333 /** 342 334 * This is a model that extends another model 343 335 */ 344 - export const vModelThatExtends = v.intersect([ 345 - vModelWithString, 346 - v.object({ 336 + export const vModelThatExtends = v.intersect([vModelWithString, v.object({ 347 337 propExtendsA: v.optional(v.string()), 348 338 propExtendsB: v.optional(vModelWithString) 349 - }) 350 - ]); 339 + })]); 351 340 352 341 /** 353 342 * This is a model that extends another model ··· 553 542 body: v.optional(v.never()), 554 543 path: v.optional(v.never()), 555 544 query: v.object({ 556 - parameterString: v.optional(v.string(), 'Hello World!'), 545 + parameterString: v.optional(v.string(), "Hello World!"), 557 546 parameterNumber: v.optional(v.number(), 123), 558 547 parameterBoolean: v.optional(v.boolean(), true), 559 548 parameterEnum: v.picklist([ 560 - 'Success', 561 - 'Warning', 562 - 'Error' 549 + "Success", 550 + "Warning", 551 + "Error" 563 552 ]), 564 553 parameterModel: v.optional(v.object({ 565 554 prop: v.optional(v.string()) 566 - }), { 567 - prop: 'Hello World!' 568 - }) 555 + }), { prop: "Hello World!" }) 569 556 }) 570 557 }); 571 558 ··· 573 560 body: v.optional(v.never()), 574 561 path: v.optional(v.never()), 575 562 query: v.optional(v.object({ 576 - parameterString: v.optional(v.string(), 'Hello World!'), 563 + parameterString: v.optional(v.string(), "Hello World!"), 577 564 parameterNumber: v.optional(v.number(), 123), 578 565 parameterBoolean: v.optional(v.boolean(), true), 579 566 parameterEnum: v.optional(v.picklist([ 580 - 'Success', 581 - 'Warning', 582 - 'Error' 567 + "Success", 568 + "Warning", 569 + "Error" 583 570 ])) 584 571 })) 585 572 }); ··· 588 575 body: v.optional(v.never()), 589 576 path: v.optional(v.never()), 590 577 query: v.object({ 591 - parameterOptionalStringWithDefault: v.optional(v.string(), 'Hello World!'), 592 - parameterOptionalStringWithEmptyDefault: v.optional(v.string(), ''), 578 + parameterOptionalStringWithDefault: v.optional(v.string(), "Hello World!"), 579 + parameterOptionalStringWithEmptyDefault: v.optional(v.string(), ""), 593 580 parameterOptionalStringWithNoDefault: v.optional(v.string()), 594 - parameterStringWithDefault: v.optional(v.string(), 'Hello World!'), 595 - parameterStringWithEmptyDefault: v.optional(v.string(), ''), 581 + parameterStringWithDefault: v.optional(v.string(), "Hello World!"), 582 + parameterStringWithEmptyDefault: v.optional(v.string(), ""), 596 583 parameterStringWithNoDefault: v.string(), 597 - parameterStringNullableWithNoDefault: v.optional(v.union([ 598 - v.string(), 599 - v.null() 600 - ])), 601 - parameterStringNullableWithDefault: v.optional(v.union([ 602 - v.string(), 603 - v.null() 604 - ]), null) 584 + parameterStringNullableWithNoDefault: v.optional(v.union([v.string(), v.null()])), 585 + parameterStringNullableWithDefault: v.optional(v.union([v.string(), v.null()]), null) 605 586 }) 606 587 }); 607 588 ··· 641 622 query: v.optional(v.never()) 642 623 }); 643 624 644 - export const vCallWithResponseAndNoContentResponseResponse = v.union([ 645 - v.number(), 646 - v.unknown() 647 - ]); 625 + export const vCallWithResponseAndNoContentResponseResponse = v.union([v.number(), v.unknown()]); 648 626 649 627 export const vDummyAData = v.object({ 650 628 body: v.optional(v.never()), ··· 711 689 export const vTypesData = v.object({ 712 690 body: v.optional(v.never()), 713 691 path: v.optional(v.object({ 714 - id: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2^31'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2^31-1'))) 692 + id: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, "Invalid value: Expected int32 to be >= -2^31"), v.maxValue(2147483647, "Invalid value: Expected int32 to be <= 2^31-1"))) 715 693 })), 716 694 query: v.object({ 717 695 parameterNumber: v.optional(v.number(), 123), 718 - parameterString: v.optional(v.string(), 'default'), 696 + parameterString: v.optional(v.string(), "default"), 719 697 parameterBoolean: v.optional(v.boolean(), true), 720 698 parameterArray: v.array(v.string()), 721 699 parameterDictionary: v.record(v.string(), v.unknown()), 722 700 parameterEnum: v.picklist([ 723 - 'Success', 724 - 'Warning', 725 - 'Error' 701 + "Success", 702 + "Warning", 703 + "Error" 726 704 ]) 727 705 }) 728 706 });
+3 -12
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-null/valibot.gen.ts
··· 2 2 3 3 import * as v from 'valibot'; 4 4 5 - export const vFoo = v.nullable(v.picklist([ 6 - 'foo', 7 - 'bar' 8 - ])); 5 + export const vFoo = v.nullable(v.picklist(["foo", "bar"])); 9 6 10 - export const vBar = v.picklist([ 11 - 'foo', 12 - 'bar' 13 - ]); 7 + export const vBar = v.picklist(["foo", "bar"]); 14 8 15 - export const vBaz = v.picklist([ 16 - 'foo', 17 - 'bar' 18 - ]); 9 + export const vBaz = v.picklist(["foo", "bar"]);
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/valibot.gen.ts
··· 8 8 v.number(), 9 9 v.string(), 10 10 v.bigint() 11 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), BigInt(0)), 11 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), BigInt(0)), 12 12 id: v.string() 13 13 }); 14 14
+164 -487
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/valibot/default/valibot.gen.ts
··· 81 81 /** 82 82 * This is a simple string 83 83 */ 84 - export const vSimpleStringWithPattern = v.union([ 85 - v.pipe(v.string(), v.maxLength(64), v.regex(/^[a-zA-Z0-9_]*$/)), 86 - v.null() 87 - ]); 84 + export const vSimpleStringWithPattern = v.union([v.pipe(v.string(), v.maxLength(64), v.regex(/^[a-zA-Z0-9_]*$/)), v.null()]); 88 85 89 86 /** 90 87 * This is a simple enum with strings 91 88 */ 92 89 export const vEnumWithStrings = v.picklist([ 93 - 'Success', 94 - 'Warning', 95 - 'Error', 90 + "Success", 91 + "Warning", 92 + "Error", 96 93 "'Single Quote'", 97 - '"Double Quotes"', 98 - 'Non-ascii: øæåôöØÆÅÔÖ字符串' 94 + "\"Double Quotes\"", 95 + "Non-ascii: øæåôöØÆÅÔÖ字符串" 99 96 ]); 100 97 101 98 export const vEnumWithReplacedCharacters = v.picklist([ 102 99 "'Single Quote'", 103 - '"Double Quotes"', 104 - 'øæåôöØÆÅÔÖ字符串', 105 - '' 100 + "\"Double Quotes\"", 101 + "øæåôöØÆÅÔÖ字符串", 102 + "" 106 103 ]); 107 104 108 105 /** ··· 135 132 /** 136 133 * This is a simple array with strings 137 134 */ 138 - export const vArrayWithStrings = v.optional(v.array(v.string()), ['test']); 135 + export const vArrayWithStrings = v.optional(v.array(v.string()), ["test"]); 139 136 140 137 /** 141 138 * This is a simple array with properties ··· 246 243 * This is a model with one string property 247 244 */ 248 245 export const vModelWithNullableString = v.object({ 249 - nullableProp1: v.optional(v.union([ 250 - v.string(), 251 - v.null() 252 - ])), 253 - nullableRequiredProp1: v.union([ 254 - v.string(), 255 - v.null() 256 - ]), 257 - nullableProp2: v.optional(v.union([ 258 - v.string(), 259 - v.null() 260 - ])), 261 - nullableRequiredProp2: v.union([ 262 - v.string(), 263 - v.null() 264 - ]), 246 + nullableProp1: v.optional(v.union([v.string(), v.null()])), 247 + nullableRequiredProp1: v.union([v.string(), v.null()]), 248 + nullableProp2: v.optional(v.union([v.string(), v.null()])), 249 + nullableRequiredProp2: v.union([v.string(), v.null()]), 265 250 'foo_bar-enum': v.optional(v.picklist([ 266 - 'Success', 267 - 'Warning', 268 - 'Error', 269 - 'ØÆÅ字符串' 251 + "Success", 252 + "Warning", 253 + "Error", 254 + "ØÆÅ字符串" 270 255 ])) 271 256 }); 272 257 ··· 275 260 */ 276 261 export const vModelWithEnum = v.object({ 277 262 'foo_bar-enum': v.optional(v.picklist([ 278 - 'Success', 279 - 'Warning', 280 - 'Error', 281 - 'ØÆÅ字符串' 263 + "Success", 264 + "Warning", 265 + "Error", 266 + "ØÆÅ字符串" 282 267 ])), 283 268 statusCode: v.optional(v.picklist([ 284 - '100', 285 - '200 FOO', 286 - '300 FOO_BAR', 287 - '400 foo-bar', 288 - '500 foo.bar', 289 - '600 foo&bar' 269 + "100", 270 + "200 FOO", 271 + "300 FOO_BAR", 272 + "400 foo-bar", 273 + "500 foo.bar", 274 + "600 foo&bar" 290 275 ])), 291 276 bool: v.optional(v.unknown()) 292 277 }); ··· 295 280 * This is a model with one enum with escaped name 296 281 */ 297 282 export const vModelWithEnumWithHyphen = v.object({ 298 - 'foo-bar-baz-qux': v.optional(v.picklist([ 299 - '3.0' 300 - ])) 283 + 'foo-bar-baz-qux': v.optional(v.picklist(["3.0"])) 301 284 }); 302 285 303 286 /** ··· 312 295 */ 313 296 export const vModelWithNestedEnums = v.object({ 314 297 dictionaryWithEnum: v.optional(v.record(v.string(), v.picklist([ 315 - 'Success', 316 - 'Warning', 317 - 'Error' 298 + "Success", 299 + "Warning", 300 + "Error" 318 301 ]))), 319 302 dictionaryWithEnumFromDescription: v.optional(v.record(v.string(), v.pipe(v.number(), v.integer()))), 320 303 arrayWithEnum: v.optional(v.array(v.picklist([ 321 - 'Success', 322 - 'Warning', 323 - 'Error' 304 + "Success", 305 + "Warning", 306 + "Error" 324 307 ]))), 325 308 arrayWithDescription: v.optional(v.array(v.pipe(v.number(), v.integer()))), 326 309 'foo_bar-enum': v.optional(v.picklist([ 327 - 'Success', 328 - 'Warning', 329 - 'Error', 330 - 'ØÆÅ字符串' 310 + "Success", 311 + "Warning", 312 + "Error", 313 + "ØÆÅ字符串" 331 314 ])) 332 315 }); 333 316 ··· 360 343 * This is a model with one property containing a circular reference 361 344 */ 362 345 export const vModelWithCircularReference: v.GenericSchema = v.object({ 363 - prop: v.optional(v.lazy(() => { 364 - return vModelWithCircularReference; 365 - })) 346 + prop: v.optional(v.lazy(() => vModelWithCircularReference)) 366 347 }); 367 348 368 349 /** ··· 409 390 /** 410 391 * This is a model with one property with a 'one of' relationship where the options are not $ref 411 392 */ 412 - export const vCompositionWithOneOfDiscriminator = v.union([ 413 - v.intersect([ 414 - v.object({ 393 + export const vCompositionWithOneOfDiscriminator = v.union([v.intersect([v.object({ 415 394 kind: v.literal("circle") 416 - }), 417 - vModelCircle 418 - ]), 419 - v.intersect([ 420 - v.object({ 395 + }), vModelCircle]), v.intersect([v.object({ 421 396 kind: v.literal("square") 422 - }), 423 - vModelSquare 424 - ]) 425 - ]); 397 + }), vModelSquare])]); 426 398 427 399 /** 428 400 * This is a model with one property with a 'any of' relationship ··· 453 425 * This is a model with nested 'any of' property with a type null 454 426 */ 455 427 export const vCompositionWithNestedAnyAndTypeNull = v.object({ 456 - propA: v.optional(v.union([ 457 - v.array(v.union([ 458 - vModelWithDictionary, 459 - v.null() 460 - ])), 461 - v.array(v.union([ 462 - vModelWithArray, 463 - v.null() 464 - ])) 465 - ])) 428 + propA: v.optional(v.union([v.array(v.union([vModelWithDictionary, v.null()])), v.array(v.union([vModelWithArray, v.null()]))])) 466 429 }); 467 430 468 - export const v3eNum1Период = v.picklist([ 469 - 'Bird', 470 - 'Dog' 471 - ]); 431 + export const v3eNum1Период = v.picklist(["Bird", "Dog"]); 472 432 473 - export const vConstValue = v.picklist([ 474 - 'ConstValue' 475 - ]); 433 + export const vConstValue = v.picklist(["ConstValue"]); 476 434 477 435 /** 478 436 * This is a model with one property with a 'any of' relationship where the options are not $ref 479 437 */ 480 438 export const vCompositionWithNestedAnyOfAndNull = v.object({ 481 - propA: v.optional(v.union([ 482 - v.array(v.unknown()), 483 - v.null() 484 - ])) 439 + propA: v.optional(v.union([v.array(v.unknown()), v.null()])) 485 440 }); 486 441 487 442 /** ··· 503 458 * This is a model that contains a simple dictionary within composition 504 459 */ 505 460 export const vCompositionWithOneOfAndSimpleDictionary = v.object({ 506 - propA: v.optional(v.union([ 507 - v.boolean(), 508 - v.record(v.string(), v.number()) 509 - ])) 461 + propA: v.optional(v.union([v.boolean(), v.record(v.string(), v.number())])) 510 462 }); 511 463 512 464 /** 513 465 * This is a model that contains a dictionary of simple arrays within composition 514 466 */ 515 467 export const vCompositionWithOneOfAndSimpleArrayDictionary = v.object({ 516 - propA: v.optional(v.union([ 517 - v.boolean(), 518 - v.record(v.string(), v.array(v.boolean())) 519 - ])) 468 + propA: v.optional(v.union([v.boolean(), v.record(v.string(), v.array(v.boolean()))])) 520 469 }); 521 470 522 471 /** 523 472 * This is a model that contains a dictionary of complex arrays (composited) within composition 524 473 */ 525 474 export const vCompositionWithOneOfAndComplexArrayDictionary = v.object({ 526 - propA: v.optional(v.union([ 527 - v.boolean(), 528 - v.record(v.string(), v.array(v.unknown())) 529 - ])) 475 + propA: v.optional(v.union([v.boolean(), v.record(v.string(), v.array(v.unknown()))])) 530 476 }); 531 477 532 478 /** 533 479 * This is a model with one property with a 'all of' relationship 534 480 */ 535 481 export const vCompositionWithAllOfAndNullable = v.object({ 536 - propA: v.optional(v.union([ 537 - v.intersect([ 482 + propA: v.optional(v.union([v.intersect([ 538 483 v.object({ 539 484 boolean: v.optional(v.boolean()) 540 485 }), 541 486 vModelWithEnum, 542 487 vModelWithArray, 543 488 vModelWithDictionary 544 - ]), 545 - v.null() 546 - ])) 489 + ]), v.null()])) 547 490 }); 548 491 549 492 /** ··· 572 515 /** 573 516 * This is a model that extends the base model 574 517 */ 575 - export const vCompositionExtendedModel = v.intersect([ 576 - vCompositionBaseModel, 577 - v.object({ 518 + export const vCompositionExtendedModel = v.intersect([vCompositionBaseModel, v.object({ 578 519 age: v.number(), 579 520 firstName: v.string(), 580 521 lastname: v.string() 581 - }) 582 - ]); 522 + })]); 583 523 584 524 /** 585 525 * This is a model with one nested property ··· 587 527 export const vModelWithProperties = v.object({ 588 528 required: v.string(), 589 529 requiredAndReadOnly: v.pipe(v.string(), v.readonly()), 590 - requiredAndNullable: v.union([ 591 - v.string(), 592 - v.null() 593 - ]), 530 + requiredAndNullable: v.union([v.string(), v.null()]), 594 531 string: v.optional(v.string()), 595 532 number: v.optional(v.number()), 596 533 boolean: v.optional(v.boolean()), ··· 613 550 * This is a model with one nested property 614 551 */ 615 552 export const vModelWithNestedProperties = v.object({ 616 - first: v.pipe(v.union([ 617 - v.pipe(v.object({ 618 - second: v.pipe(v.union([ 619 - v.pipe(v.object({ 620 - third: v.pipe(v.union([ 621 - v.pipe(v.string(), v.readonly()), 622 - v.null() 623 - ]), v.readonly()) 624 - }), v.readonly()), 625 - v.null() 626 - ]), v.readonly()) 627 - }), v.readonly()), 628 - v.null() 629 - ]), v.readonly()) 553 + first: v.pipe(v.union([v.pipe(v.object({ 554 + second: v.pipe(v.union([v.pipe(v.object({ 555 + third: v.pipe(v.union([v.pipe(v.string(), v.readonly()), v.null()]), v.readonly()) 556 + }), v.readonly()), v.null()]), v.readonly()) 557 + }), v.readonly()), v.null()]), v.readonly()) 630 558 }); 631 559 632 560 /** ··· 657 585 /** 658 586 * This is a model that extends another model 659 587 */ 660 - export const vModelThatExtends = v.intersect([ 661 - vModelWithString, 662 - v.object({ 588 + export const vModelThatExtends = v.intersect([vModelWithString, v.object({ 663 589 propExtendsA: v.optional(v.string()), 664 590 propExtendsB: v.optional(vModelWithString) 665 - }) 666 - ]); 591 + })]); 667 592 668 593 /** 669 594 * This is a model that extends another model ··· 705 630 }); 706 631 707 632 export const vPageable = v.object({ 708 - page: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2^31'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2^31-1'), v.minValue(0)), 0), 709 - size: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2^31'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2^31-1'), v.minValue(1))), 633 + page: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, "Invalid value: Expected int32 to be >= -2^31"), v.maxValue(2147483647, "Invalid value: Expected int32 to be <= 2^31-1"), v.minValue(0)), 0), 634 + size: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, "Invalid value: Expected int32 to be >= -2^31"), v.maxValue(2147483647, "Invalid value: Expected int32 to be <= 2^31-1"), v.minValue(1))), 710 635 sort: v.optional(v.array(v.string())) 711 636 }); 712 637 ··· 726 651 export const vFreeFormObjectWithAdditionalPropertiesEqEmptyObject = v.record(v.string(), v.unknown()); 727 652 728 653 export const vModelWithConst = v.object({ 729 - String: v.optional(v.picklist([ 730 - 'String' 731 - ])), 654 + String: v.optional(v.picklist(["String"])), 732 655 number: v.optional(v.unknown()), 733 656 null: v.optional(v.unknown()), 734 - withType: v.optional(v.picklist([ 735 - 'Some string' 736 - ])) 657 + withType: v.optional(v.picklist(["Some string"])) 737 658 }); 738 659 739 660 /** ··· 744 665 }, v.unknown()); 745 666 746 667 export const vNestedAnyOfArraysNullable = v.object({ 747 - nullableArray: v.optional(v.union([ 748 - v.array(v.unknown()), 749 - v.null() 750 - ])) 668 + nullableArray: v.optional(v.union([v.array(v.unknown()), v.null()])) 751 669 }); 752 670 753 671 /** 754 672 * An object that can be null 755 673 */ 756 - export const vNullableObject = v.optional(v.union([ 757 - v.object({ 674 + export const vNullableObject = v.optional(v.union([v.object({ 758 675 foo: v.optional(v.string()) 759 - }), 760 - v.null() 761 - ]), null); 676 + }), v.null()]), null); 762 677 763 678 /** 764 679 * Some % character ··· 771 686 772 687 export const vModelWithOneOfEnum = v.union([ 773 688 v.object({ 774 - foo: v.picklist([ 775 - 'Bar' 776 - ]) 689 + foo: v.picklist(["Bar"]) 777 690 }), 778 691 v.object({ 779 - foo: v.picklist([ 780 - 'Baz' 781 - ]) 692 + foo: v.picklist(["Baz"]) 782 693 }), 783 694 v.object({ 784 - foo: v.picklist([ 785 - 'Qux' 786 - ]) 695 + foo: v.picklist(["Qux"]) 787 696 }), 788 697 v.object({ 789 698 content: v.pipe(v.string(), v.isoTimestamp()), 790 - foo: v.picklist([ 791 - 'Quux' 792 - ]) 699 + foo: v.picklist(["Quux"]) 793 700 }), 794 701 v.object({ 795 - content: v.tuple([ 796 - v.pipe(v.string(), v.isoTimestamp()), 797 - v.pipe(v.string(), v.isoTimestamp()) 798 - ]), 799 - foo: v.picklist([ 800 - 'Corge' 801 - ]) 702 + content: v.tuple([v.pipe(v.string(), v.isoTimestamp()), v.pipe(v.string(), v.isoTimestamp())]), 703 + foo: v.picklist(["Corge"]) 802 704 }) 803 705 ]); 804 706 805 - export const vModelWithNestedArrayEnumsDataFoo = v.picklist([ 806 - 'foo', 807 - 'bar' 808 - ]); 707 + export const vModelWithNestedArrayEnumsDataFoo = v.picklist(["foo", "bar"]); 809 708 810 - export const vModelWithNestedArrayEnumsDataBar = v.picklist([ 811 - 'baz', 812 - 'qux' 813 - ]); 709 + export const vModelWithNestedArrayEnumsDataBar = v.picklist(["baz", "qux"]); 814 710 815 711 export const vModelWithNestedArrayEnumsData = v.object({ 816 712 foo: v.optional(v.array(vModelWithNestedArrayEnumsDataFoo)), ··· 840 736 propWithNumber: v.optional(v.array(v.number())) 841 737 }); 842 738 843 - export const vModelWithConstantSizeArray = v.tuple([ 844 - v.number(), 845 - v.number() 846 - ]); 739 + export const vModelWithConstantSizeArray = v.tuple([v.number(), v.number()]); 847 740 848 741 export const vModelWithAnyOfConstantSizeArray = v.tuple([ 849 - v.union([ 850 - v.number(), 851 - v.string() 852 - ]), 853 - v.union([ 854 - v.number(), 855 - v.string() 856 - ]), 857 - v.union([ 858 - v.number(), 859 - v.string() 860 - ]) 742 + v.union([v.number(), v.string()]), 743 + v.union([v.number(), v.string()]), 744 + v.union([v.number(), v.string()]) 861 745 ]); 862 746 863 747 export const vModelWithPrefixItemsConstantSizeArray = v.array(v.unknown()); ··· 880 764 ]) 881 765 ]); 882 766 883 - export const vModelWithAnyOfConstantSizeArrayAndIntersect = v.tuple([ 884 - v.intersect([ 885 - v.number(), 886 - v.string() 887 - ]), 888 - v.intersect([ 889 - v.number(), 890 - v.string() 891 - ]) 892 - ]); 767 + export const vModelWithAnyOfConstantSizeArrayAndIntersect = v.tuple([v.intersect([v.number(), v.string()]), v.intersect([v.number(), v.string()])]); 893 768 894 769 export const vModelWithNumericEnumUnion = v.object({ 895 770 value: v.optional(v.unknown()) ··· 932 807 */ 933 808 export const vImport = v.string(); 934 809 935 - export const vModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = v.tuple([ 936 - v.union([ 937 - v.number(), 938 - vImport 939 - ]), 940 - v.union([ 941 - v.number(), 942 - vImport 943 - ]) 944 - ]); 810 + export const vModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = v.tuple([v.union([v.number(), vImport]), v.union([v.number(), vImport])]); 945 811 946 812 export const vSchemaWithFormRestrictedKeys = v.object({ 947 813 description: v.optional(v.string()), ··· 984 850 985 851 export const vAdditionalPropertiesUnknownIssue2 = v.object({}); 986 852 987 - export const vAdditionalPropertiesUnknownIssue3 = v.intersect([ 988 - v.string(), 989 - v.object({ 853 + export const vAdditionalPropertiesUnknownIssue3 = v.intersect([v.string(), v.object({ 990 854 entries: v.object({}) 991 - }) 992 - ]); 855 + })]); 993 856 994 857 export const vAdditionalPropertiesIntegerIssue = v.objectWithRest({ 995 858 value: v.pipe(v.number(), v.integer()) ··· 997 860 998 861 export const vGenericSchemaDuplicateIssue1SystemBoolean = v.strictObject({ 999 862 item: v.optional(v.boolean()), 1000 - error: v.optional(v.union([ 1001 - v.string(), 1002 - v.null() 1003 - ])), 863 + error: v.optional(v.union([v.string(), v.null()])), 1004 864 hasError: v.optional(v.pipe(v.boolean(), v.readonly())), 1005 865 data: v.optional(v.strictObject({})) 1006 866 }); 1007 867 1008 868 export const vGenericSchemaDuplicateIssue1SystemString = v.strictObject({ 1009 - item: v.optional(v.union([ 1010 - v.string(), 1011 - v.null() 1012 - ])), 1013 - error: v.optional(v.union([ 1014 - v.string(), 1015 - v.null() 1016 - ])), 869 + item: v.optional(v.union([v.string(), v.null()])), 870 + error: v.optional(v.union([v.string(), v.null()])), 1017 871 hasError: v.optional(v.pipe(v.boolean(), v.readonly())) 1018 872 }); 1019 873 1020 - export const vOneOfAllOfIssue = v.union([ 1021 - v.intersect([ 1022 - v.union([ 1023 - vConstValue, 1024 - vGenericSchemaDuplicateIssue1SystemBoolean 1025 - ]), 1026 - v3eNum1Период 1027 - ]), 1028 - vGenericSchemaDuplicateIssue1SystemString 1029 - ]); 874 + export const vOneOfAllOfIssue = v.union([v.intersect([v.union([vConstValue, vGenericSchemaDuplicateIssue1SystemBoolean]), v3eNum1Период]), vGenericSchemaDuplicateIssue1SystemString]); 1030 875 1031 876 export const vExternalSharedExternalSharedModel = v.object({ 1032 877 id: v.string(), ··· 1042 887 */ 1043 888 export const vModelWithPropertiesWritable = v.object({ 1044 889 required: v.string(), 1045 - requiredAndNullable: v.union([ 1046 - v.string(), 1047 - v.null() 1048 - ]), 890 + requiredAndNullable: v.union([v.string(), v.null()]), 1049 891 string: v.optional(v.string()), 1050 892 number: v.optional(v.number()), 1051 893 boolean: v.optional(v.boolean()), ··· 1093 935 propWithNumber: v.optional(v.array(v.number())) 1094 936 }); 1095 937 1096 - export const vModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = v.tuple([ 1097 - v.union([ 1098 - v.number(), 1099 - vImport 1100 - ]), 1101 - v.union([ 1102 - v.number(), 1103 - vImport 1104 - ]) 1105 - ]); 938 + export const vModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = v.tuple([v.union([v.number(), vImport]), v.union([v.number(), vImport])]); 1106 939 1107 940 export const vAdditionalPropertiesUnknownIssueWritable = v.object({}); 1108 941 1109 - export const vOneOfAllOfIssueWritable = v.union([ 1110 - v.intersect([ 1111 - v.union([ 1112 - vConstValue, 1113 - vGenericSchemaDuplicateIssue1SystemBoolean 1114 - ]), 1115 - v3eNum1Период 1116 - ]), 1117 - vGenericSchemaDuplicateIssue1SystemString 1118 - ]); 942 + export const vOneOfAllOfIssueWritable = v.union([v.intersect([v.union([vConstValue, vGenericSchemaDuplicateIssue1SystemBoolean]), v3eNum1Период]), vGenericSchemaDuplicateIssue1SystemString]); 1119 943 1120 944 export const vGenericSchemaDuplicateIssue1SystemBooleanWritable = v.strictObject({ 1121 945 item: v.optional(v.boolean()), 1122 - error: v.optional(v.union([ 1123 - v.string(), 1124 - v.null() 1125 - ])), 946 + error: v.optional(v.union([v.string(), v.null()])), 1126 947 data: v.optional(v.strictObject({})) 1127 948 }); 1128 949 1129 950 export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.strictObject({ 1130 - item: v.optional(v.union([ 1131 - v.string(), 1132 - v.null() 1133 - ])), 1134 - error: v.optional(v.union([ 1135 - v.string(), 1136 - v.null() 1137 - ])) 951 + item: v.optional(v.union([v.string(), v.null()])), 952 + error: v.optional(v.union([v.string(), v.null()])) 1138 953 }); 1139 954 1140 955 /** ··· 1142 957 */ 1143 958 export const vSimpleParameter = v.string(); 1144 959 1145 - export const vCompositionWithOneOfAndProperties = v.intersect([ 1146 - v.union([ 1147 - v.strictObject({ 960 + export const vCompositionWithOneOfAndProperties = v.intersect([v.union([v.strictObject({ 1148 961 foo: vSimpleParameter 1149 - }), 1150 - v.strictObject({ 962 + }), v.strictObject({ 1151 963 bar: vNonAsciiStringæøåÆøÅöôêÊ字符串 1152 - }) 1153 - ]), 1154 - v.object({ 1155 - baz: v.union([ 1156 - v.pipe(v.number(), v.integer(), v.minValue(0, 'Invalid value: Expected uint16 to be >= 0'), v.maxValue(65535, 'Invalid value: Expected uint16 to be <= 2^16-1'), v.minValue(0)), 1157 - v.null() 1158 - ]), 1159 - qux: v.pipe(v.number(), v.integer(), v.minValue(0, 'Invalid value: Expected uint8 to be >= 0'), v.maxValue(255, 'Invalid value: Expected uint8 to be <= 2^8-1'), v.minValue(0)) 1160 - }) 1161 - ]); 964 + })]), v.object({ 965 + baz: v.union([v.pipe(v.number(), v.integer(), v.minValue(0, "Invalid value: Expected uint16 to be >= 0"), v.maxValue(65535, "Invalid value: Expected uint16 to be <= 2^16-1"), v.minValue(0)), v.null()]), 966 + qux: v.pipe(v.number(), v.integer(), v.minValue(0, "Invalid value: Expected uint8 to be >= 0"), v.maxValue(255, "Invalid value: Expected uint8 to be <= 2^8-1"), v.minValue(0)) 967 + })]); 1162 968 1163 - export const vModelWithOneOfAndProperties = v.intersect([ 1164 - v.union([ 1165 - vSimpleParameter, 1166 - vNonAsciiStringæøåÆøÅöôêÊ字符串 1167 - ]), 1168 - v.object({ 1169 - baz: v.union([ 1170 - v.pipe(v.number(), v.integer(), v.minValue(0, 'Invalid value: Expected uint16 to be >= 0'), v.maxValue(65535, 'Invalid value: Expected uint16 to be <= 2^16-1'), v.minValue(0)), 1171 - v.null() 1172 - ]), 1173 - qux: v.pipe(v.number(), v.integer(), v.minValue(0, 'Invalid value: Expected uint8 to be >= 0'), v.maxValue(255, 'Invalid value: Expected uint8 to be <= 2^8-1'), v.minValue(0)) 1174 - }) 1175 - ]); 969 + export const vModelWithOneOfAndProperties = v.intersect([v.union([vSimpleParameter, vNonAsciiStringæøåÆøÅöôêÊ字符串]), v.object({ 970 + baz: v.union([v.pipe(v.number(), v.integer(), v.minValue(0, "Invalid value: Expected uint16 to be >= 0"), v.maxValue(65535, "Invalid value: Expected uint16 to be <= 2^16-1"), v.minValue(0)), v.null()]), 971 + qux: v.pipe(v.number(), v.integer(), v.minValue(0, "Invalid value: Expected uint8 to be >= 0"), v.maxValue(255, "Invalid value: Expected uint8 to be <= 2^8-1"), v.minValue(0)) 972 + })]); 1176 973 1177 974 /** 1178 975 * Parameter with illegal characters ··· 1196 993 }); 1197 994 1198 995 export const vImportData = v.object({ 1199 - body: v.union([ 1200 - vModelWithReadOnlyAndWriteOnlyWritable, 1201 - vModelWithArrayReadOnlyAndWriteOnlyWritable 1202 - ]), 996 + body: v.union([vModelWithReadOnlyAndWriteOnlyWritable, vModelWithArrayReadOnlyAndWriteOnlyWritable]), 1203 997 path: v.optional(v.never()), 1204 998 query: v.optional(v.never()) 1205 999 }); 1206 1000 1207 - export const vImportResponse = v.union([ 1208 - vModelFromZendesk, 1209 - vModelWithReadOnlyAndWriteOnly 1210 - ]); 1001 + export const vImportResponse = v.union([vModelFromZendesk, vModelWithReadOnlyAndWriteOnly]); 1211 1002 1212 1003 export const vFooWowData = v.object({ 1213 1004 body: v.optional(v.never()), ··· 1311 1102 path: v.optional(v.never()), 1312 1103 query: v.optional(v.never()), 1313 1104 headers: v.object({ 1314 - parameter: v.union([ 1315 - vDeprecatedModel, 1316 - v.null() 1317 - ]) 1105 + parameter: v.union([vDeprecatedModel, v.null()]) 1318 1106 }) 1319 1107 }); 1320 1108 1321 1109 export const vCallWithParametersData = v.object({ 1322 - body: v.union([ 1323 - v.record(v.string(), v.unknown()), 1324 - v.null() 1325 - ]), 1110 + body: v.union([v.record(v.string(), v.unknown()), v.null()]), 1326 1111 path: v.object({ 1327 - parameterPath: v.union([ 1328 - v.string(), 1329 - v.null() 1330 - ]), 1331 - 'api-version': v.union([ 1332 - v.string(), 1333 - v.null() 1334 - ]) 1112 + parameterPath: v.union([v.string(), v.null()]), 1113 + 'api-version': v.union([v.string(), v.null()]) 1335 1114 }), 1336 1115 query: v.object({ 1337 1116 foo_ref_enum: v.optional(vModelWithNestedArrayEnumsDataFoo), 1338 1117 foo_all_of_enum: vModelWithNestedArrayEnumsDataFoo, 1339 - cursor: v.union([ 1340 - v.string(), 1341 - v.null() 1342 - ]) 1118 + cursor: v.union([v.string(), v.null()]) 1343 1119 }), 1344 1120 headers: v.object({ 1345 - parameterHeader: v.union([ 1346 - v.string(), 1347 - v.null() 1348 - ]) 1121 + parameterHeader: v.union([v.string(), v.null()]) 1349 1122 }) 1350 1123 }); 1351 1124 1352 1125 export const vCallWithWeirdParameterNamesData = v.object({ 1353 - body: v.union([ 1354 - vModelWithString, 1355 - v.null() 1356 - ]), 1126 + body: v.union([vModelWithString, v.null()]), 1357 1127 path: v.object({ 1358 1128 'parameter.path.1': v.optional(v.string()), 1359 1129 'parameter-path-2': v.optional(v.string()), 1360 1130 'PARAMETER-PATH-3': v.optional(v.string()), 1361 - 'api-version': v.union([ 1362 - v.string(), 1363 - v.null() 1364 - ]) 1131 + 'api-version': v.union([v.string(), v.null()]) 1365 1132 }), 1366 1133 query: v.object({ 1367 1134 default: v.optional(v.string()), 1368 - 'parameter-query': v.union([ 1369 - v.string(), 1370 - v.null() 1371 - ]) 1135 + 'parameter-query': v.union([v.string(), v.null()]) 1372 1136 }), 1373 1137 headers: v.object({ 1374 - 'parameter.header': v.union([ 1375 - v.string(), 1376 - v.null() 1377 - ]) 1138 + 'parameter.header': v.union([v.string(), v.null()]) 1378 1139 }) 1379 1140 }); 1380 1141 ··· 1388 1149 1389 1150 export const vPostCallWithOptionalParamData = v.object({ 1390 1151 body: v.optional(v.object({ 1391 - offset: v.optional(v.union([ 1392 - v.number(), 1393 - v.null() 1394 - ])) 1152 + offset: v.optional(v.union([v.number(), v.null()])) 1395 1153 })), 1396 1154 path: v.optional(v.never()), 1397 1155 query: v.object({ ··· 1399 1157 }) 1400 1158 }); 1401 1159 1402 - export const vPostCallWithOptionalParamResponse = v.union([ 1403 - v.number(), 1404 - v.void() 1405 - ]); 1160 + export const vPostCallWithOptionalParamResponse = v.union([v.number(), v.void()]); 1406 1161 1407 1162 export const vPostApiVbyApiVersionRequestBodyData = v.object({ 1408 1163 body: v.optional(vSimpleRequestBody), ··· 1424 1179 body: v.optional(v.never()), 1425 1180 path: v.optional(v.never()), 1426 1181 query: v.optional(v.object({ 1427 - parameterString: v.optional(v.union([ 1428 - v.optional(v.string(), 'Hello World!'), 1429 - v.null() 1430 - ]), 'Hello World!'), 1431 - parameterNumber: v.optional(v.union([ 1432 - v.optional(v.number(), 123), 1433 - v.null() 1434 - ]), 123), 1435 - parameterBoolean: v.optional(v.union([ 1436 - v.optional(v.boolean(), true), 1437 - v.null() 1438 - ]), true), 1182 + parameterString: v.optional(v.union([v.optional(v.string(), "Hello World!"), v.null()]), "Hello World!"), 1183 + parameterNumber: v.optional(v.union([v.optional(v.number(), 123), v.null()]), 123), 1184 + parameterBoolean: v.optional(v.union([v.optional(v.boolean(), true), v.null()]), true), 1439 1185 parameterEnum: v.optional(v.picklist([ 1440 - 'Success', 1441 - 'Warning', 1442 - 'Error' 1186 + "Success", 1187 + "Warning", 1188 + "Error" 1443 1189 ])), 1444 - parameterModel: v.optional(v.union([ 1445 - vModelWithString, 1446 - v.null() 1447 - ])) 1190 + parameterModel: v.optional(v.union([vModelWithString, v.null()])) 1448 1191 })) 1449 1192 }); 1450 1193 ··· 1452 1195 body: v.optional(v.never()), 1453 1196 path: v.optional(v.never()), 1454 1197 query: v.optional(v.object({ 1455 - parameterString: v.optional(v.string(), 'Hello World!'), 1198 + parameterString: v.optional(v.string(), "Hello World!"), 1456 1199 parameterNumber: v.optional(v.number(), 123), 1457 1200 parameterBoolean: v.optional(v.boolean(), true), 1458 1201 parameterEnum: v.optional(v.picklist([ 1459 - 'Success', 1460 - 'Warning', 1461 - 'Error' 1202 + "Success", 1203 + "Warning", 1204 + "Error" 1462 1205 ])), 1463 1206 parameterModel: v.optional(vModelWithString) 1464 1207 })) ··· 1468 1211 body: v.optional(v.never()), 1469 1212 path: v.optional(v.never()), 1470 1213 query: v.object({ 1471 - parameterOptionalStringWithDefault: v.optional(v.string(), 'Hello World!'), 1472 - parameterOptionalStringWithEmptyDefault: v.optional(v.string(), ''), 1214 + parameterOptionalStringWithDefault: v.optional(v.string(), "Hello World!"), 1215 + parameterOptionalStringWithEmptyDefault: v.optional(v.string(), ""), 1473 1216 parameterOptionalStringWithNoDefault: v.optional(v.string()), 1474 - parameterStringWithDefault: v.optional(v.string(), 'Hello World!'), 1475 - parameterStringWithEmptyDefault: v.optional(v.string(), ''), 1217 + parameterStringWithDefault: v.optional(v.string(), "Hello World!"), 1218 + parameterStringWithEmptyDefault: v.optional(v.string(), ""), 1476 1219 parameterStringWithNoDefault: v.string(), 1477 - parameterStringNullableWithNoDefault: v.optional(v.union([ 1478 - v.string(), 1479 - v.null() 1480 - ])), 1481 - parameterStringNullableWithDefault: v.optional(v.union([ 1482 - v.string(), 1483 - v.null() 1484 - ]), null) 1220 + parameterStringNullableWithNoDefault: v.optional(v.union([v.string(), v.null()])), 1221 + parameterStringNullableWithDefault: v.optional(v.union([v.string(), v.null()]), null) 1485 1222 }) 1486 1223 }); 1487 1224 ··· 1526 1263 query: v.optional(v.never()) 1527 1264 }); 1528 1265 1529 - export const vCallWithResponseAndNoContentResponseResponse = v.union([ 1530 - v.number(), 1531 - v.void() 1532 - ]); 1266 + export const vCallWithResponseAndNoContentResponseResponse = v.union([v.number(), v.void()]); 1533 1267 1534 1268 export const vDummyAData = v.object({ 1535 1269 body: v.optional(v.never()), ··· 1564 1298 query: v.optional(v.never()) 1565 1299 }); 1566 1300 1567 - export const vCallWithDuplicateResponsesResponse = v.union([ 1568 - v.intersect([ 1569 - vModelWithBoolean, 1570 - vModelWithInteger 1571 - ]), 1572 - vModelWithString 1573 - ]); 1301 + export const vCallWithDuplicateResponsesResponse = v.union([v.intersect([vModelWithBoolean, vModelWithInteger]), vModelWithString]); 1574 1302 1575 1303 export const vCallWithResponsesData = v.object({ 1576 1304 body: v.optional(v.never()), ··· 1592 1320 body: v.optional(v.never()), 1593 1321 path: v.optional(v.never()), 1594 1322 query: v.object({ 1595 - parameterArrayCSV: v.union([ 1596 - v.array(v.string()), 1597 - v.null() 1598 - ]), 1599 - parameterArraySSV: v.union([ 1600 - v.array(v.string()), 1601 - v.null() 1602 - ]), 1603 - parameterArrayTSV: v.union([ 1604 - v.array(v.string()), 1605 - v.null() 1606 - ]), 1607 - parameterArrayPipes: v.union([ 1608 - v.array(v.string()), 1609 - v.null() 1610 - ]), 1611 - parameterArrayMulti: v.union([ 1612 - v.array(v.string()), 1613 - v.null() 1614 - ]) 1323 + parameterArrayCSV: v.union([v.array(v.string()), v.null()]), 1324 + parameterArraySSV: v.union([v.array(v.string()), v.null()]), 1325 + parameterArrayTSV: v.union([v.array(v.string()), v.null()]), 1326 + parameterArrayPipes: v.union([v.array(v.string()), v.null()]), 1327 + parameterArrayMulti: v.union([v.array(v.string()), v.null()]) 1615 1328 }) 1616 1329 }); 1617 1330 1618 1331 export const vTypesData = v.object({ 1619 1332 body: v.optional(v.never()), 1620 1333 path: v.optional(v.object({ 1621 - id: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2^31'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2^31-1'))) 1334 + id: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, "Invalid value: Expected int32 to be >= -2^31"), v.maxValue(2147483647, "Invalid value: Expected int32 to be <= 2^31-1"))) 1622 1335 })), 1623 1336 query: v.object({ 1624 1337 parameterNumber: v.optional(v.number(), 123), 1625 - parameterString: v.optional(v.union([ 1626 - v.optional(v.string(), 'default'), 1627 - v.null() 1628 - ]), 'default'), 1629 - parameterBoolean: v.optional(v.union([ 1630 - v.optional(v.boolean(), true), 1631 - v.null() 1632 - ]), true), 1633 - parameterObject: v.optional(v.union([ 1634 - v.record(v.string(), v.unknown()), 1635 - v.null() 1636 - ]), null), 1637 - parameterArray: v.union([ 1638 - v.array(v.string()), 1639 - v.null() 1640 - ]), 1641 - parameterDictionary: v.union([ 1642 - v.record(v.string(), v.unknown()), 1643 - v.null() 1644 - ]), 1338 + parameterString: v.optional(v.union([v.optional(v.string(), "default"), v.null()]), "default"), 1339 + parameterBoolean: v.optional(v.union([v.optional(v.boolean(), true), v.null()]), true), 1340 + parameterObject: v.optional(v.union([v.record(v.string(), v.unknown()), v.null()]), null), 1341 + parameterArray: v.union([v.array(v.string()), v.null()]), 1342 + parameterDictionary: v.union([v.record(v.string(), v.unknown()), v.null()]), 1645 1343 parameterEnum: v.picklist([ 1646 - 'Success', 1647 - 'Warning', 1648 - 'Error' 1344 + "Success", 1345 + "Warning", 1346 + "Error" 1649 1347 ]) 1650 1348 }) 1651 1349 }); ··· 1660 1358 export const vUploadFileData = v.object({ 1661 1359 body: v.string(), 1662 1360 path: v.object({ 1663 - 'api-version': v.union([ 1664 - v.string(), 1665 - v.null() 1666 - ]) 1361 + 'api-version': v.union([v.string(), v.null()]) 1667 1362 }), 1668 1363 query: v.optional(v.never()) 1669 1364 }); ··· 1724 1419 export const vMultipartRequestData = v.object({ 1725 1420 body: v.optional(v.object({ 1726 1421 content: v.optional(v.string()), 1727 - data: v.optional(v.union([ 1728 - vModelWithString, 1729 - v.null() 1730 - ])) 1422 + data: v.optional(v.union([vModelWithString, v.null()])) 1731 1423 })), 1732 1424 path: v.optional(v.never()), 1733 1425 query: v.optional(v.never()) ··· 1735 1427 1736 1428 export const vComplexParamsData = v.object({ 1737 1429 body: v.optional(v.object({ 1738 - key: v.pipe(v.union([ 1739 - v.pipe(v.pipe(v.string(), v.maxLength(64), v.regex(/^[a-zA-Z0-9_]*$/)), v.readonly()), 1740 - v.null() 1741 - ]), v.readonly()), 1742 - name: v.union([ 1743 - v.pipe(v.string(), v.maxLength(255)), 1744 - v.null() 1745 - ]), 1430 + key: v.pipe(v.union([v.pipe(v.pipe(v.string(), v.maxLength(64), v.regex(/^[a-zA-Z0-9_]*$/)), v.readonly()), v.null()]), v.readonly()), 1431 + name: v.union([v.pipe(v.string(), v.maxLength(255)), v.null()]), 1746 1432 enabled: v.optional(v.boolean(), true), 1747 1433 type: v.picklist([ 1748 - 'Monkey', 1749 - 'Horse', 1750 - 'Bird' 1434 + "Monkey", 1435 + "Horse", 1436 + "Bird" 1751 1437 ]), 1752 - listOfModels: v.optional(v.union([ 1753 - v.array(vModelWithString), 1754 - v.null() 1755 - ])), 1756 - listOfStrings: v.optional(v.union([ 1757 - v.array(v.string()), 1758 - v.null() 1759 - ])), 1438 + listOfModels: v.optional(v.union([v.array(vModelWithString), v.null()])), 1439 + listOfStrings: v.optional(v.union([v.array(v.string()), v.null()])), 1760 1440 parameters: v.union([ 1761 1441 vModelWithString, 1762 1442 vModelWithEnum, ··· 1764 1444 vModelWithDictionary 1765 1445 ]), 1766 1446 user: v.optional(v.pipe(v.object({ 1767 - id: v.optional(v.pipe(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2^31'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2^31-1')), v.readonly())), 1768 - name: v.optional(v.pipe(v.union([ 1769 - v.pipe(v.string(), v.readonly()), 1770 - v.null() 1771 - ]), v.readonly())) 1447 + id: v.optional(v.pipe(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, "Invalid value: Expected int32 to be >= -2^31"), v.maxValue(2147483647, "Invalid value: Expected int32 to be <= 2^31-1")), v.readonly())), 1448 + name: v.optional(v.pipe(v.union([v.pipe(v.string(), v.readonly()), v.null()]), v.readonly())) 1772 1449 }), v.readonly())) 1773 1450 })), 1774 1451 path: v.object({ 1775 - id: v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2^31'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2^31-1')), 1452 + id: v.pipe(v.number(), v.integer(), v.minValue(-2147483648, "Invalid value: Expected int32 to be >= -2^31"), v.maxValue(2147483647, "Invalid value: Expected int32 to be <= 2^31-1")), 1776 1453 'api-version': v.string() 1777 1454 }), 1778 1455 query: v.optional(v.never())
+5 -12
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/validators/valibot.gen.ts
··· 2 2 3 3 import * as v from 'valibot'; 4 4 5 - export const vBaz = v.optional(v.pipe(v.pipe(v.string(), v.regex(/foo\nbar/)), v.readonly()), 'baz'); 5 + export const vBaz = v.optional(v.pipe(v.pipe(v.string(), v.regex(/foo\nbar/)), v.readonly()), "baz"); 6 6 7 - export const vFoo: v.GenericSchema = v.optional(v.union([ 8 - v.object({ 7 + export const vFoo: v.GenericSchema = v.optional(v.union([v.object({ 9 8 foo: v.optional(v.pipe(v.string(), v.regex(/^\d{3}-\d{2}-\d{4}$/))), 10 - bar: v.optional(v.lazy(() => { 11 - return vBar; 12 - })), 13 - baz: v.optional(v.array(v.lazy(() => { 14 - return vFoo; 15 - }))), 9 + bar: v.optional(v.lazy(() => vBar)), 10 + baz: v.optional(v.array(v.lazy(() => vFoo))), 16 11 qux: v.optional(v.pipe(v.number(), v.integer(), v.gtValue(0)), 0) 17 - }), 18 - v.null() 19 - ]), null); 12 + }), v.null()]), null); 20 13 21 14 export const vBar = v.object({ 22 15 foo: v.optional(vFoo)
+3 -12
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-null/valibot.gen.ts
··· 2 2 3 3 import * as v from 'valibot'; 4 4 5 - export const vFoo = v.nullable(v.picklist([ 6 - 'foo', 7 - 'bar' 8 - ])); 5 + export const vFoo = v.nullable(v.picklist(["foo", "bar"])); 9 6 10 - export const vBar = v.picklist([ 11 - 'foo', 12 - 'bar' 13 - ]); 7 + export const vBar = v.picklist(["foo", "bar"]); 14 8 15 - export const vBaz = v.picklist([ 16 - 'foo', 17 - 'bar' 18 - ]); 9 + export const vBaz = v.picklist(["foo", "bar"]);
+18 -18
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/integer-formats/valibot.gen.ts
··· 4 4 5 5 export const vIntegerFormats = v.object({ 6 6 numberNoFormat: v.optional(v.number()), 7 - numberInt8: v.optional(v.pipe(v.number(), v.minValue(-128, 'Invalid value: Expected int8 to be >= -2^7'), v.maxValue(127, 'Invalid value: Expected int8 to be <= 2^7-1'))), 8 - numberInt16: v.optional(v.pipe(v.number(), v.minValue(-32768, 'Invalid value: Expected int16 to be >= -2^15'), v.maxValue(32767, 'Invalid value: Expected int16 to be <= 2^15-1'))), 9 - numberInt32: v.optional(v.pipe(v.number(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2^31'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2^31-1'))), 7 + numberInt8: v.optional(v.pipe(v.number(), v.minValue(-128, "Invalid value: Expected int8 to be >= -2^7"), v.maxValue(127, "Invalid value: Expected int8 to be <= 2^7-1"))), 8 + numberInt16: v.optional(v.pipe(v.number(), v.minValue(-32768, "Invalid value: Expected int16 to be >= -2^15"), v.maxValue(32767, "Invalid value: Expected int16 to be <= 2^15-1"))), 9 + numberInt32: v.optional(v.pipe(v.number(), v.minValue(-2147483648, "Invalid value: Expected int32 to be >= -2^31"), v.maxValue(2147483647, "Invalid value: Expected int32 to be <= 2^31-1"))), 10 10 numberInt64: v.optional(v.pipe(v.union([ 11 11 v.number(), 12 12 v.string(), 13 13 v.bigint() 14 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'))), 15 - numberUint8: v.optional(v.pipe(v.number(), v.minValue(0, 'Invalid value: Expected uint8 to be >= 0'), v.maxValue(255, 'Invalid value: Expected uint8 to be <= 2^8-1'))), 16 - numberUint16: v.optional(v.pipe(v.number(), v.minValue(0, 'Invalid value: Expected uint16 to be >= 0'), v.maxValue(65535, 'Invalid value: Expected uint16 to be <= 2^16-1'))), 17 - numberUint32: v.optional(v.pipe(v.number(), v.minValue(0, 'Invalid value: Expected uint32 to be >= 0'), v.maxValue(4294967295, 'Invalid value: Expected uint32 to be <= 2^32-1'))), 14 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1"))), 15 + numberUint8: v.optional(v.pipe(v.number(), v.minValue(0, "Invalid value: Expected uint8 to be >= 0"), v.maxValue(255, "Invalid value: Expected uint8 to be <= 2^8-1"))), 16 + numberUint16: v.optional(v.pipe(v.number(), v.minValue(0, "Invalid value: Expected uint16 to be >= 0"), v.maxValue(65535, "Invalid value: Expected uint16 to be <= 2^16-1"))), 17 + numberUint32: v.optional(v.pipe(v.number(), v.minValue(0, "Invalid value: Expected uint32 to be >= 0"), v.maxValue(4294967295, "Invalid value: Expected uint32 to be <= 2^32-1"))), 18 18 numberUint64: v.optional(v.pipe(v.union([ 19 19 v.number(), 20 20 v.string(), 21 21 v.bigint() 22 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('0'), 'Invalid value: Expected uint64 to be >= 0'), v.maxValue(BigInt('18446744073709551615'), 'Invalid value: Expected uint64 to be <= 2^64-1'))), 22 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("0"), "Invalid value: Expected uint64 to be >= 0"), v.maxValue(BigInt("18446744073709551615"), "Invalid value: Expected uint64 to be <= 2^64-1"))), 23 23 integerNoFormat: v.optional(v.pipe(v.number(), v.integer())), 24 - integerInt8: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-128, 'Invalid value: Expected int8 to be >= -2^7'), v.maxValue(127, 'Invalid value: Expected int8 to be <= 2^7-1'))), 25 - integerInt16: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-32768, 'Invalid value: Expected int16 to be >= -2^15'), v.maxValue(32767, 'Invalid value: Expected int16 to be <= 2^15-1'))), 26 - integerInt32: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2^31'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2^31-1'))), 24 + integerInt8: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-128, "Invalid value: Expected int8 to be >= -2^7"), v.maxValue(127, "Invalid value: Expected int8 to be <= 2^7-1"))), 25 + integerInt16: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-32768, "Invalid value: Expected int16 to be >= -2^15"), v.maxValue(32767, "Invalid value: Expected int16 to be <= 2^15-1"))), 26 + integerInt32: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, "Invalid value: Expected int32 to be >= -2^31"), v.maxValue(2147483647, "Invalid value: Expected int32 to be <= 2^31-1"))), 27 27 integerInt64: v.optional(v.pipe(v.union([ 28 28 v.number(), 29 29 v.string(), 30 30 v.bigint() 31 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'))), 32 - integerUint8: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0, 'Invalid value: Expected uint8 to be >= 0'), v.maxValue(255, 'Invalid value: Expected uint8 to be <= 2^8-1'))), 33 - integerUint16: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0, 'Invalid value: Expected uint16 to be >= 0'), v.maxValue(65535, 'Invalid value: Expected uint16 to be <= 2^16-1'))), 34 - integerUint32: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0, 'Invalid value: Expected uint32 to be >= 0'), v.maxValue(4294967295, 'Invalid value: Expected uint32 to be <= 2^32-1'))), 31 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1"))), 32 + integerUint8: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0, "Invalid value: Expected uint8 to be >= 0"), v.maxValue(255, "Invalid value: Expected uint8 to be <= 2^8-1"))), 33 + integerUint16: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0, "Invalid value: Expected uint16 to be >= 0"), v.maxValue(65535, "Invalid value: Expected uint16 to be <= 2^16-1"))), 34 + integerUint32: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0, "Invalid value: Expected uint32 to be >= 0"), v.maxValue(4294967295, "Invalid value: Expected uint32 to be <= 2^32-1"))), 35 35 integerUint64: v.optional(v.pipe(v.union([ 36 36 v.number(), 37 37 v.string(), 38 38 v.bigint() 39 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('0'), 'Invalid value: Expected uint64 to be >= 0'), v.maxValue(BigInt('18446744073709551615'), 'Invalid value: Expected uint64 to be <= 2^64-1'))), 39 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("0"), "Invalid value: Expected uint64 to be >= 0"), v.maxValue(BigInt("18446744073709551615"), "Invalid value: Expected uint64 to be <= 2^64-1"))), 40 40 stringInt64: v.optional(v.pipe(v.union([ 41 41 v.number(), 42 42 v.string(), 43 43 v.bigint() 44 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'))), 44 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1"))), 45 45 stringUint64: v.optional(v.pipe(v.union([ 46 46 v.number(), 47 47 v.string(), 48 48 v.bigint() 49 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('0'), 'Invalid value: Expected uint64 to be >= 0'), v.maxValue(BigInt('18446744073709551615'), 'Invalid value: Expected uint64 to be <= 2^64-1'))) 49 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("0"), "Invalid value: Expected uint64 to be >= 0"), v.maxValue(BigInt("18446744073709551615"), "Invalid value: Expected uint64 to be <= 2^64-1"))) 50 50 });
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/valibot.gen.ts
··· 8 8 v.number(), 9 9 v.string(), 10 10 v.bigint() 11 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), BigInt(0)), 11 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), BigInt(0)), 12 12 id: v.string() 13 13 }); 14 14
+162 -486
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/valibot/default/valibot.gen.ts
··· 81 81 /** 82 82 * This is a simple string 83 83 */ 84 - export const vSimpleStringWithPattern = v.union([ 85 - v.pipe(v.string(), v.maxLength(64), v.regex(/^[a-zA-Z0-9_]*$/)), 86 - v.null() 87 - ]); 84 + export const vSimpleStringWithPattern = v.union([v.pipe(v.string(), v.maxLength(64), v.regex(/^[a-zA-Z0-9_]*$/)), v.null()]); 88 85 89 86 /** 90 87 * This is a simple enum with strings 91 88 */ 92 89 export const vEnumWithStrings = v.picklist([ 93 - 'Success', 94 - 'Warning', 95 - 'Error', 90 + "Success", 91 + "Warning", 92 + "Error", 96 93 "'Single Quote'", 97 - '"Double Quotes"', 98 - 'Non-ascii: øæåôöØÆÅÔÖ字符串' 94 + "\"Double Quotes\"", 95 + "Non-ascii: øæåôöØÆÅÔÖ字符串" 99 96 ]); 100 97 101 98 export const vEnumWithReplacedCharacters = v.picklist([ 102 99 "'Single Quote'", 103 - '"Double Quotes"', 104 - 'øæåôöØÆÅÔÖ字符串', 105 - '' 100 + "\"Double Quotes\"", 101 + "øæåôöØÆÅÔÖ字符串", 102 + "" 106 103 ]); 107 104 108 105 /** ··· 135 132 /** 136 133 * This is a simple array with strings 137 134 */ 138 - export const vArrayWithStrings = v.optional(v.array(v.string()), ['test']); 135 + export const vArrayWithStrings = v.optional(v.array(v.string()), ["test"]); 139 136 140 137 /** 141 138 * This is a simple array with properties ··· 151 148 export const vArrayWithAnyOfProperties = v.array(v.unknown()); 152 149 153 150 export const vAnyOfAnyAndNull = v.object({ 154 - data: v.optional(v.union([ 155 - v.unknown(), 156 - v.null() 157 - ])) 151 + data: v.optional(v.union([v.unknown(), v.null()])) 158 152 }); 159 153 160 154 /** ··· 249 243 * This is a model with one string property 250 244 */ 251 245 export const vModelWithNullableString = v.object({ 252 - nullableProp1: v.optional(v.union([ 253 - v.string(), 254 - v.null() 255 - ])), 256 - nullableRequiredProp1: v.union([ 257 - v.string(), 258 - v.null() 259 - ]), 260 - nullableProp2: v.optional(v.union([ 261 - v.string(), 262 - v.null() 263 - ])), 264 - nullableRequiredProp2: v.union([ 265 - v.string(), 266 - v.null() 267 - ]), 246 + nullableProp1: v.optional(v.union([v.string(), v.null()])), 247 + nullableRequiredProp1: v.union([v.string(), v.null()]), 248 + nullableProp2: v.optional(v.union([v.string(), v.null()])), 249 + nullableRequiredProp2: v.union([v.string(), v.null()]), 268 250 'foo_bar-enum': v.optional(v.picklist([ 269 - 'Success', 270 - 'Warning', 271 - 'Error', 272 - 'ØÆÅ字符串' 251 + "Success", 252 + "Warning", 253 + "Error", 254 + "ØÆÅ字符串" 273 255 ])) 274 256 }); 275 257 ··· 278 260 */ 279 261 export const vModelWithEnum = v.object({ 280 262 'foo_bar-enum': v.optional(v.picklist([ 281 - 'Success', 282 - 'Warning', 283 - 'Error', 284 - 'ØÆÅ字符串' 263 + "Success", 264 + "Warning", 265 + "Error", 266 + "ØÆÅ字符串" 285 267 ])), 286 268 statusCode: v.optional(v.picklist([ 287 - '100', 288 - '200 FOO', 289 - '300 FOO_BAR', 290 - '400 foo-bar', 291 - '500 foo.bar', 292 - '600 foo&bar' 269 + "100", 270 + "200 FOO", 271 + "300 FOO_BAR", 272 + "400 foo-bar", 273 + "500 foo.bar", 274 + "600 foo&bar" 293 275 ])), 294 276 bool: v.optional(v.unknown()) 295 277 }); ··· 298 280 * This is a model with one enum with escaped name 299 281 */ 300 282 export const vModelWithEnumWithHyphen = v.object({ 301 - 'foo-bar-baz-qux': v.optional(v.picklist([ 302 - '3.0' 303 - ])) 283 + 'foo-bar-baz-qux': v.optional(v.picklist(["3.0"])) 304 284 }); 305 285 306 286 /** ··· 315 295 */ 316 296 export const vModelWithNestedEnums = v.object({ 317 297 dictionaryWithEnum: v.optional(v.record(v.string(), v.picklist([ 318 - 'Success', 319 - 'Warning', 320 - 'Error' 298 + "Success", 299 + "Warning", 300 + "Error" 321 301 ]))), 322 302 dictionaryWithEnumFromDescription: v.optional(v.record(v.string(), v.pipe(v.number(), v.integer()))), 323 303 arrayWithEnum: v.optional(v.array(v.picklist([ 324 - 'Success', 325 - 'Warning', 326 - 'Error' 304 + "Success", 305 + "Warning", 306 + "Error" 327 307 ]))), 328 308 arrayWithDescription: v.optional(v.array(v.pipe(v.number(), v.integer()))), 329 309 'foo_bar-enum': v.optional(v.picklist([ 330 - 'Success', 331 - 'Warning', 332 - 'Error', 333 - 'ØÆÅ字符串' 310 + "Success", 311 + "Warning", 312 + "Error", 313 + "ØÆÅ字符串" 334 314 ])) 335 315 }); 336 316 ··· 363 343 * This is a model with one property containing a circular reference 364 344 */ 365 345 export const vModelWithCircularReference: v.GenericSchema = v.object({ 366 - prop: v.optional(v.lazy(() => { 367 - return vModelWithCircularReference; 368 - })) 346 + prop: v.optional(v.lazy(() => vModelWithCircularReference)) 369 347 }); 370 348 371 349 /** ··· 412 390 /** 413 391 * This is a model with one property with a 'one of' relationship where the options are not $ref 414 392 */ 415 - export const vCompositionWithOneOfDiscriminator = v.union([ 416 - v.intersect([ 417 - v.object({ 393 + export const vCompositionWithOneOfDiscriminator = v.union([v.intersect([v.object({ 418 394 kind: v.literal("circle") 419 - }), 420 - vModelCircle 421 - ]), 422 - v.intersect([ 423 - v.object({ 395 + }), vModelCircle]), v.intersect([v.object({ 424 396 kind: v.literal("square") 425 - }), 426 - vModelSquare 427 - ]) 428 - ]); 397 + }), vModelSquare])]); 429 398 430 399 /** 431 400 * This is a model with one property with a 'any of' relationship ··· 456 425 * This is a model with nested 'any of' property with a type null 457 426 */ 458 427 export const vCompositionWithNestedAnyAndTypeNull = v.object({ 459 - propA: v.optional(v.union([ 460 - v.array(v.unknown()), 461 - v.array(v.unknown()) 462 - ])) 428 + propA: v.optional(v.union([v.array(v.unknown()), v.array(v.unknown())])) 463 429 }); 464 430 465 - export const v3eNum1Период = v.picklist([ 466 - 'Bird', 467 - 'Dog' 468 - ]); 431 + export const v3eNum1Период = v.picklist(["Bird", "Dog"]); 469 432 470 433 export const vConstValue = v.literal("ConstValue"); 471 434 ··· 473 436 * This is a model with one property with a 'any of' relationship where the options are not $ref 474 437 */ 475 438 export const vCompositionWithNestedAnyOfAndNull = v.object({ 476 - propA: v.optional(v.union([ 477 - v.array(v.unknown()), 478 - v.null() 479 - ])) 439 + propA: v.optional(v.union([v.array(v.unknown()), v.null()])) 480 440 }); 481 441 482 442 /** ··· 498 458 * This is a model that contains a simple dictionary within composition 499 459 */ 500 460 export const vCompositionWithOneOfAndSimpleDictionary = v.object({ 501 - propA: v.optional(v.union([ 502 - v.boolean(), 503 - v.record(v.string(), v.number()) 504 - ])) 461 + propA: v.optional(v.union([v.boolean(), v.record(v.string(), v.number())])) 505 462 }); 506 463 507 464 /** 508 465 * This is a model that contains a dictionary of simple arrays within composition 509 466 */ 510 467 export const vCompositionWithOneOfAndSimpleArrayDictionary = v.object({ 511 - propA: v.optional(v.union([ 512 - v.boolean(), 513 - v.record(v.string(), v.array(v.boolean())) 514 - ])) 468 + propA: v.optional(v.union([v.boolean(), v.record(v.string(), v.array(v.boolean()))])) 515 469 }); 516 470 517 471 /** 518 472 * This is a model that contains a dictionary of complex arrays (composited) within composition 519 473 */ 520 474 export const vCompositionWithOneOfAndComplexArrayDictionary = v.object({ 521 - propA: v.optional(v.union([ 522 - v.boolean(), 523 - v.record(v.string(), v.array(v.unknown())) 524 - ])) 475 + propA: v.optional(v.union([v.boolean(), v.record(v.string(), v.array(v.unknown()))])) 525 476 }); 526 477 527 478 /** 528 479 * This is a model with one property with a 'all of' relationship 529 480 */ 530 481 export const vCompositionWithAllOfAndNullable = v.object({ 531 - propA: v.optional(v.union([ 532 - v.intersect([ 482 + propA: v.optional(v.union([v.intersect([ 533 483 v.object({ 534 484 boolean: v.optional(v.boolean()) 535 485 }), 536 486 vModelWithEnum, 537 487 vModelWithArray, 538 488 vModelWithDictionary 539 - ]), 540 - v.null() 541 - ])) 489 + ]), v.null()])) 542 490 }); 543 491 544 492 /** ··· 567 515 /** 568 516 * This is a model that extends the base model 569 517 */ 570 - export const vCompositionExtendedModel = v.intersect([ 571 - vCompositionBaseModel, 572 - v.object({ 518 + export const vCompositionExtendedModel = v.intersect([vCompositionBaseModel, v.object({ 573 519 age: v.number(), 574 520 firstName: v.string(), 575 521 lastname: v.string() 576 - }) 577 - ]); 522 + })]); 578 523 579 524 /** 580 525 * This is a model with one nested property ··· 582 527 export const vModelWithProperties = v.object({ 583 528 required: v.string(), 584 529 requiredAndReadOnly: v.pipe(v.string(), v.readonly()), 585 - requiredAndNullable: v.union([ 586 - v.string(), 587 - v.null() 588 - ]), 530 + requiredAndNullable: v.union([v.string(), v.null()]), 589 531 string: v.optional(v.string()), 590 532 number: v.optional(v.number()), 591 533 boolean: v.optional(v.boolean()), ··· 608 550 * This is a model with one nested property 609 551 */ 610 552 export const vModelWithNestedProperties = v.object({ 611 - first: v.pipe(v.union([ 612 - v.pipe(v.object({ 613 - second: v.pipe(v.union([ 614 - v.pipe(v.object({ 615 - third: v.pipe(v.union([ 616 - v.pipe(v.string(), v.readonly()), 617 - v.null() 618 - ]), v.readonly()) 619 - }), v.readonly()), 620 - v.null() 621 - ]), v.readonly()) 622 - }), v.readonly()), 623 - v.null() 624 - ]), v.readonly()) 553 + first: v.pipe(v.union([v.pipe(v.object({ 554 + second: v.pipe(v.union([v.pipe(v.object({ 555 + third: v.pipe(v.union([v.pipe(v.string(), v.readonly()), v.null()]), v.readonly()) 556 + }), v.readonly()), v.null()]), v.readonly()) 557 + }), v.readonly()), v.null()]), v.readonly()) 625 558 }); 626 559 627 560 /** ··· 652 585 /** 653 586 * This is a model that extends another model 654 587 */ 655 - export const vModelThatExtends = v.intersect([ 656 - vModelWithString, 657 - v.object({ 588 + export const vModelThatExtends = v.intersect([vModelWithString, v.object({ 658 589 propExtendsA: v.optional(v.string()), 659 590 propExtendsB: v.optional(vModelWithString) 660 - }) 661 - ]); 591 + })]); 662 592 663 593 /** 664 594 * This is a model that extends another model ··· 700 630 }); 701 631 702 632 export const vPageable = v.object({ 703 - page: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2^31'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2^31-1'), v.minValue(0)), 0), 704 - size: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2^31'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2^31-1'), v.minValue(1))), 633 + page: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, "Invalid value: Expected int32 to be >= -2^31"), v.maxValue(2147483647, "Invalid value: Expected int32 to be <= 2^31-1"), v.minValue(0)), 0), 634 + size: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, "Invalid value: Expected int32 to be >= -2^31"), v.maxValue(2147483647, "Invalid value: Expected int32 to be <= 2^31-1"), v.minValue(1))), 705 635 sort: v.optional(v.array(v.string())) 706 636 }); 707 637 ··· 735 665 }, v.unknown()); 736 666 737 667 export const vNestedAnyOfArraysNullable = v.object({ 738 - nullableArray: v.optional(v.union([ 739 - v.array(v.unknown()), 740 - v.null() 741 - ])) 668 + nullableArray: v.optional(v.union([v.array(v.unknown()), v.null()])) 742 669 }); 743 670 744 671 /** 745 672 * An object that can be null 746 673 */ 747 - export const vNullableObject = v.optional(v.union([ 748 - v.object({ 674 + export const vNullableObject = v.optional(v.union([v.object({ 749 675 foo: v.optional(v.string()) 750 - }), 751 - v.null() 752 - ]), null); 676 + }), v.null()]), null); 753 677 754 678 /** 755 679 * Some % character ··· 762 686 763 687 export const vModelWithOneOfEnum = v.union([ 764 688 v.object({ 765 - foo: v.picklist([ 766 - 'Bar' 767 - ]) 689 + foo: v.picklist(["Bar"]) 768 690 }), 769 691 v.object({ 770 - foo: v.picklist([ 771 - 'Baz' 772 - ]) 692 + foo: v.picklist(["Baz"]) 773 693 }), 774 694 v.object({ 775 - foo: v.picklist([ 776 - 'Qux' 777 - ]) 695 + foo: v.picklist(["Qux"]) 778 696 }), 779 697 v.object({ 780 698 content: v.pipe(v.string(), v.isoTimestamp()), 781 - foo: v.picklist([ 782 - 'Quux' 783 - ]) 699 + foo: v.picklist(["Quux"]) 784 700 }), 785 701 v.object({ 786 - content: v.tuple([ 787 - v.pipe(v.string(), v.isoTimestamp()), 788 - v.string() 789 - ]), 790 - foo: v.picklist([ 791 - 'Corge' 792 - ]) 702 + content: v.tuple([v.pipe(v.string(), v.isoTimestamp()), v.string()]), 703 + foo: v.picklist(["Corge"]) 793 704 }) 794 705 ]); 795 706 796 - export const vModelWithNestedArrayEnumsDataFoo = v.picklist([ 797 - 'foo', 798 - 'bar' 799 - ]); 707 + export const vModelWithNestedArrayEnumsDataFoo = v.picklist(["foo", "bar"]); 800 708 801 - export const vModelWithNestedArrayEnumsDataBar = v.picklist([ 802 - 'baz', 803 - 'qux' 804 - ]); 709 + export const vModelWithNestedArrayEnumsDataBar = v.picklist(["baz", "qux"]); 805 710 806 711 export const vModelWithNestedArrayEnumsData = v.object({ 807 712 foo: v.optional(v.array(vModelWithNestedArrayEnumsDataFoo)), ··· 831 736 propWithNumber: v.optional(v.array(v.number())) 832 737 }); 833 738 834 - export const vModelWithConstantSizeArray = v.tuple([ 835 - v.number(), 836 - v.number() 837 - ]); 739 + export const vModelWithConstantSizeArray = v.tuple([v.number(), v.number()]); 838 740 839 741 export const vModelWithAnyOfConstantSizeArray = v.tuple([ 840 - v.union([ 841 - v.number(), 842 - v.string() 843 - ]), 844 - v.union([ 845 - v.number(), 846 - v.string() 847 - ]), 848 - v.union([ 849 - v.number(), 850 - v.string() 851 - ]) 742 + v.union([v.number(), v.string()]), 743 + v.union([v.number(), v.string()]), 744 + v.union([v.number(), v.string()]) 852 745 ]); 853 746 854 747 export const vModelWithPrefixItemsConstantSizeArray = v.tuple([ 855 748 vModelWithInteger, 856 - v.union([ 857 - v.number(), 858 - v.string() 859 - ]), 749 + v.union([v.number(), v.string()]), 860 750 v.string() 861 751 ]); 862 752 ··· 878 768 ]) 879 769 ]); 880 770 881 - export const vModelWithAnyOfConstantSizeArrayAndIntersect = v.tuple([ 882 - v.intersect([ 883 - v.number(), 884 - v.string() 885 - ]), 886 - v.intersect([ 887 - v.number(), 888 - v.string() 889 - ]) 890 - ]); 771 + export const vModelWithAnyOfConstantSizeArrayAndIntersect = v.tuple([v.intersect([v.number(), v.string()]), v.intersect([v.number(), v.string()])]); 891 772 892 773 export const vModelWithNumericEnumUnion = v.object({ 893 774 value: v.optional(v.unknown()) ··· 930 811 */ 931 812 export const vImport = v.string(); 932 813 933 - export const vModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = v.tuple([ 934 - v.union([ 935 - v.number(), 936 - vImport 937 - ]), 938 - v.union([ 939 - v.number(), 940 - vImport 941 - ]) 942 - ]); 814 + export const vModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = v.tuple([v.union([v.number(), vImport]), v.union([v.number(), vImport])]); 943 815 944 816 export const vSchemaWithFormRestrictedKeys = v.object({ 945 817 description: v.optional(v.string()), ··· 982 854 983 855 export const vAdditionalPropertiesUnknownIssue2 = v.object({}); 984 856 985 - export const vAdditionalPropertiesUnknownIssue3 = v.intersect([ 986 - v.string(), 987 - v.object({ 857 + export const vAdditionalPropertiesUnknownIssue3 = v.intersect([v.string(), v.object({ 988 858 entries: v.object({}) 989 - }) 990 - ]); 859 + })]); 991 860 992 861 export const vAdditionalPropertiesIntegerIssue = v.objectWithRest({ 993 862 value: v.pipe(v.number(), v.integer()) ··· 995 864 996 865 export const vGenericSchemaDuplicateIssue1SystemBoolean = v.strictObject({ 997 866 item: v.optional(v.boolean()), 998 - error: v.optional(v.union([ 999 - v.string(), 1000 - v.null() 1001 - ])), 867 + error: v.optional(v.union([v.string(), v.null()])), 1002 868 hasError: v.optional(v.pipe(v.boolean(), v.readonly())), 1003 869 data: v.optional(v.strictObject({})) 1004 870 }); 1005 871 1006 872 export const vGenericSchemaDuplicateIssue1SystemString = v.strictObject({ 1007 - item: v.optional(v.union([ 1008 - v.string(), 1009 - v.null() 1010 - ])), 1011 - error: v.optional(v.union([ 1012 - v.string(), 1013 - v.null() 1014 - ])), 873 + item: v.optional(v.union([v.string(), v.null()])), 874 + error: v.optional(v.union([v.string(), v.null()])), 1015 875 hasError: v.optional(v.pipe(v.boolean(), v.readonly())) 1016 876 }); 1017 877 1018 - export const vOneOfAllOfIssue = v.union([ 1019 - v.intersect([ 1020 - v.union([ 1021 - vConstValue, 1022 - vGenericSchemaDuplicateIssue1SystemBoolean 1023 - ]), 1024 - v3eNum1Период 1025 - ]), 1026 - vGenericSchemaDuplicateIssue1SystemString 1027 - ]); 878 + export const vOneOfAllOfIssue = v.union([v.intersect([v.union([vConstValue, vGenericSchemaDuplicateIssue1SystemBoolean]), v3eNum1Период]), vGenericSchemaDuplicateIssue1SystemString]); 1028 879 1029 880 export const vExternalSharedExternalSharedModel = v.object({ 1030 881 id: v.string(), ··· 1046 897 */ 1047 898 export const vModelWithPropertiesWritable = v.object({ 1048 899 required: v.string(), 1049 - requiredAndNullable: v.union([ 1050 - v.string(), 1051 - v.null() 1052 - ]), 900 + requiredAndNullable: v.union([v.string(), v.null()]), 1053 901 string: v.optional(v.string()), 1054 902 number: v.optional(v.number()), 1055 903 boolean: v.optional(v.boolean()), ··· 1097 945 propWithNumber: v.optional(v.array(v.number())) 1098 946 }); 1099 947 1100 - export const vModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = v.tuple([ 1101 - v.union([ 1102 - v.number(), 1103 - vImport 1104 - ]), 1105 - v.union([ 1106 - v.number(), 1107 - vImport 1108 - ]) 1109 - ]); 948 + export const vModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = v.tuple([v.union([v.number(), vImport]), v.union([v.number(), vImport])]); 1110 949 1111 950 export const vAdditionalPropertiesUnknownIssueWritable = v.object({}); 1112 951 1113 - export const vOneOfAllOfIssueWritable = v.union([ 1114 - v.intersect([ 1115 - v.union([ 1116 - vConstValue, 1117 - vGenericSchemaDuplicateIssue1SystemBoolean 1118 - ]), 1119 - v3eNum1Период 1120 - ]), 1121 - vGenericSchemaDuplicateIssue1SystemString 1122 - ]); 952 + export const vOneOfAllOfIssueWritable = v.union([v.intersect([v.union([vConstValue, vGenericSchemaDuplicateIssue1SystemBoolean]), v3eNum1Период]), vGenericSchemaDuplicateIssue1SystemString]); 1123 953 1124 954 export const vGenericSchemaDuplicateIssue1SystemBooleanWritable = v.strictObject({ 1125 955 item: v.optional(v.boolean()), 1126 - error: v.optional(v.union([ 1127 - v.string(), 1128 - v.null() 1129 - ])), 956 + error: v.optional(v.union([v.string(), v.null()])), 1130 957 data: v.optional(v.strictObject({})) 1131 958 }); 1132 959 1133 960 export const vGenericSchemaDuplicateIssue1SystemStringWritable = v.strictObject({ 1134 - item: v.optional(v.union([ 1135 - v.string(), 1136 - v.null() 1137 - ])), 1138 - error: v.optional(v.union([ 1139 - v.string(), 1140 - v.null() 1141 - ])) 961 + item: v.optional(v.union([v.string(), v.null()])), 962 + error: v.optional(v.union([v.string(), v.null()])) 1142 963 }); 1143 964 1144 965 /** ··· 1146 967 */ 1147 968 export const vSimpleParameter = v.string(); 1148 969 1149 - export const vCompositionWithOneOfAndProperties = v.intersect([ 1150 - v.union([ 1151 - v.strictObject({ 970 + export const vCompositionWithOneOfAndProperties = v.intersect([v.union([v.strictObject({ 1152 971 foo: vSimpleParameter 1153 - }), 1154 - v.strictObject({ 972 + }), v.strictObject({ 1155 973 bar: vNonAsciiStringæøåÆøÅöôêÊ字符串 1156 - }) 1157 - ]), 1158 - v.object({ 1159 - baz: v.union([ 1160 - v.pipe(v.number(), v.integer(), v.minValue(0, 'Invalid value: Expected uint16 to be >= 0'), v.maxValue(65535, 'Invalid value: Expected uint16 to be <= 2^16-1'), v.minValue(0)), 1161 - v.null() 1162 - ]), 1163 - qux: v.pipe(v.number(), v.integer(), v.minValue(0, 'Invalid value: Expected uint8 to be >= 0'), v.maxValue(255, 'Invalid value: Expected uint8 to be <= 2^8-1'), v.minValue(0)) 1164 - }) 1165 - ]); 974 + })]), v.object({ 975 + baz: v.union([v.pipe(v.number(), v.integer(), v.minValue(0, "Invalid value: Expected uint16 to be >= 0"), v.maxValue(65535, "Invalid value: Expected uint16 to be <= 2^16-1"), v.minValue(0)), v.null()]), 976 + qux: v.pipe(v.number(), v.integer(), v.minValue(0, "Invalid value: Expected uint8 to be >= 0"), v.maxValue(255, "Invalid value: Expected uint8 to be <= 2^8-1"), v.minValue(0)) 977 + })]); 1166 978 1167 - export const vModelWithOneOfAndProperties = v.intersect([ 1168 - v.union([ 1169 - vSimpleParameter, 1170 - vNonAsciiStringæøåÆøÅöôêÊ字符串 1171 - ]), 1172 - v.object({ 1173 - baz: v.union([ 1174 - v.pipe(v.number(), v.integer(), v.minValue(0, 'Invalid value: Expected uint16 to be >= 0'), v.maxValue(65535, 'Invalid value: Expected uint16 to be <= 2^16-1'), v.minValue(0)), 1175 - v.null() 1176 - ]), 1177 - qux: v.pipe(v.number(), v.integer(), v.minValue(0, 'Invalid value: Expected uint8 to be >= 0'), v.maxValue(255, 'Invalid value: Expected uint8 to be <= 2^8-1'), v.minValue(0)) 1178 - }) 1179 - ]); 979 + export const vModelWithOneOfAndProperties = v.intersect([v.union([vSimpleParameter, vNonAsciiStringæøåÆøÅöôêÊ字符串]), v.object({ 980 + baz: v.union([v.pipe(v.number(), v.integer(), v.minValue(0, "Invalid value: Expected uint16 to be >= 0"), v.maxValue(65535, "Invalid value: Expected uint16 to be <= 2^16-1"), v.minValue(0)), v.null()]), 981 + qux: v.pipe(v.number(), v.integer(), v.minValue(0, "Invalid value: Expected uint8 to be >= 0"), v.maxValue(255, "Invalid value: Expected uint8 to be <= 2^8-1"), v.minValue(0)) 982 + })]); 1180 983 1181 984 /** 1182 985 * Parameter with illegal characters ··· 1206 1009 }); 1207 1010 1208 1011 export const vImportData = v.object({ 1209 - body: v.union([ 1210 - vModelWithReadOnlyAndWriteOnlyWritable, 1211 - vModelWithArrayReadOnlyAndWriteOnlyWritable 1212 - ]), 1012 + body: v.union([vModelWithReadOnlyAndWriteOnlyWritable, vModelWithArrayReadOnlyAndWriteOnlyWritable]), 1213 1013 path: v.optional(v.never()), 1214 1014 query: v.optional(v.never()) 1215 1015 }); 1216 1016 1217 - export const vImportResponse = v.union([ 1218 - vModelFromZendesk, 1219 - vModelWithReadOnlyAndWriteOnly 1220 - ]); 1017 + export const vImportResponse = v.union([vModelFromZendesk, vModelWithReadOnlyAndWriteOnly]); 1221 1018 1222 1019 export const vFooWowData = v.object({ 1223 1020 body: v.optional(v.never()), ··· 1239 1036 export const vGetApiVbyApiVersionSimpleOperationData = v.object({ 1240 1037 body: v.optional(v.never()), 1241 1038 path: v.object({ 1242 - foo_param: v.union([ 1243 - v.string(), 1244 - v.pipe(v.string(), v.uuid()) 1245 - ]) 1039 + foo_param: v.union([v.string(), v.pipe(v.string(), v.uuid())]) 1246 1040 }), 1247 1041 query: v.optional(v.never()) 1248 1042 }); ··· 1324 1118 path: v.optional(v.never()), 1325 1119 query: v.optional(v.never()), 1326 1120 headers: v.object({ 1327 - parameter: v.union([ 1328 - vDeprecatedModel, 1329 - v.null() 1330 - ]) 1121 + parameter: v.union([vDeprecatedModel, v.null()]) 1331 1122 }) 1332 1123 }); 1333 1124 1334 1125 export const vCallWithParametersData = v.object({ 1335 - body: v.union([ 1336 - v.record(v.string(), v.unknown()), 1337 - v.null() 1338 - ]), 1126 + body: v.union([v.record(v.string(), v.unknown()), v.null()]), 1339 1127 path: v.object({ 1340 - parameterPath: v.union([ 1341 - v.string(), 1342 - v.null() 1343 - ]), 1344 - 'api-version': v.union([ 1345 - v.string(), 1346 - v.null() 1347 - ]) 1128 + parameterPath: v.union([v.string(), v.null()]), 1129 + 'api-version': v.union([v.string(), v.null()]) 1348 1130 }), 1349 1131 query: v.object({ 1350 1132 foo_ref_enum: v.optional(vModelWithNestedArrayEnumsDataFoo), 1351 1133 foo_all_of_enum: vModelWithNestedArrayEnumsDataFoo, 1352 - cursor: v.union([ 1353 - v.string(), 1354 - v.null() 1355 - ]) 1134 + cursor: v.union([v.string(), v.null()]) 1356 1135 }), 1357 1136 headers: v.object({ 1358 - parameterHeader: v.union([ 1359 - v.string(), 1360 - v.null() 1361 - ]) 1137 + parameterHeader: v.union([v.string(), v.null()]) 1362 1138 }) 1363 1139 }); 1364 1140 1365 1141 export const vCallWithWeirdParameterNamesData = v.object({ 1366 - body: v.union([ 1367 - vModelWithString, 1368 - v.null() 1369 - ]), 1142 + body: v.union([vModelWithString, v.null()]), 1370 1143 path: v.object({ 1371 1144 'parameter.path.1': v.optional(v.string()), 1372 1145 'parameter-path-2': v.optional(v.string()), 1373 1146 'PARAMETER-PATH-3': v.optional(v.string()), 1374 - 'api-version': v.union([ 1375 - v.string(), 1376 - v.null() 1377 - ]) 1147 + 'api-version': v.union([v.string(), v.null()]) 1378 1148 }), 1379 1149 query: v.object({ 1380 1150 default: v.optional(v.string()), 1381 - 'parameter-query': v.union([ 1382 - v.string(), 1383 - v.null() 1384 - ]) 1151 + 'parameter-query': v.union([v.string(), v.null()]) 1385 1152 }), 1386 1153 headers: v.object({ 1387 - 'parameter.header': v.union([ 1388 - v.string(), 1389 - v.null() 1390 - ]) 1154 + 'parameter.header': v.union([v.string(), v.null()]) 1391 1155 }) 1392 1156 }); 1393 1157 ··· 1401 1165 1402 1166 export const vPostCallWithOptionalParamData = v.object({ 1403 1167 body: v.optional(v.object({ 1404 - offset: v.optional(v.union([ 1405 - v.number(), 1406 - v.null() 1407 - ])) 1168 + offset: v.optional(v.union([v.number(), v.null()])) 1408 1169 })), 1409 1170 path: v.optional(v.never()), 1410 1171 query: v.object({ ··· 1412 1173 }) 1413 1174 }); 1414 1175 1415 - export const vPostCallWithOptionalParamResponse = v.union([ 1416 - v.number(), 1417 - v.void() 1418 - ]); 1176 + export const vPostCallWithOptionalParamResponse = v.union([v.number(), v.void()]); 1419 1177 1420 1178 export const vPostApiVbyApiVersionRequestBodyData = v.object({ 1421 1179 body: v.optional(vSimpleRequestBody), ··· 1437 1195 body: v.optional(v.never()), 1438 1196 path: v.optional(v.never()), 1439 1197 query: v.optional(v.object({ 1440 - parameterString: v.optional(v.union([ 1441 - v.optional(v.string(), 'Hello World!'), 1442 - v.null() 1443 - ]), 'Hello World!'), 1444 - parameterNumber: v.optional(v.union([ 1445 - v.optional(v.number(), 123), 1446 - v.null() 1447 - ]), 123), 1448 - parameterBoolean: v.optional(v.union([ 1449 - v.optional(v.boolean(), true), 1450 - v.null() 1451 - ]), true), 1198 + parameterString: v.optional(v.union([v.optional(v.string(), "Hello World!"), v.null()]), "Hello World!"), 1199 + parameterNumber: v.optional(v.union([v.optional(v.number(), 123), v.null()]), 123), 1200 + parameterBoolean: v.optional(v.union([v.optional(v.boolean(), true), v.null()]), true), 1452 1201 parameterEnum: v.optional(v.picklist([ 1453 - 'Success', 1454 - 'Warning', 1455 - 'Error' 1202 + "Success", 1203 + "Warning", 1204 + "Error" 1456 1205 ])), 1457 - parameterModel: v.optional(v.union([ 1458 - v.optional(vModelWithString, { 1459 - prop: 'Hello World!' 1460 - }), 1461 - v.null() 1462 - ])) 1206 + parameterModel: v.optional(v.union([v.optional(vModelWithString, { prop: "Hello World!" }), v.null()])) 1463 1207 })) 1464 1208 }); 1465 1209 ··· 1467 1211 body: v.optional(v.never()), 1468 1212 path: v.optional(v.never()), 1469 1213 query: v.optional(v.object({ 1470 - parameterString: v.optional(v.string(), 'Hello World!'), 1214 + parameterString: v.optional(v.string(), "Hello World!"), 1471 1215 parameterNumber: v.optional(v.number(), 123), 1472 1216 parameterBoolean: v.optional(v.boolean(), true), 1473 1217 parameterEnum: v.optional(v.picklist([ 1474 - 'Success', 1475 - 'Warning', 1476 - 'Error' 1218 + "Success", 1219 + "Warning", 1220 + "Error" 1477 1221 ])), 1478 - parameterModel: v.optional(vModelWithString, { 1479 - prop: 'Hello World!' 1480 - }) 1222 + parameterModel: v.optional(vModelWithString, { prop: "Hello World!" }) 1481 1223 })) 1482 1224 }); 1483 1225 ··· 1485 1227 body: v.optional(v.never()), 1486 1228 path: v.optional(v.never()), 1487 1229 query: v.object({ 1488 - parameterOptionalStringWithDefault: v.optional(v.string(), 'Hello World!'), 1489 - parameterOptionalStringWithEmptyDefault: v.optional(v.string(), ''), 1230 + parameterOptionalStringWithDefault: v.optional(v.string(), "Hello World!"), 1231 + parameterOptionalStringWithEmptyDefault: v.optional(v.string(), ""), 1490 1232 parameterOptionalStringWithNoDefault: v.optional(v.string()), 1491 - parameterStringWithDefault: v.optional(v.string(), 'Hello World!'), 1492 - parameterStringWithEmptyDefault: v.optional(v.string(), ''), 1233 + parameterStringWithDefault: v.optional(v.string(), "Hello World!"), 1234 + parameterStringWithEmptyDefault: v.optional(v.string(), ""), 1493 1235 parameterStringWithNoDefault: v.string(), 1494 - parameterStringNullableWithNoDefault: v.optional(v.union([ 1495 - v.string(), 1496 - v.null() 1497 - ])), 1498 - parameterStringNullableWithDefault: v.optional(v.union([ 1499 - v.string(), 1500 - v.null() 1501 - ]), null) 1236 + parameterStringNullableWithNoDefault: v.optional(v.union([v.string(), v.null()])), 1237 + parameterStringNullableWithDefault: v.optional(v.union([v.string(), v.null()]), null) 1502 1238 }) 1503 1239 }); 1504 1240 ··· 1543 1279 query: v.optional(v.never()) 1544 1280 }); 1545 1281 1546 - export const vCallWithResponseAndNoContentResponseResponse = v.union([ 1547 - v.number(), 1548 - v.void() 1549 - ]); 1282 + export const vCallWithResponseAndNoContentResponseResponse = v.union([v.number(), v.void()]); 1550 1283 1551 1284 export const vDummyAData = v.object({ 1552 1285 body: v.optional(v.never()), ··· 1581 1314 query: v.optional(v.never()) 1582 1315 }); 1583 1316 1584 - export const vCallWithDuplicateResponsesResponse = v.union([ 1585 - v.intersect([ 1586 - vModelWithBoolean, 1587 - vModelWithInteger 1588 - ]), 1589 - vModelWithString 1590 - ]); 1317 + export const vCallWithDuplicateResponsesResponse = v.union([v.intersect([vModelWithBoolean, vModelWithInteger]), vModelWithString]); 1591 1318 1592 1319 export const vCallWithResponsesData = v.object({ 1593 1320 body: v.optional(v.never()), ··· 1609 1336 body: v.optional(v.never()), 1610 1337 path: v.optional(v.never()), 1611 1338 query: v.object({ 1612 - parameterArrayCSV: v.union([ 1613 - v.array(v.string()), 1614 - v.null() 1615 - ]), 1616 - parameterArraySSV: v.union([ 1617 - v.array(v.string()), 1618 - v.null() 1619 - ]), 1620 - parameterArrayTSV: v.union([ 1621 - v.array(v.string()), 1622 - v.null() 1623 - ]), 1624 - parameterArrayPipes: v.union([ 1625 - v.array(v.string()), 1626 - v.null() 1627 - ]), 1628 - parameterArrayMulti: v.union([ 1629 - v.array(v.string()), 1630 - v.null() 1631 - ]) 1339 + parameterArrayCSV: v.union([v.array(v.string()), v.null()]), 1340 + parameterArraySSV: v.union([v.array(v.string()), v.null()]), 1341 + parameterArrayTSV: v.union([v.array(v.string()), v.null()]), 1342 + parameterArrayPipes: v.union([v.array(v.string()), v.null()]), 1343 + parameterArrayMulti: v.union([v.array(v.string()), v.null()]) 1632 1344 }) 1633 1345 }); 1634 1346 1635 1347 export const vTypesData = v.object({ 1636 1348 body: v.optional(v.never()), 1637 1349 path: v.optional(v.object({ 1638 - id: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2^31'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2^31-1'))) 1350 + id: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, "Invalid value: Expected int32 to be >= -2^31"), v.maxValue(2147483647, "Invalid value: Expected int32 to be <= 2^31-1"))) 1639 1351 })), 1640 1352 query: v.object({ 1641 1353 parameterNumber: v.optional(v.number(), 123), 1642 - parameterString: v.optional(v.union([ 1643 - v.optional(v.string(), 'default'), 1644 - v.null() 1645 - ]), 'default'), 1646 - parameterBoolean: v.optional(v.union([ 1647 - v.optional(v.boolean(), true), 1648 - v.null() 1649 - ]), true), 1650 - parameterObject: v.optional(v.union([ 1651 - v.record(v.string(), v.unknown()), 1652 - v.null() 1653 - ]), null), 1654 - parameterArray: v.union([ 1655 - v.array(v.string()), 1656 - v.null() 1657 - ]), 1658 - parameterDictionary: v.union([ 1659 - v.record(v.string(), v.unknown()), 1660 - v.null() 1661 - ]), 1354 + parameterString: v.optional(v.union([v.optional(v.string(), "default"), v.null()]), "default"), 1355 + parameterBoolean: v.optional(v.union([v.optional(v.boolean(), true), v.null()]), true), 1356 + parameterObject: v.optional(v.union([v.record(v.string(), v.unknown()), v.null()]), null), 1357 + parameterArray: v.union([v.array(v.string()), v.null()]), 1358 + parameterDictionary: v.union([v.record(v.string(), v.unknown()), v.null()]), 1662 1359 parameterEnum: v.union([ 1663 1360 v.literal("Success"), 1664 1361 v.literal("Warning"), ··· 1678 1375 export const vUploadFileData = v.object({ 1679 1376 body: v.string(), 1680 1377 path: v.object({ 1681 - 'api-version': v.union([ 1682 - v.string(), 1683 - v.null() 1684 - ]) 1378 + 'api-version': v.union([v.string(), v.null()]) 1685 1379 }), 1686 1380 query: v.optional(v.never()) 1687 1381 }); ··· 1742 1436 export const vMultipartRequestData = v.object({ 1743 1437 body: v.optional(v.object({ 1744 1438 content: v.optional(v.string()), 1745 - data: v.optional(v.union([ 1746 - vModelWithString, 1747 - v.null() 1748 - ])) 1439 + data: v.optional(v.union([vModelWithString, v.null()])) 1749 1440 })), 1750 1441 path: v.optional(v.never()), 1751 1442 query: v.optional(v.never()) ··· 1753 1444 1754 1445 export const vComplexParamsData = v.object({ 1755 1446 body: v.optional(v.object({ 1756 - key: v.pipe(v.union([ 1757 - v.pipe(v.pipe(v.string(), v.maxLength(64), v.regex(/^[a-zA-Z0-9_]*$/)), v.readonly()), 1758 - v.null() 1759 - ]), v.readonly()), 1760 - name: v.union([ 1761 - v.pipe(v.string(), v.maxLength(255)), 1762 - v.null() 1763 - ]), 1447 + key: v.pipe(v.union([v.pipe(v.pipe(v.string(), v.maxLength(64), v.regex(/^[a-zA-Z0-9_]*$/)), v.readonly()), v.null()]), v.readonly()), 1448 + name: v.union([v.pipe(v.string(), v.maxLength(255)), v.null()]), 1764 1449 enabled: v.optional(v.boolean(), true), 1765 1450 type: v.picklist([ 1766 - 'Monkey', 1767 - 'Horse', 1768 - 'Bird' 1451 + "Monkey", 1452 + "Horse", 1453 + "Bird" 1769 1454 ]), 1770 - listOfModels: v.optional(v.union([ 1771 - v.array(vModelWithString), 1772 - v.null() 1773 - ])), 1774 - listOfStrings: v.optional(v.union([ 1775 - v.array(v.string()), 1776 - v.null() 1777 - ])), 1455 + listOfModels: v.optional(v.union([v.array(vModelWithString), v.null()])), 1456 + listOfStrings: v.optional(v.union([v.array(v.string()), v.null()])), 1778 1457 parameters: v.union([ 1779 1458 vModelWithString, 1780 1459 vModelWithEnum, ··· 1782 1461 vModelWithDictionary 1783 1462 ]), 1784 1463 user: v.optional(v.pipe(v.object({ 1785 - id: v.optional(v.pipe(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2^31'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2^31-1')), v.readonly())), 1786 - name: v.optional(v.pipe(v.union([ 1787 - v.pipe(v.string(), v.readonly()), 1788 - v.null() 1789 - ]), v.readonly())) 1464 + id: v.optional(v.pipe(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, "Invalid value: Expected int32 to be >= -2^31"), v.maxValue(2147483647, "Invalid value: Expected int32 to be <= 2^31-1")), v.readonly())), 1465 + name: v.optional(v.pipe(v.union([v.pipe(v.string(), v.readonly()), v.null()]), v.readonly())) 1790 1466 }), v.readonly())) 1791 1467 })), 1792 1468 path: v.object({ 1793 - id: v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2^31'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2^31-1')), 1469 + id: v.pipe(v.number(), v.integer(), v.minValue(-2147483648, "Invalid value: Expected int32 to be >= -2^31"), v.maxValue(2147483647, "Invalid value: Expected int32 to be <= 2^31-1")), 1794 1470 'api-version': v.string() 1795 1471 }), 1796 1472 query: v.optional(v.never())
+8 -8
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/schema-const/valibot.gen.ts
··· 11 11 v.literal(1), 12 12 v.literal(2), 13 13 v.literal(3), 14 - v.literal('foo'), 14 + v.literal("foo"), 15 15 v.literal(true) 16 16 ])), 17 17 corge: v.optional(v.record(v.string(), v.unknown())), 18 - garply: v.optional(v.literal(BigInt('10'))), 18 + garply: v.optional(v.literal(BigInt("10"))), 19 19 numberInt8: v.optional(v.literal(100)), 20 20 numberInt16: v.optional(v.literal(1000)), 21 21 numberInt32: v.optional(v.literal(100000)), 22 - numberInt64: v.optional(v.literal(BigInt('1000000000000'))), 22 + numberInt64: v.optional(v.literal(BigInt(1000000000000))), 23 23 numberUint8: v.optional(v.literal(200)), 24 24 numberUint16: v.optional(v.literal(50000)), 25 25 numberUint32: v.optional(v.literal(3000000000)), 26 - numberUint64: v.optional(v.literal(BigInt('18000000000000000000'))), 26 + numberUint64: v.optional(v.literal(BigInt(18000000000000000000))), 27 27 integerInt8: v.optional(v.literal(-100)), 28 28 integerInt16: v.optional(v.literal(-1000)), 29 29 integerInt32: v.optional(v.literal(-100000)), 30 - integerInt64: v.optional(v.literal(BigInt('-1000000000000'))), 30 + integerInt64: v.optional(v.literal(BigInt(-1000000000000))), 31 31 integerUint8: v.optional(v.literal(255)), 32 32 integerUint16: v.optional(v.literal(65535)), 33 33 integerUint32: v.optional(v.literal(4294967295)), 34 - integerUint64: v.optional(v.literal(BigInt('18446744073709551615'))), 35 - stringInt64: v.optional(v.literal(BigInt('-9223372036854775808'))), 36 - stringUint64: v.optional(v.literal(BigInt('18446744073709551615'))) 34 + integerUint64: v.optional(v.literal(BigInt("18446744073709551615"))), 35 + stringInt64: v.optional(v.literal(BigInt("-9223372036854775808"))), 36 + stringUint64: v.optional(v.literal(BigInt("18446744073709551615"))) 37 37 });
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-bigint-min-max/valibot.gen.ts
··· 7 7 v.number(), 8 8 v.string(), 9 9 v.bigint() 10 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'), v.minValue(BigInt(0)), v.maxValue(BigInt(100)))) 10 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1"), v.minValue(BigInt(0)), v.maxValue(BigInt(100)))) 11 11 });
+1 -6
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-circular-ref-2/valibot.gen.ts
··· 3 3 import * as v from 'valibot'; 4 4 5 5 export const vBar: v.GenericSchema = v.strictObject({ 6 - bar: v.union([ 7 - v.array(v.lazy(() => { 8 - return vBar; 9 - })), 10 - v.null() 11 - ]) 6 + bar: v.union([v.array(v.lazy(() => vBar)), v.null()]) 12 7 }); 13 8 14 9 export const vFoo = v.strictObject({
+2 -6
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-circular-ref/valibot.gen.ts
··· 3 3 import * as v from 'valibot'; 4 4 5 5 export const vBar: v.GenericSchema = v.object({ 6 - bar: v.optional(v.array(v.lazy(() => { 7 - return vBar; 8 - }))) 6 + bar: v.optional(v.array(v.lazy(() => vBar))) 9 7 }); 10 8 11 9 export const vFoo = v.object({ 12 10 foo: v.optional(vBar) 13 11 }); 14 12 15 - export const vBaz: v.GenericSchema = v.lazy(() => { 16 - return vQux; 17 - }); 13 + export const vBaz: v.GenericSchema = v.lazy(() => vQux); 18 14 19 15 /** 20 16 * description caused circular reference error
+10 -29
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-metadata/valibot.gen.ts
··· 2 2 3 3 import * as v from 'valibot'; 4 4 5 - export const vBaz = v.optional(v.pipe(v.pipe(v.string(), v.regex(/foo\nbar/)), v.readonly()), 'baz'); 5 + export const vBaz = v.optional(v.pipe(v.pipe(v.string(), v.regex(/foo\nbar/)), v.readonly()), "baz"); 6 6 7 7 export const vQux = v.record(v.string(), v.object({ 8 8 qux: v.optional(v.string()) ··· 11 11 /** 12 12 * This is Foo schema. 13 13 */ 14 - export const vFoo: v.GenericSchema = v.optional(v.union([ 15 - v.object({ 16 - foo: v.optional(v.pipe(v.pipe(v.string(), v.regex(/^\d{3}-\d{2}-\d{4}$/)), v.metadata({ 17 - description: 'This is foo property.' 18 - }))), 19 - bar: v.optional(v.lazy(() => { 20 - return vBar; 21 - })), 22 - baz: v.optional(v.pipe(v.array(v.lazy(() => { 23 - return vFoo; 24 - })), v.metadata({ 25 - description: 'This is baz property.' 26 - }))), 27 - qux: v.optional(v.pipe(v.pipe(v.number(), v.integer(), v.gtValue(0)), v.metadata({ 28 - description: 'This is qux property.' 29 - })), 0) 30 - }), 31 - v.null() 32 - ]), null); 14 + export const vFoo: v.GenericSchema = v.optional(v.union([v.object({ 15 + foo: v.optional(v.pipe(v.pipe(v.string(), v.regex(/^\d{3}-\d{2}-\d{4}$/)), v.metadata({ description: "This is foo property." }))), 16 + bar: v.optional(v.lazy(() => vBar)), 17 + baz: v.optional(v.pipe(v.array(v.lazy(() => vFoo)), v.metadata({ description: "This is baz property." }))), 18 + qux: v.optional(v.pipe(v.pipe(v.number(), v.integer(), v.gtValue(0)), v.metadata({ description: "This is qux property." })), 0) 19 + }), v.null()]), null); 33 20 34 21 /** 35 22 * This is Bar schema. 36 23 */ 37 24 export const vBar = v.pipe(v.object({ 38 25 foo: v.optional(vFoo) 39 - }), v.metadata({ 40 - description: 'This is Bar schema.' 41 - })); 26 + }), v.metadata({ description: "This is Bar schema." })); 42 27 43 28 /** 44 29 * This is Foo parameter. 45 30 */ 46 - export const vFoo2 = v.pipe(v.string(), v.metadata({ 47 - description: 'This is Foo parameter.' 48 - })); 31 + export const vFoo2 = v.pipe(v.string(), v.metadata({ description: "This is Foo parameter." })); 49 32 50 33 export const vFoo3 = v.object({ 51 34 foo: v.optional(vBar) ··· 57 40 }), 58 41 path: v.optional(v.never()), 59 42 query: v.optional(v.object({ 60 - foo: v.optional(v.pipe(v.string(), v.metadata({ 61 - description: 'This is Foo parameter.' 62 - }))), 43 + foo: v.optional(v.pipe(v.string(), v.metadata({ description: "This is Foo parameter." }))), 63 44 bar: v.optional(vBar), 64 45 baz: v.optional(v.object({ 65 46 baz: v.optional(v.string())
+5 -12
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-types/valibot.gen.ts
··· 2 2 3 3 import * as v from 'valibot'; 4 4 5 - export const vBaz = v.optional(v.pipe(v.pipe(v.string(), v.regex(/foo\nbar/)), v.readonly()), 'baz'); 5 + export const vBaz = v.optional(v.pipe(v.pipe(v.string(), v.regex(/foo\nbar/)), v.readonly()), "baz"); 6 6 7 7 export const vQux = v.record(v.string(), v.object({ 8 8 qux: v.optional(v.string()) ··· 11 11 /** 12 12 * This is Foo schema. 13 13 */ 14 - export const vFoo: v.GenericSchema = v.optional(v.union([ 15 - v.object({ 14 + export const vFoo: v.GenericSchema = v.optional(v.union([v.object({ 16 15 foo: v.optional(v.pipe(v.string(), v.regex(/^\d{3}-\d{2}-\d{4}$/))), 17 - bar: v.optional(v.lazy(() => { 18 - return vBar; 19 - })), 20 - baz: v.optional(v.array(v.lazy(() => { 21 - return vFoo; 22 - }))), 16 + bar: v.optional(v.lazy(() => vBar)), 17 + baz: v.optional(v.array(v.lazy(() => vFoo))), 23 18 qux: v.optional(v.pipe(v.number(), v.integer(), v.gtValue(0)), 0) 24 - }), 25 - v.null() 26 - ]), null); 19 + }), v.null()]), null); 27 20 28 21 /** 29 22 * This is Bar schema.
+10 -22
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-union-merge/valibot.gen.ts
··· 2 2 3 3 import * as v from 'valibot'; 4 4 5 - export const vContact = v.union([ 6 - v.object({ 5 + export const vContact = v.union([v.object({ 7 6 email: v.string() 8 - }), 9 - v.object({ 7 + }), v.object({ 10 8 phone: v.string() 11 - }) 12 - ]); 9 + })]); 13 10 14 - export const vUser = v.intersect([ 15 - vContact, 16 - v.object({ 11 + export const vUser = v.intersect([vContact, v.object({ 17 12 username: v.string() 18 - }) 19 - ]); 13 + })]); 20 14 21 15 export const vDogDetails = v.object({ 22 16 breed: v.string(), ··· 25 19 26 20 export const vCatDetails = v.object({ 27 21 furLength: v.picklist([ 28 - 'short', 29 - 'medium', 30 - 'long' 22 + "short", 23 + "medium", 24 + "long" 31 25 ]), 32 26 purrs: v.boolean() 33 27 }); ··· 35 29 export const vPetStore = v.object({ 36 30 animals: v.array(v.object({ 37 31 name: v.string(), 38 - type: v.optional(v.picklist([ 39 - 'dog', 40 - 'cat' 41 - ])), 42 - details: v.union([ 43 - vDogDetails, 44 - vCatDetails 45 - ]) 32 + type: v.optional(v.picklist(["dog", "cat"])), 33 + details: v.union([vDogDetails, vCatDetails]) 46 34 })) 47 35 });
+5 -12
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators/valibot.gen.ts
··· 2 2 3 3 import * as v from 'valibot'; 4 4 5 - export const vBaz = v.optional(v.pipe(v.pipe(v.string(), v.regex(/foo\nbar/)), v.readonly()), 'baz'); 5 + export const vBaz = v.optional(v.pipe(v.pipe(v.string(), v.regex(/foo\nbar/)), v.readonly()), "baz"); 6 6 7 7 export const vQux = v.record(v.string(), v.object({ 8 8 qux: v.optional(v.string()) ··· 11 11 /** 12 12 * This is Foo schema. 13 13 */ 14 - export const vFoo: v.GenericSchema = v.optional(v.union([ 15 - v.object({ 14 + export const vFoo: v.GenericSchema = v.optional(v.union([v.object({ 16 15 foo: v.optional(v.pipe(v.string(), v.regex(/^\d{3}-\d{2}-\d{4}$/))), 17 - bar: v.optional(v.lazy(() => { 18 - return vBar; 19 - })), 20 - baz: v.optional(v.array(v.lazy(() => { 21 - return vFoo; 22 - }))), 16 + bar: v.optional(v.lazy(() => vBar)), 17 + baz: v.optional(v.array(v.lazy(() => vFoo))), 23 18 qux: v.optional(v.pipe(v.number(), v.integer(), v.gtValue(0)), 0) 24 - }), 25 - v.null() 26 - ]), null); 19 + }), v.null()]), null); 27 20 28 21 /** 29 22 * This is Bar schema.
+202 -265
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/webhooks/valibot.gen.ts
··· 9 9 v.number(), 10 10 v.string(), 11 11 v.bigint() 12 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 12 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 13 13 payload: v.strictObject({ 14 14 account_id: v.string(), 15 15 object: v.strictObject({ ··· 17 17 v.number(), 18 18 v.string(), 19 19 v.bigint() 20 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'))), 20 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1"))), 21 21 uuid: v.optional(v.string()), 22 22 session_id: v.string(), 23 23 session_name: v.string(), ··· 30 30 v.number(), 31 31 v.string(), 32 32 v.bigint() 33 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 33 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 34 34 from_number: v.pipe(v.union([ 35 35 v.number(), 36 36 v.string(), 37 37 v.bigint() 38 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')) 38 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")) 39 39 }) 40 40 }) 41 41 }) ··· 51 51 v.number(), 52 52 v.string(), 53 53 v.bigint() 54 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 54 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 55 55 payload: v.strictObject({ 56 56 account_id: v.string(), 57 57 object: v.strictObject({ ··· 59 59 v.number(), 60 60 v.string(), 61 61 v.bigint() 62 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'))), 62 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1"))), 63 63 uuid: v.optional(v.string()), 64 64 session_id: v.string(), 65 65 session_name: v.string(), ··· 79 79 80 80 export const vSessionRecordingStartedWebhookRequest = v.object({ 81 81 body: v.optional(v.strictObject({ 82 - event: v.picklist([ 83 - 'session.recording_started' 84 - ]), 82 + event: v.picklist(["session.recording_started"]), 85 83 event_ts: v.pipe(v.union([ 86 84 v.number(), 87 85 v.string(), 88 86 v.bigint() 89 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 87 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 90 88 payload: v.strictObject({ 91 89 account_id: v.string(), 92 90 object: v.strictObject({ ··· 108 106 109 107 export const vSessionRecordingResumedWebhookRequest = v.object({ 110 108 body: v.optional(v.strictObject({ 111 - event: v.picklist([ 112 - 'session.recording_resumed' 113 - ]), 109 + event: v.picklist(["session.recording_resumed"]), 114 110 event_ts: v.pipe(v.union([ 115 111 v.number(), 116 112 v.string(), 117 113 v.bigint() 118 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 114 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 119 115 payload: v.strictObject({ 120 116 account_id: v.string(), 121 117 object: v.strictObject({ ··· 137 133 138 134 export const vSessionLiveStreamingStoppedWebhookRequest = v.object({ 139 135 body: v.optional(v.strictObject({ 140 - event: v.picklist([ 141 - 'session.live_streaming_stopped' 142 - ]), 136 + event: v.picklist(["session.live_streaming_stopped"]), 143 137 event_ts: v.pipe(v.union([ 144 138 v.number(), 145 139 v.string(), 146 140 v.bigint() 147 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 141 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 148 142 payload: v.strictObject({ 149 143 account_id: v.string(), 150 144 object: v.strictObject({ ··· 155 149 start_time: v.pipe(v.string(), v.isoTimestamp()), 156 150 live_streaming: v.object({ 157 151 service: v.picklist([ 158 - 'Facebook', 159 - 'Workplace_by_Facebook', 160 - 'YouTube', 161 - 'Custom_Live_Streaming_Service' 152 + "Facebook", 153 + "Workplace_by_Facebook", 154 + "YouTube", 155 + "Custom_Live_Streaming_Service" 162 156 ]), 163 157 custom_live_streaming_settings: v.object({ 164 158 stream_url: v.string(), ··· 177 171 178 172 export const vSessionStreamIngestionStoppedWebhookRequest = v.object({ 179 173 body: v.optional(v.strictObject({ 180 - event: v.picklist([ 181 - 'session.stream_ingestion_stopped' 182 - ]), 174 + event: v.picklist(["session.stream_ingestion_stopped"]), 183 175 event_ts: v.pipe(v.union([ 184 176 v.number(), 185 177 v.string(), 186 178 v.bigint() 187 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 179 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 188 180 payload: v.strictObject({ 189 181 account_id: v.string(), 190 182 object: v.strictObject({ ··· 213 205 v.number(), 214 206 v.string(), 215 207 v.bigint() 216 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 208 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 217 209 payload: v.strictObject({ 218 210 account_id: v.string(), 219 211 object: v.strictObject({ ··· 221 213 v.number(), 222 214 v.string(), 223 215 v.bigint() 224 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'))), 216 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1"))), 225 217 uuid: v.optional(v.string()), 226 218 session_id: v.string(), 227 219 session_name: v.string(), ··· 241 233 242 234 export const vSessionAlertWebhookRequest = v.object({ 243 235 body: v.optional(v.strictObject({ 244 - event: v.picklist([ 245 - 'session.alert' 246 - ]), 236 + event: v.picklist(["session.alert"]), 247 237 event_ts: v.pipe(v.union([ 248 238 v.number(), 249 239 v.string(), 250 240 v.bigint() 251 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 241 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 252 242 payload: v.strictObject({ 253 243 account_id: v.string(), 254 244 object: v.strictObject({ ··· 257 247 session_name: v.string(), 258 248 session_key: v.optional(v.string()), 259 249 issues: v.array(v.picklist([ 260 - 'Unstable audio quality', 261 - 'Unstable video quality', 262 - 'Unstable screen share quality', 263 - 'High CPU occupation', 264 - 'Call Reconnection' 250 + "Unstable audio quality", 251 + "Unstable video quality", 252 + "Unstable screen share quality", 253 + "High CPU occupation", 254 + "Call Reconnection" 265 255 ])) 266 256 }) 267 257 }) ··· 272 262 273 263 export const vSessionSharingEndedWebhookRequest = v.object({ 274 264 body: v.optional(v.strictObject({ 275 - event: v.picklist([ 276 - 'session.sharing_ended' 277 - ]), 265 + event: v.picklist(["session.sharing_ended"]), 278 266 event_ts: v.pipe(v.union([ 279 267 v.number(), 280 268 v.string(), 281 269 v.bigint() 282 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 270 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 283 271 payload: v.strictObject({ 284 272 account_id: v.string(), 285 273 object: v.strictObject({ ··· 293 281 user_key: v.optional(v.string()), 294 282 sharing_details: v.strictObject({ 295 283 content: v.picklist([ 296 - 'application', 297 - 'whiteboard', 298 - 'desktop', 299 - 'unknown' 284 + "application", 285 + "whiteboard", 286 + "desktop", 287 + "unknown" 300 288 ]), 301 289 date_time: v.pipe(v.string(), v.isoTimestamp()) 302 290 }) ··· 310 298 311 299 export const vSessionRecordingPausedWebhookRequest = v.object({ 312 300 body: v.optional(v.strictObject({ 313 - event: v.picklist([ 314 - 'session.recording_paused' 315 - ]), 301 + event: v.picklist(["session.recording_paused"]), 316 302 event_ts: v.pipe(v.union([ 317 303 v.number(), 318 304 v.string(), 319 305 v.bigint() 320 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 306 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 321 307 payload: v.strictObject({ 322 308 account_id: v.string(), 323 309 object: v.strictObject({ ··· 339 325 340 326 export const vSessionEndedWebhookRequest = v.object({ 341 327 body: v.optional(v.strictObject({ 342 - event: v.picklist([ 343 - 'session.ended' 344 - ]), 328 + event: v.picklist(["session.ended"]), 345 329 event_ts: v.pipe(v.union([ 346 330 v.number(), 347 331 v.string(), 348 332 v.bigint() 349 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 333 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 350 334 payload: v.strictObject({ 351 335 account_id: v.string(), 352 336 object: v.strictObject({ ··· 365 349 366 350 export const vSessionStartedWebhookRequest = v.object({ 367 351 body: v.optional(v.strictObject({ 368 - event: v.picklist([ 369 - 'session.started' 370 - ]), 352 + event: v.picklist(["session.started"]), 371 353 event_ts: v.pipe(v.union([ 372 354 v.number(), 373 355 v.string(), 374 356 v.bigint() 375 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 357 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 376 358 payload: v.strictObject({ 377 359 account_id: v.string(), 378 360 object: v.strictObject({ ··· 390 372 391 373 export const vSessionStreamIngestionUnbindWebhookRequest = v.object({ 392 374 body: v.optional(v.strictObject({ 393 - event: v.picklist([ 394 - 'session.stream_ingestion_unbind' 395 - ]), 375 + event: v.picklist(["session.stream_ingestion_unbind"]), 396 376 event_ts: v.pipe(v.union([ 397 377 v.number(), 398 378 v.string(), 399 379 v.bigint() 400 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 380 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 401 381 payload: v.strictObject({ 402 382 account_id: v.string(), 403 383 object: v.strictObject({ ··· 421 401 422 402 export const vSessionLiveStreamingStartedWebhookRequest = v.object({ 423 403 body: v.optional(v.strictObject({ 424 - event: v.picklist([ 425 - 'session.live_streaming_started' 426 - ]), 404 + event: v.picklist(["session.live_streaming_started"]), 427 405 event_ts: v.pipe(v.union([ 428 406 v.number(), 429 407 v.string(), 430 408 v.bigint() 431 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 409 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 432 410 payload: v.strictObject({ 433 411 account_id: v.string(), 434 412 object: v.strictObject({ ··· 439 417 start_time: v.pipe(v.string(), v.isoTimestamp()), 440 418 live_streaming: v.object({ 441 419 service: v.picklist([ 442 - 'Facebook', 443 - 'Workplace_by_Facebook', 444 - 'YouTube', 445 - 'Custom_Live_Streaming_Service' 420 + "Facebook", 421 + "Workplace_by_Facebook", 422 + "YouTube", 423 + "Custom_Live_Streaming_Service" 446 424 ]), 447 425 custom_live_streaming_settings: v.object({ 448 426 stream_url: v.string(), ··· 466 444 v.number(), 467 445 v.string(), 468 446 v.bigint() 469 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 447 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 470 448 payload: v.strictObject({ 471 449 account_id: v.string(), 472 450 object: v.strictObject({ ··· 474 452 v.number(), 475 453 v.string(), 476 454 v.bigint() 477 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'))), 455 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1"))), 478 456 uuid: v.optional(v.string()), 479 457 session_id: v.string(), 480 458 session_name: v.string(), ··· 499 477 v.number(), 500 478 v.string(), 501 479 v.bigint() 502 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 480 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 503 481 payload: v.strictObject({ 504 482 account_id: v.string(), 505 483 object: v.strictObject({ ··· 507 485 v.number(), 508 486 v.string(), 509 487 v.bigint() 510 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'))), 488 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1"))), 511 489 uuid: v.optional(v.string()), 512 490 session_id: v.string(), 513 491 session_name: v.string(), ··· 520 498 v.number(), 521 499 v.string(), 522 500 v.bigint() 523 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 501 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 524 502 from_number: v.pipe(v.union([ 525 503 v.number(), 526 504 v.string(), 527 505 v.bigint() 528 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')) 506 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")) 529 507 }) 530 508 }) 531 509 }) ··· 536 514 537 515 export const vSessionUserLeftWebhookRequest = v.object({ 538 516 body: v.optional(v.strictObject({ 539 - event: v.picklist([ 540 - 'session.user_left' 541 - ]), 517 + event: v.picklist(["session.user_left"]), 542 518 event_ts: v.pipe(v.union([ 543 519 v.number(), 544 520 v.string(), 545 521 v.bigint() 546 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 522 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 547 523 payload: v.strictObject({ 548 524 account_id: v.string(), 549 525 object: v.strictObject({ ··· 569 545 570 546 export const vSessionSharingStartedWebhookRequest = v.object({ 571 547 body: v.optional(v.strictObject({ 572 - event: v.picklist([ 573 - 'session.sharing_started' 574 - ]), 548 + event: v.picklist(["session.sharing_started"]), 575 549 event_ts: v.pipe(v.union([ 576 550 v.number(), 577 551 v.string(), 578 552 v.bigint() 579 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 553 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 580 554 payload: v.strictObject({ 581 555 account_id: v.string(), 582 556 object: v.strictObject({ ··· 590 564 user_key: v.optional(v.string()), 591 565 sharing_details: v.strictObject({ 592 566 content: v.picklist([ 593 - 'application', 594 - 'whiteboard', 595 - 'desktop', 596 - 'unknown' 567 + "application", 568 + "whiteboard", 569 + "desktop", 570 + "unknown" 597 571 ]), 598 572 date_time: v.pipe(v.string(), v.isoTimestamp()) 599 573 }) ··· 612 586 v.number(), 613 587 v.string(), 614 588 v.bigint() 615 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 589 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 616 590 payload: v.strictObject({ 617 591 account_id: v.string(), 618 592 object: v.strictObject({ ··· 626 600 v.number(), 627 601 v.string(), 628 602 v.bigint() 629 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 603 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 630 604 from_number: v.pipe(v.union([ 631 605 v.number(), 632 606 v.string(), 633 607 v.bigint() 634 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')) 608 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")) 635 609 }) 636 610 }) 637 611 }) ··· 642 616 643 617 export const vSessionRecordingTranscriptCompletedWebhookRequest = v.object({ 644 618 body: v.optional(v.strictObject({ 645 - event: v.picklist([ 646 - 'session.recording_transcript_completed' 647 - ]), 619 + event: v.picklist(["session.recording_transcript_completed"]), 648 620 event_ts: v.pipe(v.union([ 649 621 v.number(), 650 622 v.string(), 651 623 v.bigint() 652 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 624 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 653 625 download_token: v.string(), 654 626 payload: v.strictObject({ 655 627 account_id: v.string(), ··· 666 638 file_name: v.optional(v.string()), 667 639 file_path: v.optional(v.string()), 668 640 file_type: v.optional(v.picklist([ 669 - 'MP4', 670 - 'M4A', 671 - 'CHAT', 672 - 'TRANSCRIPT', 673 - 'CSV', 674 - 'CC', 675 - 'TB', 676 - 'CHAT_MESSAGE', 677 - 'TIMELINE' 641 + "MP4", 642 + "M4A", 643 + "CHAT", 644 + "TRANSCRIPT", 645 + "CSV", 646 + "CC", 647 + "TB", 648 + "CHAT_MESSAGE", 649 + "TIMELINE" 678 650 ])), 679 651 file_size: v.optional(v.number()), 680 652 file_extension: v.optional(v.picklist([ 681 - 'MP4', 682 - 'M4A', 683 - 'TXT', 684 - 'VTT', 685 - 'CSV', 686 - 'JSON', 687 - 'JPG' 653 + "MP4", 654 + "M4A", 655 + "TXT", 656 + "VTT", 657 + "CSV", 658 + "JSON", 659 + "JPG" 688 660 ])), 689 661 download_url: v.optional(v.string()), 690 - status: v.optional(v.picklist([ 691 - 'completed' 692 - ])), 662 + status: v.optional(v.picklist(["completed"])), 693 663 recording_type: v.optional(v.picklist([ 694 - 'shared_screen_with_speaker_view(CC)', 695 - 'shared_screen_with_speaker_view', 696 - 'shared_screen_with_gallery_view', 697 - 'gallery_view', 698 - 'shared_screen', 699 - 'audio_only', 700 - 'audio_transcript', 701 - 'chat_file', 702 - 'active_speaker', 703 - 'host_video', 704 - 'audio_only_each_participant', 705 - 'cc_transcript', 706 - 'closed_caption', 707 - 'poll', 708 - 'timeline', 709 - 'thumbnail', 710 - 'chat_message' 664 + "shared_screen_with_speaker_view(CC)", 665 + "shared_screen_with_speaker_view", 666 + "shared_screen_with_gallery_view", 667 + "gallery_view", 668 + "shared_screen", 669 + "audio_only", 670 + "audio_transcript", 671 + "chat_file", 672 + "active_speaker", 673 + "host_video", 674 + "audio_only_each_participant", 675 + "cc_transcript", 676 + "closed_caption", 677 + "poll", 678 + "timeline", 679 + "thumbnail", 680 + "chat_message" 711 681 ])) 712 682 })) 713 683 }) ··· 719 689 720 690 export const vSessionRecordingDeletedWebhookRequest = v.object({ 721 691 body: v.optional(v.strictObject({ 722 - event: v.picklist([ 723 - 'session.recording_deleted' 724 - ]), 692 + event: v.picklist(["session.recording_deleted"]), 725 693 event_ts: v.pipe(v.union([ 726 694 v.number(), 727 695 v.string(), 728 696 v.bigint() 729 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 697 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 730 698 payload: v.strictObject({ 731 699 account_id: v.string(), 732 700 operator: v.pipe(v.string(), v.email()), ··· 751 719 v.number(), 752 720 v.string(), 753 721 v.bigint() 754 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 722 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 755 723 payload: v.strictObject({ 756 724 account_id: v.string(), 757 725 object: v.strictObject({ ··· 759 727 v.number(), 760 728 v.string(), 761 729 v.bigint() 762 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'))), 730 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1"))), 763 731 uuid: v.optional(v.string()), 764 732 session_id: v.string(), 765 733 session_name: v.string(), ··· 780 748 781 749 export const vSessionRecordingCompletedWebhookRequest = v.object({ 782 750 body: v.optional(v.strictObject({ 783 - event: v.picklist([ 784 - 'session.recording_completed' 785 - ]), 751 + event: v.picklist(["session.recording_completed"]), 786 752 event_ts: v.pipe(v.union([ 787 753 v.number(), 788 754 v.string(), 789 755 v.bigint() 790 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 756 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 791 757 download_token: v.string(), 792 758 payload: v.strictObject({ 793 759 account_id: v.string(), ··· 804 770 file_name: v.optional(v.string()), 805 771 file_path: v.optional(v.string()), 806 772 file_type: v.optional(v.picklist([ 807 - 'MP4', 808 - 'M4A', 809 - 'CHAT', 810 - 'TRANSCRIPT', 811 - 'CSV', 812 - 'CC', 813 - 'TB', 814 - 'CHAT_MESSAGE' 773 + "MP4", 774 + "M4A", 775 + "CHAT", 776 + "TRANSCRIPT", 777 + "CSV", 778 + "CC", 779 + "TB", 780 + "CHAT_MESSAGE" 815 781 ])), 816 782 file_size: v.optional(v.number()), 817 783 file_extension: v.optional(v.picklist([ 818 - 'MP4', 819 - 'M4A', 820 - 'TXT', 821 - 'VTT', 822 - 'CSV', 823 - 'JSON', 824 - 'JPG' 784 + "MP4", 785 + "M4A", 786 + "TXT", 787 + "VTT", 788 + "CSV", 789 + "JSON", 790 + "JPG" 825 791 ])), 826 792 download_url: v.optional(v.string()), 827 - status: v.optional(v.picklist([ 828 - 'completed' 829 - ])), 793 + status: v.optional(v.picklist(["completed"])), 830 794 recording_type: v.optional(v.picklist([ 831 - 'shared_screen_with_speaker_view(CC)', 832 - 'shared_screen_with_speaker_view', 833 - 'shared_screen_with_gallery_view', 834 - 'gallery_view', 835 - 'shared_screen', 836 - 'audio_only', 837 - 'audio_transcript', 838 - 'chat_file', 839 - 'active_speaker', 840 - 'host_video', 841 - 'audio_only_each_participant', 842 - 'cc_transcript', 843 - 'closed_caption', 844 - 'poll', 845 - 'timeline', 846 - 'thumbnail', 847 - 'chat_message' 795 + "shared_screen_with_speaker_view(CC)", 796 + "shared_screen_with_speaker_view", 797 + "shared_screen_with_gallery_view", 798 + "gallery_view", 799 + "shared_screen", 800 + "audio_only", 801 + "audio_transcript", 802 + "chat_file", 803 + "active_speaker", 804 + "host_video", 805 + "audio_only_each_participant", 806 + "cc_transcript", 807 + "closed_caption", 808 + "poll", 809 + "timeline", 810 + "thumbnail", 811 + "chat_message" 848 812 ])) 849 813 })), 850 814 participant_audio_files: v.optional(v.array(v.object({ ··· 854 818 file_name: v.optional(v.string()), 855 819 file_path: v.optional(v.string()), 856 820 file_type: v.optional(v.picklist([ 857 - 'MP4', 858 - 'M4A', 859 - 'CHAT', 860 - 'TRANSCRIPT', 861 - 'CSV', 862 - 'CC', 863 - 'TB', 864 - 'CHAT_MESSAGE' 821 + "MP4", 822 + "M4A", 823 + "CHAT", 824 + "TRANSCRIPT", 825 + "CSV", 826 + "CC", 827 + "TB", 828 + "CHAT_MESSAGE" 865 829 ])), 866 830 file_size: v.optional(v.number()), 867 831 file_extension: v.optional(v.picklist([ 868 - 'MP4', 869 - 'M4A', 870 - 'TXT', 871 - 'VTT', 872 - 'CSV', 873 - 'JSON', 874 - 'JPG' 832 + "MP4", 833 + "M4A", 834 + "TXT", 835 + "VTT", 836 + "CSV", 837 + "JSON", 838 + "JPG" 875 839 ])), 876 840 download_url: v.optional(v.string()), 877 - status: v.optional(v.picklist([ 878 - 'completed' 879 - ])), 841 + status: v.optional(v.picklist(["completed"])), 880 842 recording_type: v.optional(v.picklist([ 881 - 'shared_screen_with_speaker_view(CC)', 882 - 'shared_screen_with_speaker_view', 883 - 'shared_screen_with_gallery_view', 884 - 'gallery_view', 885 - 'shared_screen', 886 - 'audio_only', 887 - 'audio_transcript', 888 - 'chat_file', 889 - 'active_speaker', 890 - 'host_video', 891 - 'audio_only_each_participant', 892 - 'cc_transcript', 893 - 'closed_caption', 894 - 'poll', 895 - 'timeline', 896 - 'thumbnail', 897 - 'chat_message' 843 + "shared_screen_with_speaker_view(CC)", 844 + "shared_screen_with_speaker_view", 845 + "shared_screen_with_gallery_view", 846 + "gallery_view", 847 + "shared_screen", 848 + "audio_only", 849 + "audio_transcript", 850 + "chat_file", 851 + "active_speaker", 852 + "host_video", 853 + "audio_only_each_participant", 854 + "cc_transcript", 855 + "closed_caption", 856 + "poll", 857 + "timeline", 858 + "thumbnail", 859 + "chat_message" 898 860 ])), 899 861 user_id: v.optional(v.string()), 900 862 user_key: v.optional(v.string()) ··· 905 867 recording_end: v.optional(v.string()), 906 868 file_name: v.optional(v.string()), 907 869 file_path: v.optional(v.string()), 908 - file_type: v.optional(v.picklist([ 909 - 'MP4' 910 - ])), 870 + file_type: v.optional(v.picklist(["MP4"])), 911 871 file_size: v.optional(v.number()), 912 - file_extension: v.optional(v.picklist([ 913 - 'MP4' 914 - ])), 872 + file_extension: v.optional(v.picklist(["MP4"])), 915 873 download_url: v.optional(v.string()), 916 - status: v.optional(v.picklist([ 917 - 'completed' 918 - ])), 919 - recording_type: v.optional(v.picklist([ 920 - 'individual_user', 921 - 'individual_shared_screen' 922 - ])), 874 + status: v.optional(v.picklist(["completed"])), 875 + recording_type: v.optional(v.picklist(["individual_user", "individual_shared_screen"])), 923 876 user_id: v.optional(v.string()), 924 877 user_key: v.optional(v.string()) 925 878 }))) ··· 932 885 933 886 export const vSessionRecordingTranscriptFailedWebhookRequest = v.object({ 934 887 body: v.optional(v.strictObject({ 935 - event: v.picklist([ 936 - 'session.recording_transcript_failed' 937 - ]), 888 + event: v.picklist(["session.recording_transcript_failed"]), 938 889 event_ts: v.pipe(v.union([ 939 890 v.number(), 940 891 v.string(), 941 892 v.bigint() 942 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 893 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 943 894 payload: v.strictObject({ 944 895 account_id: v.string(), 945 896 object: v.strictObject({ ··· 957 908 958 909 export const vSessionRecordingTrashedWebhookRequest = v.object({ 959 910 body: v.optional(v.strictObject({ 960 - event: v.picklist([ 961 - 'session.recording_trashed' 962 - ]), 911 + event: v.picklist(["session.recording_trashed"]), 963 912 event_ts: v.pipe(v.union([ 964 913 v.number(), 965 914 v.string(), 966 915 v.bigint() 967 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 916 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 968 917 payload: v.strictObject({ 969 918 account_id: v.string(), 970 919 operator: v.pipe(v.string(), v.email()), ··· 984 933 985 934 export const vSessionUserJoinedWebhookRequest = v.object({ 986 935 body: v.optional(v.strictObject({ 987 - event: v.picklist([ 988 - 'session.user_joined' 989 - ]), 936 + event: v.picklist(["session.user_joined"]), 990 937 event_ts: v.pipe(v.union([ 991 938 v.number(), 992 939 v.string(), 993 940 v.bigint() 994 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 941 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 995 942 payload: v.strictObject({ 996 943 account_id: v.string(), 997 944 object: v.strictObject({ ··· 1016 963 1017 964 export const vSessionStreamIngestionStartedWebhookRequest = v.object({ 1018 965 body: v.optional(v.strictObject({ 1019 - event: v.picklist([ 1020 - 'session.stream_ingestion_started' 1021 - ]), 966 + event: v.picklist(["session.stream_ingestion_started"]), 1022 967 event_ts: v.pipe(v.union([ 1023 968 v.number(), 1024 969 v.string(), 1025 970 v.bigint() 1026 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 971 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 1027 972 payload: v.strictObject({ 1028 973 account_id: v.string(), 1029 974 object: v.strictObject({ ··· 1047 992 1048 993 export const vSessionStreamIngestionConnectedWebhookRequest = v.object({ 1049 994 body: v.optional(v.strictObject({ 1050 - event: v.picklist([ 1051 - 'session.stream_ingestion_connected' 1052 - ]), 995 + event: v.picklist(["session.stream_ingestion_connected"]), 1053 996 event_ts: v.pipe(v.union([ 1054 997 v.number(), 1055 998 v.string(), 1056 999 v.bigint() 1057 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1000 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 1058 1001 payload: v.strictObject({ 1059 1002 account_id: v.string(), 1060 1003 object: v.strictObject({ ··· 1078 1021 1079 1022 export const vSessionStreamIngestionDisconnectedWebhookRequest = v.object({ 1080 1023 body: v.optional(v.strictObject({ 1081 - event: v.picklist([ 1082 - 'session.stream_ingestion_disconnected' 1083 - ]), 1024 + event: v.picklist(["session.stream_ingestion_disconnected"]), 1084 1025 event_ts: v.pipe(v.union([ 1085 1026 v.number(), 1086 1027 v.string(), 1087 1028 v.bigint() 1088 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1029 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 1089 1030 payload: v.strictObject({ 1090 1031 account_id: v.string(), 1091 1032 object: v.strictObject({ ··· 1109 1050 1110 1051 export const vSessionRecordingRecoveredWebhookRequest = v.object({ 1111 1052 body: v.optional(v.strictObject({ 1112 - event: v.picklist([ 1113 - 'session.recording_recovered' 1114 - ]), 1053 + event: v.picklist(["session.recording_recovered"]), 1115 1054 event_ts: v.pipe(v.union([ 1116 1055 v.number(), 1117 1056 v.string(), 1118 1057 v.bigint() 1119 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1058 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 1120 1059 payload: v.strictObject({ 1121 1060 account_id: v.string(), 1122 1061 operator: v.pipe(v.string(), v.email()), ··· 1141 1080 v.number(), 1142 1081 v.string(), 1143 1082 v.bigint() 1144 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1083 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 1145 1084 payload: v.strictObject({ 1146 1085 account_id: v.string(), 1147 1086 object: v.strictObject({ ··· 1149 1088 v.number(), 1150 1089 v.string(), 1151 1090 v.bigint() 1152 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'))), 1091 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1"))), 1153 1092 uuid: v.optional(v.string()), 1154 1093 session_id: v.string(), 1155 1094 session_name: v.string(), ··· 1162 1101 v.number(), 1163 1102 v.string(), 1164 1103 v.bigint() 1165 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1104 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 1166 1105 from_number: v.pipe(v.union([ 1167 1106 v.number(), 1168 1107 v.string(), 1169 1108 v.bigint() 1170 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')) 1109 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")) 1171 1110 }) 1172 1111 }) 1173 1112 }) ··· 1183 1122 v.number(), 1184 1123 v.string(), 1185 1124 v.bigint() 1186 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1125 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 1187 1126 payload: v.strictObject({ 1188 1127 account_id: v.string(), 1189 1128 object: v.strictObject({ ··· 1191 1130 v.number(), 1192 1131 v.string(), 1193 1132 v.bigint() 1194 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'))), 1133 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1"))), 1195 1134 uuid: v.optional(v.string()), 1196 1135 session_id: v.string(), 1197 1136 session_name: v.string(), ··· 1204 1143 v.number(), 1205 1144 v.string(), 1206 1145 v.bigint() 1207 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1146 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 1208 1147 from_number: v.pipe(v.union([ 1209 1148 v.number(), 1210 1149 v.string(), 1211 1150 v.bigint() 1212 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')) 1151 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")) 1213 1152 }) 1214 1153 }) 1215 1154 }) ··· 1225 1164 v.number(), 1226 1165 v.string(), 1227 1166 v.bigint() 1228 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1167 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 1229 1168 payload: v.strictObject({ 1230 1169 account_id: v.string(), 1231 1170 object: v.strictObject({ ··· 1233 1172 v.number(), 1234 1173 v.string(), 1235 1174 v.bigint() 1236 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'))), 1175 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1"))), 1237 1176 uuid: v.optional(v.string()), 1238 1177 session_id: v.string(), 1239 1178 session_name: v.string(), ··· 1253 1192 1254 1193 export const vSessionRecordingStoppedWebhookRequest = v.object({ 1255 1194 body: v.optional(v.strictObject({ 1256 - event: v.picklist([ 1257 - 'session.recording_stopped' 1258 - ]), 1195 + event: v.picklist(["session.recording_stopped"]), 1259 1196 event_ts: v.pipe(v.union([ 1260 1197 v.number(), 1261 1198 v.string(), 1262 1199 v.bigint() 1263 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1')), 1200 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt("-9223372036854775808"), "Invalid value: Expected int64 to be >= -2^63"), v.maxValue(BigInt("9223372036854775807"), "Invalid value: Expected int64 to be <= 2^63-1")), 1264 1201 payload: v.strictObject({ 1265 1202 account_id: v.string(), 1266 1203 object: v.strictObject({
+1 -1
packages/openapi-ts/src/plugins/valibot/shared/export.ts
··· 32 32 .$if(state.hasLazyExpression.value, (c) => 33 33 c.type( 34 34 $.type(v.placeholder).attr( 35 - ast.typeName || identifiers.types.GenericSchema.text, 35 + ast.typeName || identifiers.types.GenericSchema, 36 36 ), 37 37 ), 38 38 )
+3 -6
packages/openapi-ts/src/plugins/valibot/shared/numbers.ts
··· 1 - import { tsc } from '~/tsc'; 1 + import { $ } from '~/ts-dsl'; 2 2 3 3 export const INTEGER_FORMATS = { 4 4 int16: { ··· 75 75 isBigInt: boolean; 76 76 value: unknown; 77 77 }) => { 78 - const expression = tsc.valueToExpression({ value }); 78 + const expression = $.toExpr(value); 79 79 80 80 if ( 81 81 isBigInt && ··· 84 84 typeof value === 'string' || 85 85 typeof value === 'boolean') 86 86 ) { 87 - return tsc.callExpression({ 88 - functionName: 'BigInt', 89 - parameters: [expression], 90 - }); 87 + return $('BigInt').call(expression); 91 88 } 92 89 93 90 return expression;
+5 -8
packages/openapi-ts/src/plugins/valibot/shared/pipesToAst.ts
··· 1 - import type ts from 'typescript'; 2 - 3 - import { $, TsDsl } from '~/ts-dsl'; 1 + import { $ } from '~/ts-dsl'; 4 2 5 3 import type { ValibotPlugin } from '../types'; 6 4 import { identifiers } from '../v1/constants'; ··· 9 7 pipes, 10 8 plugin, 11 9 }: { 12 - pipes: ReadonlyArray<ts.Expression | ReturnType<typeof $.call>>; 10 + pipes: ReadonlyArray<ReturnType<typeof $.call | typeof $.expr>>; 13 11 plugin: ValibotPlugin['Instance']; 14 - }): ts.Expression => { 12 + }): ReturnType<typeof $.call | typeof $.expr> => { 15 13 if (pipes.length === 1) { 16 - return pipes[0] instanceof TsDsl ? pipes[0].$render() : pipes[0]!; 14 + return pipes[0]!; 17 15 } 18 16 19 17 const v = plugin.referenceSymbol({ ··· 22 20 }); 23 21 return $(v.placeholder) 24 22 .attr(identifiers.methods.pipe) 25 - .call(...pipes) 26 - .$render(); 23 + .call(...pipes); 27 24 };
+2 -1
packages/openapi-ts/src/plugins/valibot/shared/types.d.ts
··· 3 3 4 4 import type { IR } from '~/ir/types'; 5 5 import type { ToRefs } from '~/plugins'; 6 + import type { $ } from '~/ts-dsl'; 6 7 7 8 import type { ValibotPlugin } from '../types'; 8 9 9 10 export type Ast = { 10 11 hasLazyExpression?: boolean; 11 - pipes: Array<ts.Expression>; 12 + pipes: Array<ReturnType<typeof $.call | typeof $.expr>>; 12 13 typeName?: string | ts.Identifier; 13 14 }; 14 15
+1 -1
packages/openapi-ts/src/plugins/valibot/types.d.ts
··· 342 342 343 343 export type ObjectBaseResolverArgs = SharedResolverArgs & { 344 344 /** Null = never */ 345 - additional?: ts.Expression | null; 345 + additional?: ReturnType<typeof $.call | typeof $.expr> | null; 346 346 schema: IR.SchemaObject; 347 347 shape: ReturnType<typeof $.object>; 348 348 };
+224 -226
packages/openapi-ts/src/plugins/valibot/v1/constants.ts
··· 1 - import { tsc } from '~/tsc'; 2 - 3 1 export const identifiers = { 4 2 /** 5 3 * {@link https://valibot.dev/api/#actions Actions} 6 4 */ 7 5 actions: { 8 - args: tsc.identifier({ text: 'args' }), 9 - base64: tsc.identifier({ text: 'base64' }), 10 - bic: tsc.identifier({ text: 'bic' }), 11 - brand: tsc.identifier({ text: 'brand' }), 12 - bytes: tsc.identifier({ text: 'bytes' }), 13 - check: tsc.identifier({ text: 'check' }), 14 - checkItems: tsc.identifier({ text: 'checkItems' }), 15 - creditCard: tsc.identifier({ text: 'creditCard' }), 16 - cuid2: tsc.identifier({ text: 'cuid2' }), 17 - decimal: tsc.identifier({ text: 'decimal' }), 18 - description: tsc.identifier({ text: 'description' }), 19 - digits: tsc.identifier({ text: 'digits' }), 20 - email: tsc.identifier({ text: 'email' }), 21 - emoji: tsc.identifier({ text: 'emoji' }), 22 - empty: tsc.identifier({ text: 'empty' }), 23 - endsWith: tsc.identifier({ text: 'endsWith' }), 24 - entries: tsc.identifier({ text: 'entries' }), 25 - everyItem: tsc.identifier({ text: 'everyItem' }), 26 - excludes: tsc.identifier({ text: 'excludes' }), 27 - filterItems: tsc.identifier({ text: 'filterItems' }), 28 - findItem: tsc.identifier({ text: 'findItem' }), 29 - finite: tsc.identifier({ text: 'finite' }), 30 - flavor: tsc.identifier({ text: 'flavor' }), 31 - graphemes: tsc.identifier({ text: 'graphemes' }), 32 - gtValue: tsc.identifier({ text: 'gtValue' }), 33 - hash: tsc.identifier({ text: 'hash' }), 34 - hexColor: tsc.identifier({ text: 'hexColor' }), 35 - hexadecimal: tsc.identifier({ text: 'hexadecimal' }), 36 - imei: tsc.identifier({ text: 'imei' }), 37 - includes: tsc.identifier({ text: 'includes' }), 38 - integer: tsc.identifier({ text: 'integer' }), 39 - ip: tsc.identifier({ text: 'ip' }), 40 - ipv4: tsc.identifier({ text: 'ipv4' }), 41 - ipv6: tsc.identifier({ text: 'ipv6' }), 42 - isoDate: tsc.identifier({ text: 'isoDate' }), 43 - isoDateTime: tsc.identifier({ text: 'isoDateTime' }), 44 - isoTime: tsc.identifier({ text: 'isoTime' }), 45 - isoTimeSecond: tsc.identifier({ text: 'isoTimeSecond' }), 46 - isoTimestamp: tsc.identifier({ text: 'isoTimestamp' }), 47 - isoWeek: tsc.identifier({ text: 'isoWeek' }), 48 - length: tsc.identifier({ text: 'length' }), 49 - ltValue: tsc.identifier({ text: 'ltValue' }), 50 - mac: tsc.identifier({ text: 'mac' }), 51 - mac48: tsc.identifier({ text: 'mac48' }), 52 - mac64: tsc.identifier({ text: 'mac64' }), 53 - mapItems: tsc.identifier({ text: 'mapItems' }), 54 - maxBytes: tsc.identifier({ text: 'maxBytes' }), 55 - maxEntries: tsc.identifier({ text: 'maxEntries' }), 56 - maxGraphemes: tsc.identifier({ text: 'maxGraphemes' }), 57 - maxLength: tsc.identifier({ text: 'maxLength' }), 58 - maxSize: tsc.identifier({ text: 'maxSize' }), 59 - maxValue: tsc.identifier({ text: 'maxValue' }), 60 - maxWords: tsc.identifier({ text: 'maxWords' }), 61 - metadata: tsc.identifier({ text: 'metadata' }), 62 - mimeType: tsc.identifier({ text: 'mimeType' }), 63 - minBytes: tsc.identifier({ text: 'minBytes' }), 64 - minEntries: tsc.identifier({ text: 'minEntries' }), 65 - minGraphemes: tsc.identifier({ text: 'minGraphemes' }), 66 - minLength: tsc.identifier({ text: 'minLength' }), 67 - minSize: tsc.identifier({ text: 'minSize' }), 68 - minValue: tsc.identifier({ text: 'minValue' }), 69 - minWords: tsc.identifier({ text: 'minWords' }), 70 - multipleOf: tsc.identifier({ text: 'multipleOf' }), 71 - nanoid: tsc.identifier({ text: 'nanoid' }), 72 - nonEmpty: tsc.identifier({ text: 'nonEmpty' }), 73 - normalize: tsc.identifier({ text: 'normalize' }), 74 - notBytes: tsc.identifier({ text: 'notBytes' }), 75 - notEntries: tsc.identifier({ text: 'notEntries' }), 76 - notGraphemes: tsc.identifier({ text: 'notGraphemes' }), 77 - notLength: tsc.identifier({ text: 'notLength' }), 78 - notSize: tsc.identifier({ text: 'notSize' }), 79 - notValue: tsc.identifier({ text: 'notValue' }), 80 - notValues: tsc.identifier({ text: 'notValues' }), 81 - notWords: tsc.identifier({ text: 'notWords' }), 82 - octal: tsc.identifier({ text: 'octal' }), 83 - parseJson: tsc.identifier({ text: 'parseJson' }), 84 - partialCheck: tsc.identifier({ text: 'partialCheck' }), 85 - rawCheck: tsc.identifier({ text: 'rawCheck' }), 86 - rawTransform: tsc.identifier({ text: 'rawTransform' }), 87 - readonly: tsc.identifier({ text: 'readonly' }), 88 - reduceItems: tsc.identifier({ text: 'reduceItems' }), 89 - regex: tsc.identifier({ text: 'regex' }), 90 - returns: tsc.identifier({ text: 'returns' }), 91 - rfcEmail: tsc.identifier({ text: 'rfcEmail' }), 92 - safeInteger: tsc.identifier({ text: 'safeInteger' }), 93 - size: tsc.identifier({ text: 'size' }), 94 - slug: tsc.identifier({ text: 'slug' }), 95 - someItem: tsc.identifier({ text: 'someItem' }), 96 - sortItems: tsc.identifier({ text: 'sortItems' }), 97 - startsWith: tsc.identifier({ text: 'startsWith' }), 98 - stringifyJson: tsc.identifier({ text: 'stringifyJson' }), 99 - title: tsc.identifier({ text: 'title' }), 100 - toLowerCase: tsc.identifier({ text: 'toLowerCase' }), 101 - toMaxValue: tsc.identifier({ text: 'toMaxValue' }), 102 - toMinValue: tsc.identifier({ text: 'toMinValue' }), 103 - toUpperCase: tsc.identifier({ text: 'toUpperCase' }), 104 - transform: tsc.identifier({ text: 'transform' }), 105 - trim: tsc.identifier({ text: 'trim' }), 106 - trimEnd: tsc.identifier({ text: 'trimEnd' }), 107 - trimStart: tsc.identifier({ text: 'trimStart' }), 108 - ulid: tsc.identifier({ text: 'ulid' }), 109 - url: tsc.identifier({ text: 'url' }), 110 - uuid: tsc.identifier({ text: 'uuid' }), 111 - value: tsc.identifier({ text: 'value' }), 112 - values: tsc.identifier({ text: 'values' }), 113 - words: tsc.identifier({ text: 'words' }), 6 + args: 'args', 7 + base64: 'base64', 8 + bic: 'bic', 9 + brand: 'brand', 10 + bytes: 'bytes', 11 + check: 'check', 12 + checkItems: 'checkItems', 13 + creditCard: 'creditCard', 14 + cuid2: 'cuid2', 15 + decimal: 'decimal', 16 + description: 'description', 17 + digits: 'digits', 18 + email: 'email', 19 + emoji: 'emoji', 20 + empty: 'empty', 21 + endsWith: 'endsWith', 22 + entries: 'entries', 23 + everyItem: 'everyItem', 24 + excludes: 'excludes', 25 + filterItems: 'filterItems', 26 + findItem: 'findItem', 27 + finite: 'finite', 28 + flavor: 'flavor', 29 + graphemes: 'graphemes', 30 + gtValue: 'gtValue', 31 + hash: 'hash', 32 + hexColor: 'hexColor', 33 + hexadecimal: 'hexadecimal', 34 + imei: 'imei', 35 + includes: 'includes', 36 + integer: 'integer', 37 + ip: 'ip', 38 + ipv4: 'ipv4', 39 + ipv6: 'ipv6', 40 + isoDate: 'isoDate', 41 + isoDateTime: 'isoDateTime', 42 + isoTime: 'isoTime', 43 + isoTimeSecond: 'isoTimeSecond', 44 + isoTimestamp: 'isoTimestamp', 45 + isoWeek: 'isoWeek', 46 + length: 'length', 47 + ltValue: 'ltValue', 48 + mac: 'mac', 49 + mac48: 'mac48', 50 + mac64: 'mac64', 51 + mapItems: 'mapItems', 52 + maxBytes: 'maxBytes', 53 + maxEntries: 'maxEntries', 54 + maxGraphemes: 'maxGraphemes', 55 + maxLength: 'maxLength', 56 + maxSize: 'maxSize', 57 + maxValue: 'maxValue', 58 + maxWords: 'maxWords', 59 + metadata: 'metadata', 60 + mimeType: 'mimeType', 61 + minBytes: 'minBytes', 62 + minEntries: 'minEntries', 63 + minGraphemes: 'minGraphemes', 64 + minLength: 'minLength', 65 + minSize: 'minSize', 66 + minValue: 'minValue', 67 + minWords: 'minWords', 68 + multipleOf: 'multipleOf', 69 + nanoid: 'nanoid', 70 + nonEmpty: 'nonEmpty', 71 + normalize: 'normalize', 72 + notBytes: 'notBytes', 73 + notEntries: 'notEntries', 74 + notGraphemes: 'notGraphemes', 75 + notLength: 'notLength', 76 + notSize: 'notSize', 77 + notValue: 'notValue', 78 + notValues: 'notValues', 79 + notWords: 'notWords', 80 + octal: 'octal', 81 + parseJson: 'parseJson', 82 + partialCheck: 'partialCheck', 83 + rawCheck: 'rawCheck', 84 + rawTransform: 'rawTransform', 85 + readonly: 'readonly', 86 + reduceItems: 'reduceItems', 87 + regex: 'regex', 88 + returns: 'returns', 89 + rfcEmail: 'rfcEmail', 90 + safeInteger: 'safeInteger', 91 + size: 'size', 92 + slug: 'slug', 93 + someItem: 'someItem', 94 + sortItems: 'sortItems', 95 + startsWith: 'startsWith', 96 + stringifyJson: 'stringifyJson', 97 + title: 'title', 98 + toLowerCase: 'toLowerCase', 99 + toMaxValue: 'toMaxValue', 100 + toMinValue: 'toMinValue', 101 + toUpperCase: 'toUpperCase', 102 + transform: 'transform', 103 + trim: 'trim', 104 + trimEnd: 'trimEnd', 105 + trimStart: 'trimStart', 106 + ulid: 'ulid', 107 + url: 'url', 108 + uuid: 'uuid', 109 + value: 'value', 110 + values: 'values', 111 + words: 'words', 114 112 }, 115 113 /** 116 114 * {@link https://valibot.dev/api/#async Async} 117 115 */ 118 116 async: { 119 - argsAsync: tsc.identifier({ text: 'argsAsync' }), 120 - arrayAsync: tsc.identifier({ text: 'arrayAsync' }), 121 - awaitAsync: tsc.identifier({ text: 'awaitAsync' }), 122 - checkAsync: tsc.identifier({ text: 'checkAsync' }), 123 - checkItemsAsync: tsc.identifier({ text: 'checkItemsAsync' }), 124 - customAsync: tsc.identifier({ text: 'customAsync' }), 125 - exactOptionalAsync: tsc.identifier({ text: 'exactOptionalAsync' }), 126 - fallbackAsync: tsc.identifier({ text: 'fallbackAsync' }), 127 - forwardAsync: tsc.identifier({ text: 'forwardAsync' }), 128 - getDefaultsAsync: tsc.identifier({ text: 'getDefaultsAsync' }), 129 - getFallbacksAsync: tsc.identifier({ text: 'getFallbacksAsync' }), 130 - intersectAsync: tsc.identifier({ text: 'intersectAsync' }), 131 - lazyAsync: tsc.identifier({ text: 'lazyAsync' }), 132 - looseObjectAsync: tsc.identifier({ text: 'looseObjectAsync' }), 133 - looseTupleAsync: tsc.identifier({ text: 'looseTupleAsync' }), 134 - mapAsync: tsc.identifier({ text: 'mapAsync' }), 135 - nonNullableAsync: tsc.identifier({ text: 'nonNullableAsync' }), 136 - nonNullishAsync: tsc.identifier({ text: 'nonNullishAsync' }), 137 - nonOptionalAsync: tsc.identifier({ text: 'nonOptionalAsync' }), 138 - nullableAsync: tsc.identifier({ text: 'nullableAsync' }), 139 - nullishAsync: tsc.identifier({ text: 'nullishAsync' }), 140 - objectAsync: tsc.identifier({ text: 'objectAsync' }), 141 - objectWithRestAsync: tsc.identifier({ text: 'objectWithRestAsync' }), 142 - optionalAsync: tsc.identifier({ text: 'optionalAsync' }), 143 - parseAsync: tsc.identifier({ text: 'parseAsync' }), 144 - parserAsync: tsc.identifier({ text: 'parserAsync' }), 145 - partialAsync: tsc.identifier({ text: 'partialAsync' }), 146 - partialCheckAsync: tsc.identifier({ text: 'partialCheckAsync' }), 147 - pipeAsync: tsc.identifier({ text: 'pipeAsync' }), 148 - rawCheckAsync: tsc.identifier({ text: 'rawCheckAsync' }), 149 - rawTransformAsync: tsc.identifier({ text: 'rawTransformAsync' }), 150 - recordAsync: tsc.identifier({ text: 'recordAsync' }), 151 - requiredAsync: tsc.identifier({ text: 'requiredAsync' }), 152 - returnsAsync: tsc.identifier({ text: 'returnsAsync' }), 153 - safeParseAsync: tsc.identifier({ text: 'safeParseAsync' }), 154 - safeParserAsync: tsc.identifier({ text: 'safeParserAsync' }), 155 - setAsync: tsc.identifier({ text: 'setAsync' }), 156 - strictObjectAsync: tsc.identifier({ text: 'strictObjectAsync' }), 157 - strictTupleAsync: tsc.identifier({ text: 'strictTupleAsync' }), 158 - transformAsync: tsc.identifier({ text: 'transformAsync' }), 159 - tupleAsync: tsc.identifier({ text: 'tupleAsync' }), 160 - tupleWithRestAsync: tsc.identifier({ text: 'tupleWithRestAsync' }), 161 - undefinedableAsync: tsc.identifier({ text: 'undefinedableAsync' }), 162 - unionAsync: tsc.identifier({ text: 'unionAsync' }), 163 - variantAsync: tsc.identifier({ text: 'variantAsync' }), 117 + argsAsync: 'argsAsync', 118 + arrayAsync: 'arrayAsync', 119 + awaitAsync: 'awaitAsync', 120 + checkAsync: 'checkAsync', 121 + checkItemsAsync: 'checkItemsAsync', 122 + customAsync: 'customAsync', 123 + exactOptionalAsync: 'exactOptionalAsync', 124 + fallbackAsync: 'fallbackAsync', 125 + forwardAsync: 'forwardAsync', 126 + getDefaultsAsync: 'getDefaultsAsync', 127 + getFallbacksAsync: 'getFallbacksAsync', 128 + intersectAsync: 'intersectAsync', 129 + lazyAsync: 'lazyAsync', 130 + looseObjectAsync: 'looseObjectAsync', 131 + looseTupleAsync: 'looseTupleAsync', 132 + mapAsync: 'mapAsync', 133 + nonNullableAsync: 'nonNullableAsync', 134 + nonNullishAsync: 'nonNullishAsync', 135 + nonOptionalAsync: 'nonOptionalAsync', 136 + nullableAsync: 'nullableAsync', 137 + nullishAsync: 'nullishAsync', 138 + objectAsync: 'objectAsync', 139 + objectWithRestAsync: 'objectWithRestAsync', 140 + optionalAsync: 'optionalAsync', 141 + parseAsync: 'parseAsync', 142 + parserAsync: 'parserAsync', 143 + partialAsync: 'partialAsync', 144 + partialCheckAsync: 'partialCheckAsync', 145 + pipeAsync: 'pipeAsync', 146 + rawCheckAsync: 'rawCheckAsync', 147 + rawTransformAsync: 'rawTransformAsync', 148 + recordAsync: 'recordAsync', 149 + requiredAsync: 'requiredAsync', 150 + returnsAsync: 'returnsAsync', 151 + safeParseAsync: 'safeParseAsync', 152 + safeParserAsync: 'safeParserAsync', 153 + setAsync: 'setAsync', 154 + strictObjectAsync: 'strictObjectAsync', 155 + strictTupleAsync: 'strictTupleAsync', 156 + transformAsync: 'transformAsync', 157 + tupleAsync: 'tupleAsync', 158 + tupleWithRestAsync: 'tupleWithRestAsync', 159 + undefinedableAsync: 'undefinedableAsync', 160 + unionAsync: 'unionAsync', 161 + variantAsync: 'variantAsync', 164 162 }, 165 163 /** 166 164 * {@link https://valibot.dev/api/#methods Methods} 167 165 */ 168 166 methods: { 169 - assert: tsc.identifier({ text: 'assert' }), 170 - config: tsc.identifier({ text: 'config' }), 171 - fallback: tsc.identifier({ text: 'fallback' }), 172 - flatten: tsc.identifier({ text: 'flatten' }), 173 - forward: tsc.identifier({ text: 'forward' }), 174 - getDefault: tsc.identifier({ text: 'getDefault' }), 175 - getDefaults: tsc.identifier({ text: 'getDefaults' }), 176 - getDescription: tsc.identifier({ text: 'getDescription' }), 177 - getFallback: tsc.identifier({ text: 'getFallback' }), 178 - getFallbacks: tsc.identifier({ text: 'getFallbacks' }), 179 - getMetadata: tsc.identifier({ text: 'getMetadata' }), 180 - getTitle: tsc.identifier({ text: 'getTitle' }), 181 - is: tsc.identifier({ text: 'is' }), 182 - keyof: tsc.identifier({ text: 'keyof' }), 183 - message: tsc.identifier({ text: 'message' }), 184 - omit: tsc.identifier({ text: 'omit' }), 185 - parse: tsc.identifier({ text: 'parse' }), 186 - parser: tsc.identifier({ text: 'parser' }), 187 - partial: tsc.identifier({ text: 'partial' }), 188 - pick: tsc.identifier({ text: 'pick' }), 189 - pipe: tsc.identifier({ text: 'pipe' }), 190 - required: tsc.identifier({ text: 'required' }), 191 - safeParse: tsc.identifier({ text: 'safeParse' }), 192 - safeParser: tsc.identifier({ text: 'safeParser' }), 193 - summarize: tsc.identifier({ text: 'summarize' }), 194 - unwrap: tsc.identifier({ text: 'unwrap' }), 167 + assert: 'assert', 168 + config: 'config', 169 + fallback: 'fallback', 170 + flatten: 'flatten', 171 + forward: 'forward', 172 + getDefault: 'getDefault', 173 + getDefaults: 'getDefaults', 174 + getDescription: 'getDescription', 175 + getFallback: 'getFallback', 176 + getFallbacks: 'getFallbacks', 177 + getMetadata: 'getMetadata', 178 + getTitle: 'getTitle', 179 + is: 'is', 180 + keyof: 'keyof', 181 + message: 'message', 182 + omit: 'omit', 183 + parse: 'parse', 184 + parser: 'parser', 185 + partial: 'partial', 186 + pick: 'pick', 187 + pipe: 'pipe', 188 + required: 'required', 189 + safeParse: 'safeParse', 190 + safeParser: 'safeParser', 191 + summarize: 'summarize', 192 + unwrap: 'unwrap', 195 193 }, 196 194 /** 197 195 * {@link https://valibot.dev/api/#schemas Schemas} 198 196 */ 199 197 schemas: { 200 - any: tsc.identifier({ text: 'any' }), 201 - array: tsc.identifier({ text: 'array' }), 202 - bigInt: tsc.identifier({ text: 'bigint' }), 203 - blob: tsc.identifier({ text: 'blob' }), 204 - boolean: tsc.identifier({ text: 'boolean' }), 205 - custom: tsc.identifier({ text: 'custom' }), 206 - date: tsc.identifier({ text: 'date' }), 207 - enum: tsc.identifier({ text: 'enum' }), 208 - exactOptional: tsc.identifier({ text: 'exactOptional' }), 209 - file: tsc.identifier({ text: 'file' }), 210 - function: tsc.identifier({ text: 'function' }), 211 - instance: tsc.identifier({ text: 'instance' }), 212 - intersect: tsc.identifier({ text: 'intersect' }), 213 - lazy: tsc.identifier({ text: 'lazy' }), 214 - literal: tsc.identifier({ text: 'literal' }), 215 - looseObject: tsc.identifier({ text: 'looseObject' }), 216 - looseTuple: tsc.identifier({ text: 'looseTuple' }), 217 - map: tsc.identifier({ text: 'map' }), 218 - nan: tsc.identifier({ text: 'nan' }), 219 - never: tsc.identifier({ text: 'never' }), 220 - nonNullable: tsc.identifier({ text: 'nonNullable' }), 221 - nonNullish: tsc.identifier({ text: 'nonNullish' }), 222 - nonOptional: tsc.identifier({ text: 'nonOptional' }), 223 - null: tsc.identifier({ text: 'null' }), 224 - nullable: tsc.identifier({ text: 'nullable' }), 225 - nullish: tsc.identifier({ text: 'nullish' }), 226 - number: tsc.identifier({ text: 'number' }), 227 - object: tsc.identifier({ text: 'object' }), 228 - objectWithRest: tsc.identifier({ text: 'objectWithRest' }), 229 - optional: tsc.identifier({ text: 'optional' }), 230 - picklist: tsc.identifier({ text: 'picklist' }), 231 - promise: tsc.identifier({ text: 'promise' }), 232 - record: tsc.identifier({ text: 'record' }), 233 - set: tsc.identifier({ text: 'set' }), 234 - strictObject: tsc.identifier({ text: 'strictObject' }), 235 - strictTuple: tsc.identifier({ text: 'strictTuple' }), 236 - string: tsc.identifier({ text: 'string' }), 237 - symbol: tsc.identifier({ text: 'symbol' }), 238 - tuple: tsc.identifier({ text: 'tuple' }), 239 - tupleWithRest: tsc.identifier({ text: 'tupleWithRest' }), 240 - undefined: tsc.identifier({ text: 'undefined' }), 241 - undefinedable: tsc.identifier({ text: 'undefinedable' }), 242 - union: tsc.identifier({ text: 'union' }), 243 - unknown: tsc.identifier({ text: 'unknown' }), 244 - variant: tsc.identifier({ text: 'variant' }), 245 - void: tsc.identifier({ text: 'void' }), 198 + any: 'any', 199 + array: 'array', 200 + bigInt: 'bigint', 201 + blob: 'blob', 202 + boolean: 'boolean', 203 + custom: 'custom', 204 + date: 'date', 205 + enum: 'enum', 206 + exactOptional: 'exactOptional', 207 + file: 'file', 208 + function: 'function', 209 + instance: 'instance', 210 + intersect: 'intersect', 211 + lazy: 'lazy', 212 + literal: 'literal', 213 + looseObject: 'looseObject', 214 + looseTuple: 'looseTuple', 215 + map: 'map', 216 + nan: 'nan', 217 + never: 'never', 218 + nonNullable: 'nonNullable', 219 + nonNullish: 'nonNullish', 220 + nonOptional: 'nonOptional', 221 + null: 'null', 222 + nullable: 'nullable', 223 + nullish: 'nullish', 224 + number: 'number', 225 + object: 'object', 226 + objectWithRest: 'objectWithRest', 227 + optional: 'optional', 228 + picklist: 'picklist', 229 + promise: 'promise', 230 + record: 'record', 231 + set: 'set', 232 + strictObject: 'strictObject', 233 + strictTuple: 'strictTuple', 234 + string: 'string', 235 + symbol: 'symbol', 236 + tuple: 'tuple', 237 + tupleWithRest: 'tupleWithRest', 238 + undefined: 'undefined', 239 + undefinedable: 'undefinedable', 240 + union: 'union', 241 + unknown: 'unknown', 242 + variant: 'variant', 243 + void: 'void', 246 244 }, 247 245 /** 248 246 * {@link https://valibot.dev/api/#storages Storages} ··· 255 253 */ 256 254 types: { 257 255 // TODO: implement if necessary 258 - GenericSchema: tsc.identifier({ text: 'GenericSchema' }), 256 + GenericSchema: 'GenericSchema', 259 257 }, 260 258 /** 261 259 * {@link https://valibot.dev/api/#utils Utils}
+24 -80
packages/openapi-ts/src/plugins/valibot/v1/plugin.ts
··· 1 1 import type { SymbolMeta } from '@hey-api/codegen-core'; 2 - import type ts from 'typescript'; 3 2 4 3 import { deduplicateSchema } from '~/ir/schema'; 5 4 import type { IR } from '~/ir/types'; 6 5 import { buildName } from '~/openApi/shared/utils/name'; 7 6 import type { SchemaWithType } from '~/plugins'; 8 7 import { toRef, toRefs } from '~/plugins/shared/utils/refs'; 9 - import { tsc } from '~/tsc'; 8 + import { $ } from '~/ts-dsl'; 10 9 import { pathToJsonPointer, refToName } from '~/utils/ref'; 11 10 12 11 import { exportAst } from '../shared/export'; ··· 51 50 }; 52 51 const refSymbol = plugin.referenceSymbol(query); 53 52 if (plugin.isSymbolRegistered(query)) { 54 - const ref = tsc.identifier({ text: refSymbol.placeholder }); 53 + const ref = $(refSymbol.placeholder); 55 54 ast.pipes.push(ref); 56 55 } else { 57 - const lazyExpression = tsc.callExpression({ 58 - functionName: tsc.propertyAccessExpression({ 59 - expression: v.placeholder, 60 - name: identifiers.schemas.lazy, 61 - }), 62 - parameters: [ 63 - tsc.arrowFunction({ 64 - statements: [ 65 - tsc.returnStatement({ 66 - expression: tsc.identifier({ text: refSymbol.placeholder }), 67 - }), 68 - ], 69 - }), 70 - ], 71 - }); 56 + const lazyExpression = $(v.placeholder) 57 + .attr(identifiers.schemas.lazy) 58 + .call($.func().do($(refSymbol.placeholder).return())); 72 59 ast.pipes.push(lazyExpression); 73 60 state.hasLazyExpression.value = true; 74 61 } ··· 82 69 ast.pipes.push(typeAst.expression); 83 70 84 71 if (plugin.config.metadata && schema.description) { 85 - const expression = tsc.callExpression({ 86 - functionName: tsc.propertyAccessExpression({ 87 - expression: v.placeholder, 88 - name: identifiers.actions.metadata, 89 - }), 90 - parameters: [ 91 - tsc.objectExpression({ 92 - obj: [ 93 - { 94 - key: 'description', 95 - value: tsc.stringLiteral({ text: schema.description }), 96 - }, 97 - ], 98 - }), 99 - ], 100 - }); 72 + const expression = $(v.placeholder) 73 + .attr(identifiers.actions.metadata) 74 + .call($.object().prop('description', $.literal(schema.description))); 101 75 ast.pipes.push(expression); 102 76 } 103 77 } else if (schema.items) { ··· 117 91 }); 118 92 119 93 if (schema.logicalOperator === 'and') { 120 - const intersectExpression = tsc.callExpression({ 121 - functionName: tsc.propertyAccessExpression({ 122 - expression: v.placeholder, 123 - name: identifiers.schemas.intersect, 124 - }), 125 - parameters: [ 126 - tsc.arrayLiteralExpression({ 127 - elements: itemsAst, 128 - }), 129 - ], 130 - }); 94 + const intersectExpression = $(v.placeholder) 95 + .attr(identifiers.schemas.intersect) 96 + .call($.array(...itemsAst)); 131 97 ast.pipes.push(intersectExpression); 132 98 } else { 133 - const unionExpression = tsc.callExpression({ 134 - functionName: tsc.propertyAccessExpression({ 135 - expression: v.placeholder, 136 - name: identifiers.schemas.union, 137 - }), 138 - parameters: [ 139 - tsc.arrayLiteralExpression({ 140 - elements: itemsAst, 141 - }), 142 - ], 143 - }); 99 + const unionExpression = $(v.placeholder) 100 + .attr(identifiers.schemas.union) 101 + .call($.array(...itemsAst)); 144 102 ast.pipes.push(unionExpression); 145 103 } 146 104 } else { ··· 162 120 163 121 if (ast.pipes.length) { 164 122 if (schema.accessScope === 'read') { 165 - const readonlyExpression = tsc.callExpression({ 166 - functionName: tsc.propertyAccessExpression({ 167 - expression: v.placeholder, 168 - name: identifiers.actions.readonly, 169 - }), 170 - }); 123 + const readonlyExpression = $(v.placeholder) 124 + .attr(identifiers.actions.readonly) 125 + .call(); 171 126 ast.pipes.push(readonlyExpression); 172 127 } 173 128 174 - let callParameter: ts.Expression | undefined; 129 + let callParameter: ReturnType<typeof $.toExpr> | undefined; 175 130 176 131 if (schema.default !== undefined) { 177 132 const isBigInt = schema.type === 'integer' && schema.format === 'int64'; 178 133 callParameter = numberParameter({ isBigInt, value: schema.default }); 179 134 if (callParameter) { 180 135 ast.pipes = [ 181 - tsc.callExpression({ 182 - functionName: tsc.propertyAccessExpression({ 183 - expression: v.placeholder, 184 - name: identifiers.schemas.optional, 185 - }), 186 - parameters: [ 187 - pipesToAst({ pipes: ast.pipes, plugin }), 188 - callParameter, 189 - ], 190 - }), 136 + $(v.placeholder) 137 + .attr(identifiers.schemas.optional) 138 + .call(pipesToAst({ pipes: ast.pipes, plugin }), callParameter), 191 139 ]; 192 140 } 193 141 } 194 142 195 143 if (optional && !callParameter) { 196 144 ast.pipes = [ 197 - tsc.callExpression({ 198 - functionName: tsc.propertyAccessExpression({ 199 - expression: v.placeholder, 200 - name: identifiers.schemas.optional, 201 - }), 202 - parameters: [pipesToAst({ pipes: ast.pipes, plugin })], 203 - }), 145 + $(v.placeholder) 146 + .attr(identifiers.schemas.optional) 147 + .call(pipesToAst({ pipes: ast.pipes, plugin })), 204 148 ]; 205 149 } 206 150 }
+30 -54
packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts
··· 1 1 import { deduplicateSchema } from '~/ir/schema'; 2 2 import type { SchemaWithType } from '~/plugins'; 3 3 import { toRef } from '~/plugins/shared/utils/refs'; 4 - import { tsc } from '~/tsc'; 4 + import { $ } from '~/ts-dsl'; 5 5 6 6 import { pipesToAst } from '../../shared/pipesToAst'; 7 7 import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; ··· 24 24 category: 'external', 25 25 resource: 'valibot.v', 26 26 }); 27 - const functionName = tsc.propertyAccessExpression({ 28 - expression: v.placeholder, 29 - name: identifiers.schemas.array, 30 - }); 27 + const functionName = $(v.placeholder).attr(identifiers.schemas.array); 31 28 32 29 if (!schema.items) { 33 - const expression = tsc.callExpression({ 34 - functionName, 35 - parameters: [ 36 - unknownToAst({ 37 - plugin, 38 - schema: { 39 - type: 'unknown', 40 - }, 41 - state, 42 - }), 43 - ], 44 - }); 30 + const expression = functionName.call( 31 + unknownToAst({ 32 + plugin, 33 + schema: { 34 + type: 'unknown', 35 + }, 36 + state, 37 + }), 38 + ); 45 39 result.pipes.push(expression); 46 40 } else { 47 41 schema = deduplicateSchema({ schema }); ··· 63 57 }); 64 58 65 59 if (itemExpressions.length === 1) { 66 - const expression = tsc.callExpression({ 67 - functionName, 68 - parameters: itemExpressions, 69 - }); 60 + const expression = functionName.call(...itemExpressions); 70 61 result.pipes.push(expression); 71 62 } else { 72 63 if (schema.logicalOperator === 'and') { ··· 79 70 // TODO: parser - handle union 80 71 // return tsc.typeArrayNode(tsc.typeUnionNode({ types: itemExpressions })); 81 72 82 - const expression = tsc.callExpression({ 83 - functionName, 84 - parameters: [ 85 - unknownToAst({ 86 - plugin, 87 - schema: { 88 - type: 'unknown', 89 - }, 90 - state, 91 - }), 92 - ], 93 - }); 73 + const expression = functionName.call( 74 + unknownToAst({ 75 + plugin, 76 + schema: { 77 + type: 'unknown', 78 + }, 79 + state, 80 + }), 81 + ); 94 82 result.pipes.push(expression); 95 83 } 96 84 } 97 85 98 86 if (schema.minItems === schema.maxItems && schema.minItems !== undefined) { 99 - const expression = tsc.callExpression({ 100 - functionName: tsc.propertyAccessExpression({ 101 - expression: v.placeholder, 102 - name: identifiers.actions.length, 103 - }), 104 - parameters: [tsc.valueToExpression({ value: schema.minItems })], 105 - }); 87 + const expression = $(v.placeholder) 88 + .attr(identifiers.actions.length) 89 + .call($.toExpr(schema.minItems)); 106 90 result.pipes.push(expression); 107 91 } else { 108 92 if (schema.minItems !== undefined) { 109 - const expression = tsc.callExpression({ 110 - functionName: tsc.propertyAccessExpression({ 111 - expression: v.placeholder, 112 - name: identifiers.actions.minLength, 113 - }), 114 - parameters: [tsc.valueToExpression({ value: schema.minItems })], 115 - }); 93 + const expression = $(v.placeholder) 94 + .attr(identifiers.actions.minLength) 95 + .call($.toExpr(schema.minItems)); 116 96 result.pipes.push(expression); 117 97 } 118 98 119 99 if (schema.maxItems !== undefined) { 120 - const expression = tsc.callExpression({ 121 - functionName: tsc.propertyAccessExpression({ 122 - expression: v.placeholder, 123 - name: identifiers.actions.maxLength, 124 - }), 125 - parameters: [tsc.valueToExpression({ value: schema.maxItems })], 126 - }); 100 + const expression = $(v.placeholder) 101 + .attr(identifiers.actions.maxLength) 102 + .call($.toExpr(schema.maxItems)); 127 103 result.pipes.push(expression); 128 104 } 129 105 }
+1 -3
packages/openapi-ts/src/plugins/valibot/v1/toAst/boolean.ts
··· 1 - import type ts from 'typescript'; 2 - 3 1 import type { SchemaWithType } from '~/plugins'; 4 2 import { $ } from '~/ts-dsl'; 5 3 ··· 12 10 schema, 13 11 }: IrSchemaToAstOptions & { 14 12 schema: SchemaWithType<'boolean'>; 15 - }): ts.Expression => { 13 + }): ReturnType<typeof $.call | typeof $.expr> => { 16 14 const pipes: Array<ReturnType<typeof $.call>> = []; 17 15 18 16 const v = plugin.referenceSymbol({
+10 -29
packages/openapi-ts/src/plugins/valibot/v1/toAst/enum.ts
··· 1 - import type ts from 'typescript'; 2 - 3 1 import type { SchemaWithType } from '~/plugins'; 4 - import { tsc } from '~/tsc'; 2 + import { $ } from '~/ts-dsl'; 5 3 6 4 import type { IrSchemaToAstOptions } from '../../shared/types'; 7 5 import { identifiers } from '../constants'; ··· 13 11 state, 14 12 }: IrSchemaToAstOptions & { 15 13 schema: SchemaWithType<'enum'>; 16 - }): ts.CallExpression => { 17 - const enumMembers: Array<ts.LiteralExpression> = []; 14 + }): ReturnType<typeof $.call> => { 15 + const enumMembers: Array<ReturnType<typeof $.literal>> = []; 18 16 19 17 let isNullable = false; 20 18 21 19 for (const item of schema.items ?? []) { 22 20 // Zod supports only string enums 23 21 if (item.type === 'string' && typeof item.const === 'string') { 24 - enumMembers.push( 25 - tsc.stringLiteral({ 26 - text: item.const, 27 - }), 28 - ); 22 + enumMembers.push($.literal(item.const)); 29 23 } else if (item.type === 'null' || item.const === null) { 30 24 isNullable = true; 31 25 } ··· 46 40 resource: 'valibot.v', 47 41 }); 48 42 49 - let resultExpression = tsc.callExpression({ 50 - functionName: tsc.propertyAccessExpression({ 51 - expression: v.placeholder, 52 - name: identifiers.schemas.picklist, 53 - }), 54 - parameters: [ 55 - tsc.arrayLiteralExpression({ 56 - elements: enumMembers, 57 - multiLine: false, 58 - }), 59 - ], 60 - }); 43 + let resultExpression = $(v.placeholder) 44 + .attr(identifiers.schemas.picklist) 45 + .call($.array(...enumMembers)); 61 46 62 47 if (isNullable) { 63 - resultExpression = tsc.callExpression({ 64 - functionName: tsc.propertyAccessExpression({ 65 - expression: v.placeholder, 66 - name: identifiers.schemas.nullable, 67 - }), 68 - parameters: [resultExpression], 69 - }); 48 + resultExpression = $(v.placeholder) 49 + .attr(identifiers.schemas.nullable) 50 + .call(resultExpression); 70 51 } 71 52 72 53 return resultExpression;
+2 -3
packages/openapi-ts/src/plugins/valibot/v1/toAst/index.ts
··· 1 - import type ts from 'typescript'; 2 - 3 1 import type { SchemaWithType } from '~/plugins'; 2 + import type { $ } from '~/ts-dsl'; 4 3 5 4 import { pipesToAst } from '../../shared/pipesToAst'; 6 5 import type { IrSchemaToAstOptions } from '../../shared/types'; ··· 24 23 schema: SchemaWithType; 25 24 }): { 26 25 anyType?: string; 27 - expression: ts.Expression; 26 + expression: ReturnType<typeof $.call | typeof $.expr>; 28 27 } => { 29 28 switch (schema.type) { 30 29 case 'array':
+2 -7
packages/openapi-ts/src/plugins/valibot/v1/toAst/never.ts
··· 1 1 import type { SchemaWithType } from '~/plugins'; 2 - import { tsc } from '~/tsc'; 2 + import { $ } from '~/ts-dsl'; 3 3 4 4 import type { IrSchemaToAstOptions } from '../../shared/types'; 5 5 import { identifiers } from '../constants'; ··· 13 13 category: 'external', 14 14 resource: 'valibot.v', 15 15 }); 16 - const expression = tsc.callExpression({ 17 - functionName: tsc.propertyAccessExpression({ 18 - expression: v.placeholder, 19 - name: identifiers.schemas.never, 20 - }), 21 - }); 16 + const expression = $(v.placeholder).attr(identifiers.schemas.never).call(); 22 17 return expression; 23 18 };
+2 -7
packages/openapi-ts/src/plugins/valibot/v1/toAst/null.ts
··· 1 1 import type { SchemaWithType } from '~/plugins'; 2 - import { tsc } from '~/tsc'; 2 + import { $ } from '~/ts-dsl'; 3 3 4 4 import type { IrSchemaToAstOptions } from '../../shared/types'; 5 5 import { identifiers } from '../constants'; ··· 13 13 category: 'external', 14 14 resource: 'valibot.v', 15 15 }); 16 - const expression = tsc.callExpression({ 17 - functionName: tsc.propertyAccessExpression({ 18 - expression: v.placeholder, 19 - name: identifiers.schemas.null, 20 - }), 21 - }); 16 + const expression = $(v.placeholder).attr(identifiers.schemas.null).call(); 22 17 return expression; 23 18 };
+52 -147
packages/openapi-ts/src/plugins/valibot/v1/toAst/number.ts
··· 1 - import type ts from 'typescript'; 2 - 3 1 import type { SchemaWithType } from '~/plugins'; 4 - import { tsc } from '~/tsc'; 2 + import { $ } from '~/ts-dsl'; 5 3 6 4 import { 7 5 INTEGER_FORMATS, ··· 32 30 // Return early if const is defined since we can create a literal type directly without additional validation 33 31 if (schema.const !== undefined && schema.const !== null) { 34 32 const constValue = schema.const; 35 - let literalValue; 33 + let literalValue: ReturnType<typeof $.toExpr>; 36 34 37 35 // Case 1: Number with no format -> generate literal with the number 38 36 if (typeof constValue === 'number' && !format) { 39 - literalValue = tsc.ots.number(constValue); 37 + literalValue = $.literal(constValue); 40 38 } 41 39 // Case 2: Number with format -> check if format needs BigInt, generate appropriate literal 42 40 else if (typeof constValue === 'number' && format) { 43 41 if (isBigInt) { 44 42 // Format requires BigInt, convert number to BigInt 45 - literalValue = tsc.callExpression({ 46 - functionName: 'BigInt', 47 - parameters: [tsc.ots.string(constValue.toString())], 48 - }); 43 + literalValue = $('BigInt').call($.literal(constValue)); 49 44 } else { 50 45 // Regular format, use number as-is 51 - literalValue = tsc.ots.number(constValue); 46 + literalValue = $.literal(constValue); 52 47 } 53 48 } 54 49 // Case 3: Format that allows string -> generate BigInt literal (for int64/uint64 formats) ··· 57 52 const cleanString = constValue.endsWith('n') 58 53 ? constValue.slice(0, -1) 59 54 : constValue; 60 - literalValue = tsc.callExpression({ 61 - functionName: 'BigInt', 62 - parameters: [tsc.ots.string(cleanString)], 63 - }); 55 + literalValue = $('BigInt').call($.literal(cleanString)); 64 56 } 65 57 // Case 4: Const is typeof bigint (literal) -> transform from literal to BigInt() 66 58 else if (typeof constValue === 'bigint') { ··· 69 61 const cleanString = bigintString.endsWith('n') 70 62 ? bigintString.slice(0, -1) 71 63 : bigintString; 72 - literalValue = tsc.callExpression({ 73 - functionName: 'BigInt', 74 - parameters: [tsc.ots.string(cleanString)], 75 - }); 64 + literalValue = $('BigInt').call($.literal(cleanString)); 76 65 } 77 66 // Default case: use value as-is for other types 78 67 else { 79 - literalValue = tsc.valueToExpression({ value: constValue }); 68 + literalValue = $.toExpr(constValue); 80 69 } 81 70 82 - return tsc.callExpression({ 83 - functionName: tsc.propertyAccessExpression({ 84 - expression: v.placeholder, 85 - name: identifiers.schemas.literal, 86 - }), 87 - parameters: [literalValue], 88 - }); 71 + return $(v.placeholder) 72 + .attr(identifiers.schemas.literal) 73 + .call(literalValue); 89 74 } 90 75 91 - const pipes: Array<ts.CallExpression> = []; 76 + const pipes: Array<ReturnType<typeof $.call>> = []; 92 77 93 78 // For bigint formats (int64, uint64), create union of number, string, and bigint with transform 94 79 if (isBigInt) { 95 - const unionExpression = tsc.callExpression({ 96 - functionName: tsc.propertyAccessExpression({ 97 - expression: v.placeholder, 98 - name: identifiers.schemas.union, 99 - }), 100 - parameters: [ 101 - tsc.arrayLiteralExpression({ 102 - elements: [ 103 - tsc.callExpression({ 104 - functionName: tsc.propertyAccessExpression({ 105 - expression: v.placeholder, 106 - name: identifiers.schemas.number, 107 - }), 108 - }), 109 - tsc.callExpression({ 110 - functionName: tsc.propertyAccessExpression({ 111 - expression: v.placeholder, 112 - name: identifiers.schemas.string, 113 - }), 114 - }), 115 - tsc.callExpression({ 116 - functionName: tsc.propertyAccessExpression({ 117 - expression: v.placeholder, 118 - name: identifiers.schemas.bigInt, 119 - }), 120 - }), 121 - ], 122 - multiLine: false, 123 - }), 124 - ], 125 - }); 80 + const unionExpression = $(v.placeholder) 81 + .attr(identifiers.schemas.union) 82 + .call( 83 + $.array( 84 + $(v.placeholder).attr(identifiers.schemas.number).call(), 85 + $(v.placeholder).attr(identifiers.schemas.string).call(), 86 + $(v.placeholder).attr(identifiers.schemas.bigInt).call(), 87 + ), 88 + ); 126 89 pipes.push(unionExpression); 127 90 128 91 // Add transform to convert to BigInt 129 - const transformExpression = tsc.callExpression({ 130 - functionName: tsc.propertyAccessExpression({ 131 - expression: v.placeholder, 132 - name: identifiers.actions.transform, 133 - }), 134 - parameters: [ 135 - tsc.arrowFunction({ 136 - parameters: [{ name: 'x' }], 137 - statements: tsc.callExpression({ 138 - functionName: 'BigInt', 139 - parameters: [tsc.identifier({ text: 'x' })], 140 - }), 141 - }), 142 - ], 143 - }); 92 + const transformExpression = $(v.placeholder) 93 + .attr(identifiers.actions.transform) 94 + .call($.func().param('x').do($('BigInt').call('x').return())); 144 95 pipes.push(transformExpression); 145 96 } else { 146 97 // For regular number formats, use number schema 147 - const expression = tsc.callExpression({ 148 - functionName: tsc.propertyAccessExpression({ 149 - expression: v.placeholder, 150 - name: identifiers.schemas.number, 151 - }), 152 - }); 98 + const expression = $(v.placeholder).attr(identifiers.schemas.number).call(); 153 99 pipes.push(expression); 154 100 } 155 101 156 102 // Add integer validation for integer types (except when using bigint union) 157 103 if (!isBigInt && isInteger) { 158 - const expression = tsc.callExpression({ 159 - functionName: tsc.propertyAccessExpression({ 160 - expression: v.placeholder, 161 - name: identifiers.actions.integer, 162 - }), 163 - }); 104 + const expression = $(v.placeholder) 105 + .attr(identifiers.actions.integer) 106 + .call(); 164 107 pipes.push(expression); 165 108 } 166 109 ··· 172 115 const maxErrorMessage = formatInfo.maxError; 173 116 174 117 // Add minimum value validation 175 - const minExpression = tsc.callExpression({ 176 - functionName: tsc.propertyAccessExpression({ 177 - expression: v.placeholder, 178 - name: identifiers.actions.minValue, 179 - }), 180 - parameters: [ 181 - isBigInt 182 - ? tsc.callExpression({ 183 - functionName: 'BigInt', 184 - parameters: [tsc.ots.string(minValue.toString())], 185 - }) 186 - : tsc.ots.number(minValue as number), 187 - tsc.ots.string(minErrorMessage), 188 - ], 189 - }); 118 + const minExpression = $(v.placeholder) 119 + .attr(identifiers.actions.minValue) 120 + .call( 121 + isBigInt ? $('BigInt').call($.literal(minValue)) : $.literal(minValue), 122 + $.literal(minErrorMessage), 123 + ); 190 124 pipes.push(minExpression); 191 125 192 126 // Add maximum value validation 193 - const maxExpression = tsc.callExpression({ 194 - functionName: tsc.propertyAccessExpression({ 195 - expression: v.placeholder, 196 - name: identifiers.actions.maxValue, 197 - }), 198 - parameters: [ 199 - isBigInt 200 - ? tsc.callExpression({ 201 - functionName: 'BigInt', 202 - parameters: [tsc.ots.string(maxValue.toString())], 203 - }) 204 - : tsc.ots.number(maxValue as number), 205 - tsc.ots.string(maxErrorMessage), 206 - ], 207 - }); 127 + const maxExpression = $(v.placeholder) 128 + .attr(identifiers.actions.maxValue) 129 + .call( 130 + isBigInt ? $('BigInt').call($.literal(maxValue)) : $.literal(maxValue), 131 + $.literal(maxErrorMessage), 132 + ); 208 133 pipes.push(maxExpression); 209 134 } 210 135 211 136 if (schema.exclusiveMinimum !== undefined) { 212 - const expression = tsc.callExpression({ 213 - functionName: tsc.propertyAccessExpression({ 214 - expression: v.placeholder, 215 - name: identifiers.actions.gtValue, 216 - }), 217 - parameters: [ 218 - numberParameter({ isBigInt, value: schema.exclusiveMinimum }), 219 - ], 220 - }); 137 + const expression = $(v.placeholder) 138 + .attr(identifiers.actions.gtValue) 139 + .call(numberParameter({ isBigInt, value: schema.exclusiveMinimum })); 221 140 pipes.push(expression); 222 141 } else if (schema.minimum !== undefined) { 223 - const expression = tsc.callExpression({ 224 - functionName: tsc.propertyAccessExpression({ 225 - expression: v.placeholder, 226 - name: identifiers.actions.minValue, 227 - }), 228 - parameters: [numberParameter({ isBigInt, value: schema.minimum })], 229 - }); 142 + const expression = $(v.placeholder) 143 + .attr(identifiers.actions.minValue) 144 + .call(numberParameter({ isBigInt, value: schema.minimum })); 230 145 pipes.push(expression); 231 146 } 232 147 233 148 if (schema.exclusiveMaximum !== undefined) { 234 - const expression = tsc.callExpression({ 235 - functionName: tsc.propertyAccessExpression({ 236 - expression: v.placeholder, 237 - name: identifiers.actions.ltValue, 238 - }), 239 - parameters: [ 240 - numberParameter({ isBigInt, value: schema.exclusiveMaximum }), 241 - ], 242 - }); 149 + const expression = $(v.placeholder) 150 + .attr(identifiers.actions.ltValue) 151 + .call(numberParameter({ isBigInt, value: schema.exclusiveMaximum })); 243 152 pipes.push(expression); 244 153 } else if (schema.maximum !== undefined) { 245 - const expression = tsc.callExpression({ 246 - functionName: tsc.propertyAccessExpression({ 247 - expression: v.placeholder, 248 - name: identifiers.actions.maxValue, 249 - }), 250 - parameters: [numberParameter({ isBigInt, value: schema.maximum })], 251 - }); 154 + const expression = $(v.placeholder) 155 + .attr(identifiers.actions.maxValue) 156 + .call(numberParameter({ isBigInt, value: schema.maximum })); 252 157 pipes.push(expression); 253 158 } 254 159
+1 -3
packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts
··· 1 - import type ts from 'typescript'; 2 - 3 1 import type { SchemaWithType } from '~/plugins'; 4 2 import { toRef } from '~/plugins/shared/utils/refs'; 5 3 import { $ } from '~/ts-dsl'; ··· 88 86 shape.prop(name, pipesToAst({ pipes: propertyAst.pipes, plugin })); 89 87 } 90 88 91 - let additional: ts.Expression | null | undefined; 89 + let additional: ReturnType<typeof $.call | typeof $.expr> | null | undefined; 92 90 if (schema.additionalProperties && schema.additionalProperties.type) { 93 91 if (schema.additionalProperties.type === 'never') { 94 92 additional = null;
+1 -3
packages/openapi-ts/src/plugins/valibot/v1/toAst/string.ts
··· 1 - import type ts from 'typescript'; 2 - 3 1 import type { SchemaWithType } from '~/plugins'; 4 2 import { $ } from '~/ts-dsl'; 5 3 ··· 52 50 schema, 53 51 }: IrSchemaToAstOptions & { 54 52 schema: SchemaWithType<'string'>; 55 - }): ts.Expression => { 53 + }): ReturnType<typeof $.call | typeof $.expr> => { 56 54 const pipes: Array<ReturnType<typeof $.call>> = []; 57 55 58 56 const v = plugin.referenceSymbol({
+8 -30
packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts
··· 1 1 import type { SchemaWithType } from '~/plugins'; 2 2 import { toRef } from '~/plugins/shared/utils/refs'; 3 - import { tsc } from '~/tsc'; 3 + import { $ } from '~/ts-dsl'; 4 4 5 5 import { pipesToAst } from '../../shared/pipesToAst'; 6 6 import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; ··· 24 24 25 25 if (schema.const && Array.isArray(schema.const)) { 26 26 const tupleElements = schema.const.map((value) => 27 - tsc.callExpression({ 28 - functionName: tsc.propertyAccessExpression({ 29 - expression: v.placeholder, 30 - name: identifiers.schemas.literal, 31 - }), 32 - parameters: [tsc.valueToExpression({ value })], 33 - }), 27 + $(v.placeholder).attr(identifiers.schemas.literal).call($.toExpr(value)), 34 28 ); 35 29 result.pipes = [ 36 - tsc.callExpression({ 37 - functionName: tsc.propertyAccessExpression({ 38 - expression: v.placeholder, 39 - name: identifiers.schemas.tuple, 40 - }), 41 - parameters: [ 42 - tsc.arrayLiteralExpression({ 43 - elements: tupleElements, 44 - }), 45 - ], 46 - }), 30 + $(v.placeholder) 31 + .attr(identifiers.schemas.tuple) 32 + .call($.array(...tupleElements)), 47 33 ]; 48 34 return result as Omit<Ast, 'typeName'>; 49 35 } ··· 64 50 return pipesToAst({ pipes: schemaPipes.pipes, plugin }); 65 51 }); 66 52 result.pipes = [ 67 - tsc.callExpression({ 68 - functionName: tsc.propertyAccessExpression({ 69 - expression: v.placeholder, 70 - name: identifiers.schemas.tuple, 71 - }), 72 - parameters: [ 73 - tsc.arrayLiteralExpression({ 74 - elements: tupleElements, 75 - }), 76 - ], 77 - }), 53 + $(v.placeholder) 54 + .attr(identifiers.schemas.tuple) 55 + .call($.array(...tupleElements)), 78 56 ]; 79 57 return result as Omit<Ast, 'typeName'>; 80 58 }
+4 -7
packages/openapi-ts/src/plugins/valibot/v1/toAst/undefined.ts
··· 1 1 import type { SchemaWithType } from '~/plugins'; 2 - import { tsc } from '~/tsc'; 2 + import { $ } from '~/ts-dsl'; 3 3 4 4 import type { IrSchemaToAstOptions } from '../../shared/types'; 5 5 import { identifiers } from '../constants'; ··· 14 14 resource: 'valibot.v', 15 15 }); 16 16 17 - const expression = tsc.callExpression({ 18 - functionName: tsc.propertyAccessExpression({ 19 - expression: v.placeholder, 20 - name: identifiers.schemas.undefined, 21 - }), 22 - }); 17 + const expression = $(v.placeholder) 18 + .attr(identifiers.schemas.undefined) 19 + .call(); 23 20 return expression; 24 21 };
+2 -7
packages/openapi-ts/src/plugins/valibot/v1/toAst/unknown.ts
··· 1 1 import type { SchemaWithType } from '~/plugins'; 2 - import { tsc } from '~/tsc'; 2 + import { $ } from '~/ts-dsl'; 3 3 4 4 import type { IrSchemaToAstOptions } from '../../shared/types'; 5 5 import { identifiers } from '../constants'; ··· 14 14 resource: 'valibot.v', 15 15 }); 16 16 17 - const expression = tsc.callExpression({ 18 - functionName: tsc.propertyAccessExpression({ 19 - expression: v.placeholder, 20 - name: identifiers.schemas.unknown, 21 - }), 22 - }); 17 + const expression = $(v.placeholder).attr(identifiers.schemas.unknown).call(); 23 18 return expression; 24 19 };
+2 -7
packages/openapi-ts/src/plugins/valibot/v1/toAst/void.ts
··· 1 1 import type { SchemaWithType } from '~/plugins'; 2 - import { tsc } from '~/tsc'; 2 + import { $ } from '~/ts-dsl'; 3 3 4 4 import type { IrSchemaToAstOptions } from '../../shared/types'; 5 5 import { identifiers } from '../constants'; ··· 14 14 resource: 'valibot.v', 15 15 }); 16 16 17 - const expression = tsc.callExpression({ 18 - functionName: tsc.propertyAccessExpression({ 19 - expression: v.placeholder, 20 - name: identifiers.schemas.void, 21 - }), 22 - }); 17 + const expression = $(v.placeholder).attr(identifiers.schemas.void).call(); 23 18 return expression; 24 19 };