Skip to content

Commit 2f981d9

Browse files
authored
Merge pull request #3544 from hey-api/test/valibot-plugin
test: move valibot tests into separate package
2 parents 2bfc2d0 + e5f3ed5 commit 2f981d9

130 files changed

Lines changed: 374 additions & 15923 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/openapi-ts-tests/main/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
"rxjs": "7.8.2",
4343
"tslib": "2.8.1",
4444
"typescript": "5.9.3",
45-
"valibot": "1.2.0",
4645
"vue": "3.5.25",
4746
"zod": "4.3.6"
4847
},

packages/openapi-ts-tests/main/test/3.0.x.test.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ describe(`OpenAPI ${version}`, () => {
8181
config: createConfig({
8282
input: 'array-items-one-of-length-1.yaml',
8383
output: 'array-items-one-of-length-1',
84-
plugins: ['@hey-api/typescript', 'valibot'],
8584
}),
8685
description: 'generates correct array when items are oneOf array with single item',
8786
},
@@ -248,7 +247,6 @@ describe(`OpenAPI ${version}`, () => {
248247
enums: 'root',
249248
},
250249
},
251-
plugins: ['@hey-api/typescript'],
252250
}),
253251
description: 'exports inline enums',
254252
},
@@ -535,7 +533,6 @@ describe(`OpenAPI ${version}`, () => {
535533
config: createConfig({
536534
input: 'enum-null.json',
537535
output: 'enum-null',
538-
plugins: ['@hey-api/typescript', 'valibot'],
539536
}),
540537
description: 'handles null enums',
541538
},
@@ -586,7 +583,6 @@ describe(`OpenAPI ${version}`, () => {
586583
config: createConfig({
587584
input: 'ref-deep.yaml',
588585
output: 'ref-deep',
589-
plugins: ['@hey-api/typescript'],
590586
}),
591587
description: 'handles deep references',
592588
},
@@ -616,7 +612,6 @@ describe(`OpenAPI ${version}`, () => {
616612
},
617613
},
618614
},
619-
plugins: ['@hey-api/typescript'],
620615
}),
621616
description: 'handles schema name transforms',
622617
},
@@ -632,7 +627,6 @@ describe(`OpenAPI ${version}`, () => {
632627
name.replace(/_v\d+_User$/, ''),
633628
},
634629
},
635-
plugins: ['@hey-api/typescript'],
636630
}),
637631
description: 'handles schema name collision prevention',
638632
},
@@ -763,7 +757,6 @@ describe(`OpenAPI ${version}`, () => {
763757
propertiesRequiredByDefault: true,
764758
},
765759
},
766-
plugins: ['@hey-api/typescript'],
767760
}),
768761
description: 'makes all object properties required by default',
769762
},
@@ -774,14 +767,6 @@ describe(`OpenAPI ${version}`, () => {
774767
}),
775768
description: 'gracefully handles invalid type',
776769
},
777-
{
778-
config: createConfig({
779-
input: 'validators.json',
780-
output: 'validators',
781-
plugins: ['valibot'],
782-
}),
783-
description: 'generates validator schemas',
784-
},
785770
];
786771

787772
it.each(scenarios)('$description', async ({ config }) => {

packages/openapi-ts-tests/main/test/3.1.x.test.ts

Lines changed: 2 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ describe(`OpenAPI ${version}`, () => {
101101
config: createConfig({
102102
input: 'array-items-one-of-length-1.yaml',
103103
output: 'array-items-one-of-length-1',
104-
plugins: ['@hey-api/typescript', 'valibot'],
105104
}),
106105
description: 'generates correct array when items are oneOf array with single item',
107106
},
@@ -288,7 +287,6 @@ describe(`OpenAPI ${version}`, () => {
288287
enums: 'root',
289288
},
290289
},
291-
plugins: ['@hey-api/typescript'],
292290
}),
293291
description: 'exports inline enums',
294292
},
@@ -575,15 +573,13 @@ describe(`OpenAPI ${version}`, () => {
575573
config: createConfig({
576574
input: 'union-types.json',
577575
output: 'union-types',
578-
plugins: ['@hey-api/typescript'],
579576
}),
580577
description: 'handles union of primitive types',
581578
},
582579
{
583580
config: createConfig({
584581
input: 'enum-null.json',
585582
output: 'enum-null',
586-
plugins: ['@hey-api/typescript', 'valibot'],
587583
}),
588584
description: 'handles null enums',
589585
},
@@ -695,7 +691,6 @@ describe(`OpenAPI ${version}`, () => {
695691
config: createConfig({
696692
input: 'ref-deep.yaml',
697693
output: 'ref-deep',
698-
plugins: ['@hey-api/typescript'],
699694
}),
700695
description: 'handles deep references',
701696
},
@@ -725,31 +720,27 @@ describe(`OpenAPI ${version}`, () => {
725720
},
726721
},
727722
},
728-
plugins: ['@hey-api/typescript'],
729723
}),
730724
description: 'handles schema name transforms',
731725
},
732726
{
733727
config: createConfig({
734728
input: 'transforms-read-write-nested.yaml',
735729
output: 'transforms-read-write-nested',
736-
plugins: ['@hey-api/typescript'],
737730
}),
738731
description: 'handles write-only types in nested schemas',
739732
},
740733
{
741734
config: createConfig({
742735
input: 'transforms-read-write-response.yaml',
743736
output: 'transforms-read-write-response',
744-
plugins: ['@hey-api/typescript'],
745737
}),
746738
description: 'handles read-only types in nested response schemas',
747739
},
748740
{
749741
config: createConfig({
750742
input: 'transforms-read-write-unevaluated.yaml',
751743
output: 'transforms-read-write-unevaluated',
752-
plugins: ['@hey-api/typescript'],
753744
}),
754745
description: 'preserves unevaluatedProperties in schemas with readOnly fields',
755746
},
@@ -785,7 +776,6 @@ describe(`OpenAPI ${version}`, () => {
785776
config: createConfig({
786777
input: 'schema-const.yaml',
787778
output: 'schema-const',
788-
plugins: ['@hey-api/typescript', 'valibot'],
789779
}),
790780
description: 'handles various constants',
791781
},
@@ -922,93 +912,6 @@ describe(`OpenAPI ${version}`, () => {
922912
}),
923913
description: 'gracefully handles invalid type',
924914
},
925-
{
926-
config: createConfig({
927-
input: 'validators.yaml',
928-
output: 'validators',
929-
plugins: ['valibot'],
930-
}),
931-
description: 'generates validator schemas',
932-
},
933-
{
934-
config: createConfig({
935-
input: 'validators.yaml',
936-
output: 'validators-metadata',
937-
plugins: [
938-
{
939-
metadata: true,
940-
name: 'valibot',
941-
},
942-
],
943-
}),
944-
description: 'generates validator schemas with metadata',
945-
},
946-
{
947-
config: createConfig({
948-
input: 'validators.yaml',
949-
output: 'validators-metadata-fn',
950-
plugins: [
951-
{
952-
metadata: ({ $, node, schema }) => {
953-
node
954-
.prop('custom', $.literal('value'))
955-
.prop('title', $.literal(schema.description ?? schema.type ?? ''));
956-
},
957-
name: 'valibot',
958-
},
959-
],
960-
}),
961-
description: 'generates validator schemas with metadata function',
962-
},
963-
{
964-
config: createConfig({
965-
input: 'validators.yaml',
966-
output: 'validators-types',
967-
plugins: ['valibot'],
968-
}),
969-
description: 'generates validator schemas with types',
970-
},
971-
{
972-
config: createConfig({
973-
input: 'validators-bigint-min-max.json',
974-
output: 'validators-bigint-min-max',
975-
plugins: ['valibot'],
976-
}),
977-
description: 'validator schemas with BigInt and min/max constraints',
978-
},
979-
{
980-
config: createConfig({
981-
input: 'validators-circular-ref.json',
982-
output: 'validators-circular-ref',
983-
plugins: ['valibot'],
984-
}),
985-
description: 'validator schemas with circular reference',
986-
},
987-
{
988-
config: createConfig({
989-
input: 'validators-circular-ref-2.yaml',
990-
output: 'validators-circular-ref-2',
991-
plugins: ['valibot'],
992-
}),
993-
description: 'validator schemas with circular reference 2',
994-
},
995-
{
996-
config: createConfig({
997-
input: 'validators-union-merge.json',
998-
output: 'validators-union-merge',
999-
plugins: ['valibot'],
1000-
}),
1001-
description: "validator schemas with merged unions (can't use .merge())",
1002-
},
1003-
{
1004-
config: createConfig({
1005-
input: 'integer-formats.yaml',
1006-
output: 'integer-formats',
1007-
plugins: ['valibot'],
1008-
}),
1009-
description:
1010-
'generates validator schemas for all integer format combinations (number/integer/string types with int8, int16, int32, int64, uint8, uint16, uint32, uint64 formats)',
1011-
},
1012915
{
1013916
config: createConfig({
1014917
input: 'opencode.yaml',
@@ -1111,26 +1014,18 @@ describe(`OpenAPI ${version}`, () => {
11111014
config: createConfig({
11121015
input: 'zoom-video-sdk.json',
11131016
output: 'webhooks',
1114-
plugins: ['@hey-api/typescript', 'valibot', 'zod'],
1017+
plugins: ['@hey-api/typescript', 'zod'],
11151018
}),
11161019
description: 'webhook types and validator schemas',
11171020
},
11181021
{
11191022
config: createConfig({
11201023
input: 'string-with-format.yaml',
11211024
output: 'string-with-format',
1122-
plugins: ['@hey-api/typescript', 'valibot', 'zod'],
1025+
plugins: ['@hey-api/typescript', 'zod'],
11231026
}),
11241027
description: 'anyOf string and binary string',
11251028
},
1126-
{
1127-
config: createConfig({
1128-
input: 'time-format.yaml',
1129-
output: 'time-format',
1130-
plugins: ['valibot'],
1131-
}),
1132-
description: 'generates correct valibot schema for time format',
1133-
},
11341029
];
11351030

11361031
it.each(scenarios)('$description', async ({ config }) => {

0 commit comments

Comments
 (0)