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

feat: add number base resolvers

Lubos cfab9a09 aaece238

Changed files
+225 -163
dev
packages
openapi-ts
openapi-ts-tests
main
test
__snapshots__
3.0.x
plugins
valibot
default
3.1.x
plugins
valibot
default
validators-bigint-min-max
zod
v3
__snapshots__
3.0.x
mini
default
v3
default
v4
default
3.1.x
mini
default
validators-bigint-min-max
v3
default
validators-bigint-min-max
v4
default
validators-bigint-min-max
v4
__snapshots__
3.0.x
mini
default
v3
default
v4
default
3.1.x
mini
default
validators-bigint-min-max
v3
default
validators-bigint-min-max
v4
default
validators-bigint-min-max
+9
dev/openapi-ts.config.ts
··· 431 }, 432 }, 433 '~resolvers': { 434 object: { 435 // base({ $, additional, pipes, shape }) { 436 // if (additional === undefined) {
··· 431 }, 432 }, 433 '~resolvers': { 434 + number: { 435 + // base({ $, pipes, v }) { 436 + // return pipes.push($(v).attr('test').call()); 437 + // }, 438 + formats: { 439 + // date: ({ $, pipes }) => pipes.push($('v').attr('isoDateTime').call()), 440 + // 'date-time': ({ $, pipes }) => pipes.push($('v').attr('isoDateTime').call()), 441 + }, 442 + }, 443 object: { 444 // base({ $, additional, pipes, shape }) { 445 // if (additional === undefined) {
+6 -6
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/valibot/default/valibot.gen.ts
··· 630 }); 631 632 export const vPageable = v.object({ 633 - page: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2147483648'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2147483647'), v.minValue(0)), 0), 634 - size: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2147483648'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2147483647'), v.minValue(1))), 635 sort: v.optional(v.array(v.string())) 636 }); 637 ··· 962 }), v.strictObject({ 963 bar: vNonAsciiStringæøåÆøÅöôêÊ字符串 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 <= 65535'), 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 <= 255'), v.minValue(0)) 967 })]); 968 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 <= 65535'), 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 <= 255'), v.minValue(0)) 972 })]); 973 974 /**
··· 630 }); 631 632 export const vPageable = v.object({ 633 + page: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2147483647')), 0), 634 + size: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2147483647'))), 635 sort: v.optional(v.array(v.string())) 636 }); 637 ··· 962 }), v.strictObject({ 963 bar: vNonAsciiStringæøåÆøÅöôêÊ字符串 964 })]), v.object({ 965 + baz: v.union([v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(65535, 'Invalid value: Expected uint16 to be <= 65535')), v.null()]), 966 + qux: v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(255, 'Invalid value: Expected uint8 to be <= 255')) 967 })]); 968 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), v.maxValue(65535, 'Invalid value: Expected uint16 to be <= 65535')), v.null()]), 971 + qux: v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(255, 'Invalid value: Expected uint8 to be <= 255')) 972 })]); 973 974 /**
+6 -6
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/valibot/default/valibot.gen.ts
··· 630 }); 631 632 export const vPageable = v.object({ 633 - page: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2147483648'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2147483647'), v.minValue(0)), 0), 634 - size: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2147483648'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2147483647'), v.minValue(1))), 635 sort: v.optional(v.array(v.string())) 636 }); 637 ··· 972 }), v.strictObject({ 973 bar: vNonAsciiStringæøåÆøÅöôêÊ字符串 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 <= 65535'), 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 <= 255'), v.minValue(0)) 977 })]); 978 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 <= 65535'), 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 <= 255'), v.minValue(0)) 982 })]); 983 984 /**
··· 630 }); 631 632 export const vPageable = v.object({ 633 + page: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2147483647')), 0), 634 + size: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2147483647'))), 635 sort: v.optional(v.array(v.string())) 636 }); 637 ··· 972 }), v.strictObject({ 973 bar: vNonAsciiStringæøåÆøÅöôêÊ字符串 974 })]), v.object({ 975 + baz: v.union([v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(65535, 'Invalid value: Expected uint16 to be <= 65535')), v.null()]), 976 + qux: v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(255, 'Invalid value: Expected uint8 to be <= 255')) 977 })]); 978 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), v.maxValue(65535, 'Invalid value: Expected uint16 to be <= 65535')), v.null()]), 981 + qux: v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(255, 'Invalid value: Expected uint8 to be <= 255')) 982 })]); 983 984 /**
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-bigint-min-max/valibot.gen.ts
··· 7 v.number(), 8 v.string(), 9 v.bigint() 10 - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -9223372036854775808'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 9223372036854775807'), v.minValue(BigInt(0)), v.maxValue(BigInt(100)))) 11 });
··· 7 v.number(), 8 v.string(), 9 v.bigint() 10 + ]), v.transform(x => BigInt(x)), v.minValue(BigInt(0)), v.maxValue(BigInt(100)))) 11 });
+6 -6
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/default/zod.gen.ts
··· 710 }); 711 712 export const zPageable = z.object({ 713 - page: z._default(z.optional(z.int().check(z.minimum(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }), z.maximum(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }), z.gte(0))), 0), 714 - size: z.optional(z.int().check(z.minimum(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }), z.maximum(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }), z.gte(1))), 715 sort: z.optional(z.array(z.string())) 716 }); 717 ··· 1127 }) 1128 ]), z.object({ 1129 baz: z.union([ 1130 - z.int().check(z.minimum(0, { error: 'Invalid value: Expected uint16 to be >= 0' }), z.maximum(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }), z.gte(0)), 1131 z.null() 1132 ]), 1133 - qux: z.int().check(z.minimum(0, { error: 'Invalid value: Expected uint8 to be >= 0' }), z.maximum(255, { error: 'Invalid value: Expected uint8 to be <= 255' }), z.gte(0)) 1134 })); 1135 1136 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1138 zNonAsciiStringæøåÆøÅöôêÊ字符串 1139 ]), z.object({ 1140 baz: z.union([ 1141 - z.int().check(z.minimum(0, { error: 'Invalid value: Expected uint16 to be >= 0' }), z.maximum(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }), z.gte(0)), 1142 z.null() 1143 ]), 1144 - qux: z.int().check(z.minimum(0, { error: 'Invalid value: Expected uint8 to be >= 0' }), z.maximum(255, { error: 'Invalid value: Expected uint8 to be <= 255' }), z.gte(0)) 1145 })); 1146 1147 /**
··· 710 }); 711 712 export const zPageable = z.object({ 713 + page: z._default(z.optional(z.int().check(z.gte(0), z.maximum(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }))), 0), 714 + size: z.optional(z.int().check(z.gte(1), z.maximum(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }))), 715 sort: z.optional(z.array(z.string())) 716 }); 717 ··· 1127 }) 1128 ]), z.object({ 1129 baz: z.union([ 1130 + z.int().check(z.gte(0), z.maximum(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' })), 1131 z.null() 1132 ]), 1133 + qux: z.int().check(z.gte(0), z.maximum(255, { error: 'Invalid value: Expected uint8 to be <= 255' })) 1134 })); 1135 1136 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1138 zNonAsciiStringæøåÆøÅöôêÊ字符串 1139 ]), z.object({ 1140 baz: z.union([ 1141 + z.int().check(z.gte(0), z.maximum(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' })), 1142 z.null() 1143 ]), 1144 + qux: z.int().check(z.gte(0), z.maximum(255, { error: 'Invalid value: Expected uint8 to be <= 255' })) 1145 })); 1146 1147 /**
+6 -6
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v3/default/zod.gen.ts
··· 708 }); 709 710 export const zPageable = z.object({ 711 - page: z.number().int().min(-2147483648, { message: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { message: 'Invalid value: Expected int32 to be <= 2147483647' }).gte(0).optional().default(0), 712 - size: z.number().int().min(-2147483648, { message: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { message: 'Invalid value: Expected int32 to be <= 2147483647' }).gte(1).optional(), 713 sort: z.array(z.string()).optional() 714 }); 715 ··· 1125 }) 1126 ]), z.object({ 1127 baz: z.union([ 1128 - z.number().int().min(0, { message: 'Invalid value: Expected uint16 to be >= 0' }).max(65535, { message: 'Invalid value: Expected uint16 to be <= 65535' }).gte(0), 1129 z.null() 1130 ]), 1131 - qux: z.number().int().min(0, { message: 'Invalid value: Expected uint8 to be >= 0' }).max(255, { message: 'Invalid value: Expected uint8 to be <= 255' }).gte(0) 1132 })); 1133 1134 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1136 zNonAsciiStringæøåÆøÅöôêÊ字符串 1137 ]), z.object({ 1138 baz: z.union([ 1139 - z.number().int().min(0, { message: 'Invalid value: Expected uint16 to be >= 0' }).max(65535, { message: 'Invalid value: Expected uint16 to be <= 65535' }).gte(0), 1140 z.null() 1141 ]), 1142 - qux: z.number().int().min(0, { message: 'Invalid value: Expected uint8 to be >= 0' }).max(255, { message: 'Invalid value: Expected uint8 to be <= 255' }).gte(0) 1143 })); 1144 1145 /**
··· 708 }); 709 710 export const zPageable = z.object({ 711 + page: z.number().int().gte(0).max(2147483647, { message: 'Invalid value: Expected int32 to be <= 2147483647' }).optional().default(0), 712 + size: z.number().int().gte(1).max(2147483647, { message: 'Invalid value: Expected int32 to be <= 2147483647' }).optional(), 713 sort: z.array(z.string()).optional() 714 }); 715 ··· 1125 }) 1126 ]), z.object({ 1127 baz: z.union([ 1128 + z.number().int().gte(0).max(65535, { message: 'Invalid value: Expected uint16 to be <= 65535' }), 1129 z.null() 1130 ]), 1131 + qux: z.number().int().gte(0).max(255, { message: 'Invalid value: Expected uint8 to be <= 255' }) 1132 })); 1133 1134 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1136 zNonAsciiStringæøåÆøÅöôêÊ字符串 1137 ]), z.object({ 1138 baz: z.union([ 1139 + z.number().int().gte(0).max(65535, { message: 'Invalid value: Expected uint16 to be <= 65535' }), 1140 z.null() 1141 ]), 1142 + qux: z.number().int().gte(0).max(255, { message: 'Invalid value: Expected uint8 to be <= 255' }) 1143 })); 1144 1145 /**
+6 -6
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/default/zod.gen.ts
··· 710 }); 711 712 export const zPageable = z.object({ 713 - page: z.optional(z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }).gte(0)).default(0), 714 - size: z.optional(z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }).gte(1)), 715 sort: z.optional(z.array(z.string())) 716 }); 717 ··· 1127 }) 1128 ]), z.object({ 1129 baz: z.union([ 1130 - z.int().min(0, { error: 'Invalid value: Expected uint16 to be >= 0' }).max(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }).gte(0), 1131 z.null() 1132 ]), 1133 - qux: z.int().min(0, { error: 'Invalid value: Expected uint8 to be >= 0' }).max(255, { error: 'Invalid value: Expected uint8 to be <= 255' }).gte(0) 1134 })); 1135 1136 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1138 zNonAsciiStringæøåÆøÅöôêÊ字符串 1139 ]), z.object({ 1140 baz: z.union([ 1141 - z.int().min(0, { error: 'Invalid value: Expected uint16 to be >= 0' }).max(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }).gte(0), 1142 z.null() 1143 ]), 1144 - qux: z.int().min(0, { error: 'Invalid value: Expected uint8 to be >= 0' }).max(255, { error: 'Invalid value: Expected uint8 to be <= 255' }).gte(0) 1145 })); 1146 1147 /**
··· 710 }); 711 712 export const zPageable = z.object({ 713 + page: z.optional(z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })).default(0), 714 + size: z.optional(z.int().gte(1).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })), 715 sort: z.optional(z.array(z.string())) 716 }); 717 ··· 1127 }) 1128 ]), z.object({ 1129 baz: z.union([ 1130 + z.int().gte(0).max(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }), 1131 z.null() 1132 ]), 1133 + qux: z.int().gte(0).max(255, { error: 'Invalid value: Expected uint8 to be <= 255' }) 1134 })); 1135 1136 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1138 zNonAsciiStringæøåÆøÅöôêÊ字符串 1139 ]), z.object({ 1140 baz: z.union([ 1141 + z.int().gte(0).max(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }), 1142 z.null() 1143 ]), 1144 + qux: z.int().gte(0).max(255, { error: 'Invalid value: Expected uint8 to be <= 255' }) 1145 })); 1146 1147 /**
+6 -6
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/default/zod.gen.ts
··· 707 }); 708 709 export const zPageable = z.object({ 710 - page: z._default(z.optional(z.int().check(z.minimum(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }), z.maximum(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }), z.gte(0))), 0), 711 - size: z.optional(z.int().check(z.minimum(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }), z.maximum(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }), z.gte(1))), 712 sort: z.optional(z.array(z.string())) 713 }); 714 ··· 1133 }) 1134 ]), z.object({ 1135 baz: z.union([ 1136 - z.int().check(z.minimum(0, { error: 'Invalid value: Expected uint16 to be >= 0' }), z.maximum(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }), z.gte(0)), 1137 z.null() 1138 ]), 1139 - qux: z.int().check(z.minimum(0, { error: 'Invalid value: Expected uint8 to be >= 0' }), z.maximum(255, { error: 'Invalid value: Expected uint8 to be <= 255' }), z.gte(0)) 1140 })); 1141 1142 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1144 zNonAsciiStringæøåÆøÅöôêÊ字符串 1145 ]), z.object({ 1146 baz: z.union([ 1147 - z.int().check(z.minimum(0, { error: 'Invalid value: Expected uint16 to be >= 0' }), z.maximum(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }), z.gte(0)), 1148 z.null() 1149 ]), 1150 - qux: z.int().check(z.minimum(0, { error: 'Invalid value: Expected uint8 to be >= 0' }), z.maximum(255, { error: 'Invalid value: Expected uint8 to be <= 255' }), z.gte(0)) 1151 })); 1152 1153 /**
··· 707 }); 708 709 export const zPageable = z.object({ 710 + page: z._default(z.optional(z.int().check(z.gte(0), z.maximum(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }))), 0), 711 + size: z.optional(z.int().check(z.gte(1), z.maximum(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }))), 712 sort: z.optional(z.array(z.string())) 713 }); 714 ··· 1133 }) 1134 ]), z.object({ 1135 baz: z.union([ 1136 + z.int().check(z.gte(0), z.maximum(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' })), 1137 z.null() 1138 ]), 1139 + qux: z.int().check(z.gte(0), z.maximum(255, { error: 'Invalid value: Expected uint8 to be <= 255' })) 1140 })); 1141 1142 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1144 zNonAsciiStringæøåÆøÅöôêÊ字符串 1145 ]), z.object({ 1146 baz: z.union([ 1147 + z.int().check(z.gte(0), z.maximum(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' })), 1148 z.null() 1149 ]), 1150 + qux: z.int().check(z.gte(0), z.maximum(255, { error: 'Invalid value: Expected uint8 to be <= 255' })) 1151 })); 1152 1153 /**
+1 -1
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-bigint-min-max/zod.gen.ts
··· 3 import * as z from 'zod/v4-mini'; 4 5 export const zFoo = z.object({ 6 - foo: z.optional(z.coerce.bigint().check(z.minimum(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }), z.maximum(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }), z.gte(BigInt(0)), z.lte(BigInt(100)))) 7 });
··· 3 import * as z from 'zod/v4-mini'; 4 5 export const zFoo = z.object({ 6 + foo: z.optional(z.coerce.bigint().check(z.gte(BigInt(0)), z.lte(BigInt(100)))) 7 });
+6 -6
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v3/default/zod.gen.ts
··· 705 }); 706 707 export const zPageable = z.object({ 708 - page: z.number().int().min(-2147483648, { message: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { message: 'Invalid value: Expected int32 to be <= 2147483647' }).gte(0).optional().default(0), 709 - size: z.number().int().min(-2147483648, { message: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { message: 'Invalid value: Expected int32 to be <= 2147483647' }).gte(1).optional(), 710 sort: z.array(z.string()).optional() 711 }); 712 ··· 1131 }) 1132 ]), z.object({ 1133 baz: z.union([ 1134 - z.number().int().min(0, { message: 'Invalid value: Expected uint16 to be >= 0' }).max(65535, { message: 'Invalid value: Expected uint16 to be <= 65535' }).gte(0), 1135 z.null() 1136 ]), 1137 - qux: z.number().int().min(0, { message: 'Invalid value: Expected uint8 to be >= 0' }).max(255, { message: 'Invalid value: Expected uint8 to be <= 255' }).gte(0) 1138 })); 1139 1140 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1142 zNonAsciiStringæøåÆøÅöôêÊ字符串 1143 ]), z.object({ 1144 baz: z.union([ 1145 - z.number().int().min(0, { message: 'Invalid value: Expected uint16 to be >= 0' }).max(65535, { message: 'Invalid value: Expected uint16 to be <= 65535' }).gte(0), 1146 z.null() 1147 ]), 1148 - qux: z.number().int().min(0, { message: 'Invalid value: Expected uint8 to be >= 0' }).max(255, { message: 'Invalid value: Expected uint8 to be <= 255' }).gte(0) 1149 })); 1150 1151 /**
··· 705 }); 706 707 export const zPageable = z.object({ 708 + page: z.number().int().gte(0).max(2147483647, { message: 'Invalid value: Expected int32 to be <= 2147483647' }).optional().default(0), 709 + size: z.number().int().gte(1).max(2147483647, { message: 'Invalid value: Expected int32 to be <= 2147483647' }).optional(), 710 sort: z.array(z.string()).optional() 711 }); 712 ··· 1131 }) 1132 ]), z.object({ 1133 baz: z.union([ 1134 + z.number().int().gte(0).max(65535, { message: 'Invalid value: Expected uint16 to be <= 65535' }), 1135 z.null() 1136 ]), 1137 + qux: z.number().int().gte(0).max(255, { message: 'Invalid value: Expected uint8 to be <= 255' }) 1138 })); 1139 1140 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1142 zNonAsciiStringæøåÆøÅöôêÊ字符串 1143 ]), z.object({ 1144 baz: z.union([ 1145 + z.number().int().gte(0).max(65535, { message: 'Invalid value: Expected uint16 to be <= 65535' }), 1146 z.null() 1147 ]), 1148 + qux: z.number().int().gte(0).max(255, { message: 'Invalid value: Expected uint8 to be <= 255' }) 1149 })); 1150 1151 /**
+1 -1
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v3/validators-bigint-min-max/zod.gen.ts
··· 3 import { z } from 'zod'; 4 5 export const zFoo = z.object({ 6 - foo: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).gte(BigInt(0)).lte(BigInt(100)).optional() 7 });
··· 3 import { z } from 'zod'; 4 5 export const zFoo = z.object({ 6 + foo: z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100)).optional() 7 });
+6 -6
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/default/zod.gen.ts
··· 707 }); 708 709 export const zPageable = z.object({ 710 - page: z.optional(z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }).gte(0)).default(0), 711 - size: z.optional(z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }).gte(1)), 712 sort: z.optional(z.array(z.string())) 713 }); 714 ··· 1133 }) 1134 ]), z.object({ 1135 baz: z.union([ 1136 - z.int().min(0, { error: 'Invalid value: Expected uint16 to be >= 0' }).max(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }).gte(0), 1137 z.null() 1138 ]), 1139 - qux: z.int().min(0, { error: 'Invalid value: Expected uint8 to be >= 0' }).max(255, { error: 'Invalid value: Expected uint8 to be <= 255' }).gte(0) 1140 })); 1141 1142 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1144 zNonAsciiStringæøåÆøÅöôêÊ字符串 1145 ]), z.object({ 1146 baz: z.union([ 1147 - z.int().min(0, { error: 'Invalid value: Expected uint16 to be >= 0' }).max(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }).gte(0), 1148 z.null() 1149 ]), 1150 - qux: z.int().min(0, { error: 'Invalid value: Expected uint8 to be >= 0' }).max(255, { error: 'Invalid value: Expected uint8 to be <= 255' }).gte(0) 1151 })); 1152 1153 /**
··· 707 }); 708 709 export const zPageable = z.object({ 710 + page: z.optional(z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })).default(0), 711 + size: z.optional(z.int().gte(1).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })), 712 sort: z.optional(z.array(z.string())) 713 }); 714 ··· 1133 }) 1134 ]), z.object({ 1135 baz: z.union([ 1136 + z.int().gte(0).max(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }), 1137 z.null() 1138 ]), 1139 + qux: z.int().gte(0).max(255, { error: 'Invalid value: Expected uint8 to be <= 255' }) 1140 })); 1141 1142 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1144 zNonAsciiStringæøåÆøÅöôêÊ字符串 1145 ]), z.object({ 1146 baz: z.union([ 1147 + z.int().gte(0).max(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }), 1148 z.null() 1149 ]), 1150 + qux: z.int().gte(0).max(255, { error: 'Invalid value: Expected uint8 to be <= 255' }) 1151 })); 1152 1153 /**
+1 -1
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-bigint-min-max/zod.gen.ts
··· 3 import { z } from 'zod/v4'; 4 5 export const zFoo = z.object({ 6 - foo: z.optional(z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).gte(BigInt(0)).lte(BigInt(100))) 7 });
··· 3 import { z } from 'zod/v4'; 4 5 export const zFoo = z.object({ 6 + foo: z.optional(z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100))) 7 });
+6 -6
packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/default/zod.gen.ts
··· 710 }); 711 712 export const zPageable = z.object({ 713 - page: z._default(z.optional(z.int().check(z.minimum(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }), z.maximum(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }), z.gte(0))), 0), 714 - size: z.optional(z.int().check(z.minimum(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }), z.maximum(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }), z.gte(1))), 715 sort: z.optional(z.array(z.string())) 716 }); 717 ··· 1127 }) 1128 ]), z.object({ 1129 baz: z.union([ 1130 - z.int().check(z.minimum(0, { error: 'Invalid value: Expected uint16 to be >= 0' }), z.maximum(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }), z.gte(0)), 1131 z.null() 1132 ]), 1133 - qux: z.int().check(z.minimum(0, { error: 'Invalid value: Expected uint8 to be >= 0' }), z.maximum(255, { error: 'Invalid value: Expected uint8 to be <= 255' }), z.gte(0)) 1134 })); 1135 1136 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1138 zNonAsciiStringæøåÆøÅöôêÊ字符串 1139 ]), z.object({ 1140 baz: z.union([ 1141 - z.int().check(z.minimum(0, { error: 'Invalid value: Expected uint16 to be >= 0' }), z.maximum(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }), z.gte(0)), 1142 z.null() 1143 ]), 1144 - qux: z.int().check(z.minimum(0, { error: 'Invalid value: Expected uint8 to be >= 0' }), z.maximum(255, { error: 'Invalid value: Expected uint8 to be <= 255' }), z.gte(0)) 1145 })); 1146 1147 /**
··· 710 }); 711 712 export const zPageable = z.object({ 713 + page: z._default(z.optional(z.int().check(z.gte(0), z.maximum(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }))), 0), 714 + size: z.optional(z.int().check(z.gte(1), z.maximum(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }))), 715 sort: z.optional(z.array(z.string())) 716 }); 717 ··· 1127 }) 1128 ]), z.object({ 1129 baz: z.union([ 1130 + z.int().check(z.gte(0), z.maximum(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' })), 1131 z.null() 1132 ]), 1133 + qux: z.int().check(z.gte(0), z.maximum(255, { error: 'Invalid value: Expected uint8 to be <= 255' })) 1134 })); 1135 1136 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1138 zNonAsciiStringæøåÆøÅöôêÊ字符串 1139 ]), z.object({ 1140 baz: z.union([ 1141 + z.int().check(z.gte(0), z.maximum(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' })), 1142 z.null() 1143 ]), 1144 + qux: z.int().check(z.gte(0), z.maximum(255, { error: 'Invalid value: Expected uint8 to be <= 255' })) 1145 })); 1146 1147 /**
+6 -6
packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/default/zod.gen.ts
··· 708 }); 709 710 export const zPageable = z.object({ 711 - page: z.number().int().min(-2147483648, { message: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { message: 'Invalid value: Expected int32 to be <= 2147483647' }).gte(0).optional().default(0), 712 - size: z.number().int().min(-2147483648, { message: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { message: 'Invalid value: Expected int32 to be <= 2147483647' }).gte(1).optional(), 713 sort: z.array(z.string()).optional() 714 }); 715 ··· 1125 }) 1126 ]), z.object({ 1127 baz: z.union([ 1128 - z.number().int().min(0, { message: 'Invalid value: Expected uint16 to be >= 0' }).max(65535, { message: 'Invalid value: Expected uint16 to be <= 65535' }).gte(0), 1129 z.null() 1130 ]), 1131 - qux: z.number().int().min(0, { message: 'Invalid value: Expected uint8 to be >= 0' }).max(255, { message: 'Invalid value: Expected uint8 to be <= 255' }).gte(0) 1132 })); 1133 1134 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1136 zNonAsciiStringæøåÆøÅöôêÊ字符串 1137 ]), z.object({ 1138 baz: z.union([ 1139 - z.number().int().min(0, { message: 'Invalid value: Expected uint16 to be >= 0' }).max(65535, { message: 'Invalid value: Expected uint16 to be <= 65535' }).gte(0), 1140 z.null() 1141 ]), 1142 - qux: z.number().int().min(0, { message: 'Invalid value: Expected uint8 to be >= 0' }).max(255, { message: 'Invalid value: Expected uint8 to be <= 255' }).gte(0) 1143 })); 1144 1145 /**
··· 708 }); 709 710 export const zPageable = z.object({ 711 + page: z.number().int().gte(0).max(2147483647, { message: 'Invalid value: Expected int32 to be <= 2147483647' }).optional().default(0), 712 + size: z.number().int().gte(1).max(2147483647, { message: 'Invalid value: Expected int32 to be <= 2147483647' }).optional(), 713 sort: z.array(z.string()).optional() 714 }); 715 ··· 1125 }) 1126 ]), z.object({ 1127 baz: z.union([ 1128 + z.number().int().gte(0).max(65535, { message: 'Invalid value: Expected uint16 to be <= 65535' }), 1129 z.null() 1130 ]), 1131 + qux: z.number().int().gte(0).max(255, { message: 'Invalid value: Expected uint8 to be <= 255' }) 1132 })); 1133 1134 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1136 zNonAsciiStringæøåÆøÅöôêÊ字符串 1137 ]), z.object({ 1138 baz: z.union([ 1139 + z.number().int().gte(0).max(65535, { message: 'Invalid value: Expected uint16 to be <= 65535' }), 1140 z.null() 1141 ]), 1142 + qux: z.number().int().gte(0).max(255, { message: 'Invalid value: Expected uint8 to be <= 255' }) 1143 })); 1144 1145 /**
+6 -6
packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/default/zod.gen.ts
··· 710 }); 711 712 export const zPageable = z.object({ 713 - page: z.optional(z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }).gte(0)).default(0), 714 - size: z.optional(z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }).gte(1)), 715 sort: z.optional(z.array(z.string())) 716 }); 717 ··· 1127 }) 1128 ]), z.object({ 1129 baz: z.union([ 1130 - z.int().min(0, { error: 'Invalid value: Expected uint16 to be >= 0' }).max(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }).gte(0), 1131 z.null() 1132 ]), 1133 - qux: z.int().min(0, { error: 'Invalid value: Expected uint8 to be >= 0' }).max(255, { error: 'Invalid value: Expected uint8 to be <= 255' }).gte(0) 1134 })); 1135 1136 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1138 zNonAsciiStringæøåÆøÅöôêÊ字符串 1139 ]), z.object({ 1140 baz: z.union([ 1141 - z.int().min(0, { error: 'Invalid value: Expected uint16 to be >= 0' }).max(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }).gte(0), 1142 z.null() 1143 ]), 1144 - qux: z.int().min(0, { error: 'Invalid value: Expected uint8 to be >= 0' }).max(255, { error: 'Invalid value: Expected uint8 to be <= 255' }).gte(0) 1145 })); 1146 1147 /**
··· 710 }); 711 712 export const zPageable = z.object({ 713 + page: z.optional(z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })).default(0), 714 + size: z.optional(z.int().gte(1).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })), 715 sort: z.optional(z.array(z.string())) 716 }); 717 ··· 1127 }) 1128 ]), z.object({ 1129 baz: z.union([ 1130 + z.int().gte(0).max(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }), 1131 z.null() 1132 ]), 1133 + qux: z.int().gte(0).max(255, { error: 'Invalid value: Expected uint8 to be <= 255' }) 1134 })); 1135 1136 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1138 zNonAsciiStringæøåÆøÅöôêÊ字符串 1139 ]), z.object({ 1140 baz: z.union([ 1141 + z.int().gte(0).max(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }), 1142 z.null() 1143 ]), 1144 + qux: z.int().gte(0).max(255, { error: 'Invalid value: Expected uint8 to be <= 255' }) 1145 })); 1146 1147 /**
+6 -6
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/default/zod.gen.ts
··· 707 }); 708 709 export const zPageable = z.object({ 710 - page: z._default(z.optional(z.int().check(z.minimum(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }), z.maximum(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }), z.gte(0))), 0), 711 - size: z.optional(z.int().check(z.minimum(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }), z.maximum(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }), z.gte(1))), 712 sort: z.optional(z.array(z.string())) 713 }); 714 ··· 1133 }) 1134 ]), z.object({ 1135 baz: z.union([ 1136 - z.int().check(z.minimum(0, { error: 'Invalid value: Expected uint16 to be >= 0' }), z.maximum(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }), z.gte(0)), 1137 z.null() 1138 ]), 1139 - qux: z.int().check(z.minimum(0, { error: 'Invalid value: Expected uint8 to be >= 0' }), z.maximum(255, { error: 'Invalid value: Expected uint8 to be <= 255' }), z.gte(0)) 1140 })); 1141 1142 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1144 zNonAsciiStringæøåÆøÅöôêÊ字符串 1145 ]), z.object({ 1146 baz: z.union([ 1147 - z.int().check(z.minimum(0, { error: 'Invalid value: Expected uint16 to be >= 0' }), z.maximum(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }), z.gte(0)), 1148 z.null() 1149 ]), 1150 - qux: z.int().check(z.minimum(0, { error: 'Invalid value: Expected uint8 to be >= 0' }), z.maximum(255, { error: 'Invalid value: Expected uint8 to be <= 255' }), z.gte(0)) 1151 })); 1152 1153 /**
··· 707 }); 708 709 export const zPageable = z.object({ 710 + page: z._default(z.optional(z.int().check(z.gte(0), z.maximum(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }))), 0), 711 + size: z.optional(z.int().check(z.gte(1), z.maximum(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }))), 712 sort: z.optional(z.array(z.string())) 713 }); 714 ··· 1133 }) 1134 ]), z.object({ 1135 baz: z.union([ 1136 + z.int().check(z.gte(0), z.maximum(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' })), 1137 z.null() 1138 ]), 1139 + qux: z.int().check(z.gte(0), z.maximum(255, { error: 'Invalid value: Expected uint8 to be <= 255' })) 1140 })); 1141 1142 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1144 zNonAsciiStringæøåÆøÅöôêÊ字符串 1145 ]), z.object({ 1146 baz: z.union([ 1147 + z.int().check(z.gte(0), z.maximum(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' })), 1148 z.null() 1149 ]), 1150 + qux: z.int().check(z.gte(0), z.maximum(255, { error: 'Invalid value: Expected uint8 to be <= 255' })) 1151 })); 1152 1153 /**
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-bigint-min-max/zod.gen.ts
··· 3 import * as z from 'zod/mini'; 4 5 export const zFoo = z.object({ 6 - foo: z.optional(z.coerce.bigint().check(z.minimum(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }), z.maximum(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }), z.gte(BigInt(0)), z.lte(BigInt(100)))) 7 });
··· 3 import * as z from 'zod/mini'; 4 5 export const zFoo = z.object({ 6 + foo: z.optional(z.coerce.bigint().check(z.gte(BigInt(0)), z.lte(BigInt(100)))) 7 });
+6 -6
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/default/zod.gen.ts
··· 705 }); 706 707 export const zPageable = z.object({ 708 - page: z.number().int().min(-2147483648, { message: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { message: 'Invalid value: Expected int32 to be <= 2147483647' }).gte(0).optional().default(0), 709 - size: z.number().int().min(-2147483648, { message: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { message: 'Invalid value: Expected int32 to be <= 2147483647' }).gte(1).optional(), 710 sort: z.array(z.string()).optional() 711 }); 712 ··· 1131 }) 1132 ]), z.object({ 1133 baz: z.union([ 1134 - z.number().int().min(0, { message: 'Invalid value: Expected uint16 to be >= 0' }).max(65535, { message: 'Invalid value: Expected uint16 to be <= 65535' }).gte(0), 1135 z.null() 1136 ]), 1137 - qux: z.number().int().min(0, { message: 'Invalid value: Expected uint8 to be >= 0' }).max(255, { message: 'Invalid value: Expected uint8 to be <= 255' }).gte(0) 1138 })); 1139 1140 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1142 zNonAsciiStringæøåÆøÅöôêÊ字符串 1143 ]), z.object({ 1144 baz: z.union([ 1145 - z.number().int().min(0, { message: 'Invalid value: Expected uint16 to be >= 0' }).max(65535, { message: 'Invalid value: Expected uint16 to be <= 65535' }).gte(0), 1146 z.null() 1147 ]), 1148 - qux: z.number().int().min(0, { message: 'Invalid value: Expected uint8 to be >= 0' }).max(255, { message: 'Invalid value: Expected uint8 to be <= 255' }).gte(0) 1149 })); 1150 1151 /**
··· 705 }); 706 707 export const zPageable = z.object({ 708 + page: z.number().int().gte(0).max(2147483647, { message: 'Invalid value: Expected int32 to be <= 2147483647' }).optional().default(0), 709 + size: z.number().int().gte(1).max(2147483647, { message: 'Invalid value: Expected int32 to be <= 2147483647' }).optional(), 710 sort: z.array(z.string()).optional() 711 }); 712 ··· 1131 }) 1132 ]), z.object({ 1133 baz: z.union([ 1134 + z.number().int().gte(0).max(65535, { message: 'Invalid value: Expected uint16 to be <= 65535' }), 1135 z.null() 1136 ]), 1137 + qux: z.number().int().gte(0).max(255, { message: 'Invalid value: Expected uint8 to be <= 255' }) 1138 })); 1139 1140 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1142 zNonAsciiStringæøåÆøÅöôêÊ字符串 1143 ]), z.object({ 1144 baz: z.union([ 1145 + z.number().int().gte(0).max(65535, { message: 'Invalid value: Expected uint16 to be <= 65535' }), 1146 z.null() 1147 ]), 1148 + qux: z.number().int().gte(0).max(255, { message: 'Invalid value: Expected uint8 to be <= 255' }) 1149 })); 1150 1151 /**
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-bigint-min-max/zod.gen.ts
··· 3 import { z } from 'zod/v3'; 4 5 export const zFoo = z.object({ 6 - foo: z.coerce.bigint().min(BigInt('-9223372036854775808'), { message: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).gte(BigInt(0)).lte(BigInt(100)).optional() 7 });
··· 3 import { z } from 'zod/v3'; 4 5 export const zFoo = z.object({ 6 + foo: z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100)).optional() 7 });
+6 -6
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/default/zod.gen.ts
··· 707 }); 708 709 export const zPageable = z.object({ 710 - page: z.optional(z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }).gte(0)).default(0), 711 - size: z.optional(z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }).gte(1)), 712 sort: z.optional(z.array(z.string())) 713 }); 714 ··· 1133 }) 1134 ]), z.object({ 1135 baz: z.union([ 1136 - z.int().min(0, { error: 'Invalid value: Expected uint16 to be >= 0' }).max(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }).gte(0), 1137 z.null() 1138 ]), 1139 - qux: z.int().min(0, { error: 'Invalid value: Expected uint8 to be >= 0' }).max(255, { error: 'Invalid value: Expected uint8 to be <= 255' }).gte(0) 1140 })); 1141 1142 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1144 zNonAsciiStringæøåÆøÅöôêÊ字符串 1145 ]), z.object({ 1146 baz: z.union([ 1147 - z.int().min(0, { error: 'Invalid value: Expected uint16 to be >= 0' }).max(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }).gte(0), 1148 z.null() 1149 ]), 1150 - qux: z.int().min(0, { error: 'Invalid value: Expected uint8 to be >= 0' }).max(255, { error: 'Invalid value: Expected uint8 to be <= 255' }).gte(0) 1151 })); 1152 1153 /**
··· 707 }); 708 709 export const zPageable = z.object({ 710 + page: z.optional(z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })).default(0), 711 + size: z.optional(z.int().gte(1).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })), 712 sort: z.optional(z.array(z.string())) 713 }); 714 ··· 1133 }) 1134 ]), z.object({ 1135 baz: z.union([ 1136 + z.int().gte(0).max(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }), 1137 z.null() 1138 ]), 1139 + qux: z.int().gte(0).max(255, { error: 'Invalid value: Expected uint8 to be <= 255' }) 1140 })); 1141 1142 export const zModelWithOneOfAndProperties = z.intersection(z.union([ ··· 1144 zNonAsciiStringæøåÆøÅöôêÊ字符串 1145 ]), z.object({ 1146 baz: z.union([ 1147 + z.int().gte(0).max(65535, { error: 'Invalid value: Expected uint16 to be <= 65535' }), 1148 z.null() 1149 ]), 1150 + qux: z.int().gte(0).max(255, { error: 'Invalid value: Expected uint8 to be <= 255' }) 1151 })); 1152 1153 /**
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-bigint-min-max/zod.gen.ts
··· 3 import { z } from 'zod'; 4 5 export const zFoo = z.object({ 6 - foo: z.optional(z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).gte(BigInt(0)).lte(BigInt(100))) 7 });
··· 3 import { z } from 'zod'; 4 5 export const zFoo = z.object({ 6 + foo: z.optional(z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100))) 7 });
+12 -6
packages/openapi-ts/src/plugins/valibot/types.d.ts
··· 334 */ 335 pipes: Array<ReturnType<typeof $.call>>; 336 plugin: ValibotPlugin['Instance']; 337 }; 338 339 export type FormatResolverArgs = SharedResolverArgs & { ··· 346 schema: IR.SchemaObject; 347 shape: ReturnType<typeof $.object>; 348 }; 349 350 export type ValidatorResolverArgs = SharedResolverArgs & { 351 operation: IR.Operation; 352 schema: Symbol; 353 - v: Symbol; 354 }; 355 356 type ValidatorResolver = ( ··· 366 */ 367 number?: { 368 /** 369 * Resolvers for number formats (e.g., `float`, `double`, `int32`). 370 * 371 * Each key represents a specific format name with a custom ··· 378 */ 379 formats?: Record< 380 string, 381 - (args: FormatResolverArgs) => boolean | number | undefined 382 >; 383 }; 384 /** ··· 401 * 402 * Returning `undefined` will execute the default resolver logic. 403 */ 404 - base?: ( 405 - args: ObjectBaseResolverArgs, 406 - ) => ReturnType<typeof $.call> | undefined; 407 }; 408 /** 409 * Resolvers for string schemas. ··· 425 */ 426 formats?: Record< 427 string, 428 - (args: FormatResolverArgs) => boolean | number | undefined 429 >; 430 }; 431 /**
··· 334 */ 335 pipes: Array<ReturnType<typeof $.call>>; 336 plugin: ValibotPlugin['Instance']; 337 + v: Symbol; 338 }; 339 340 export type FormatResolverArgs = SharedResolverArgs & { ··· 347 schema: IR.SchemaObject; 348 shape: ReturnType<typeof $.object>; 349 }; 350 + 351 + type ResolverResult = boolean | number; 352 353 export type ValidatorResolverArgs = SharedResolverArgs & { 354 operation: IR.Operation; 355 schema: Symbol; 356 }; 357 358 type ValidatorResolver = ( ··· 368 */ 369 number?: { 370 /** 371 + * Controls the base segment for number schemas. 372 + * 373 + * Returning `undefined` will execute the default resolver logic. 374 + */ 375 + base?: (args: FormatResolverArgs) => ResolverResult | undefined; 376 + /** 377 * Resolvers for number formats (e.g., `float`, `double`, `int32`). 378 * 379 * Each key represents a specific format name with a custom ··· 386 */ 387 formats?: Record< 388 string, 389 + (args: FormatResolverArgs) => ResolverResult | undefined 390 >; 391 }; 392 /** ··· 409 * 410 * Returning `undefined` will execute the default resolver logic. 411 */ 412 + base?: (args: ObjectBaseResolverArgs) => ResolverResult | undefined; 413 }; 414 /** 415 * Resolvers for string schemas. ··· 431 */ 432 formats?: Record< 433 string, 434 + (args: FormatResolverArgs) => ResolverResult | undefined 435 >; 436 }; 437 /**
+31 -18
packages/openapi-ts/src/plugins/valibot/v1/toAst/number.ts
··· 8 9 import { pipesToAst } from '../../shared/pipesToAst'; 10 import type { IrSchemaToAstOptions } from '../../shared/types'; 11 import { identifiers } from '../constants'; 12 13 - export const numberToAst = ({ 14 - plugin, 15 schema, 16 - }: IrSchemaToAstOptions & { 17 - schema: SchemaWithType<'integer' | 'number'>; 18 - }) => { 19 - const v = plugin.referenceSymbol({ 20 - category: 'external', 21 - resource: 'valibot.v', 22 - }); 23 - 24 - if (schema.const !== undefined) { 25 - return $(v) 26 - .attr(identifiers.schemas.literal) 27 - .call(maybeBigInt(schema.const, schema.format)); 28 - } 29 - 30 - const pipes: Array<ReturnType<typeof $.call>> = []; 31 - 32 if (shouldCoerceToBigInt(schema.format)) { 33 pipes.push( 34 $(v) ··· 50 pipes.push($(v).attr(identifiers.actions.integer).call()); 51 } 52 } 53 54 let hasLowerBound = false; 55 let hasUpperBound = false;
··· 8 9 import { pipesToAst } from '../../shared/pipesToAst'; 10 import type { IrSchemaToAstOptions } from '../../shared/types'; 11 + import type { FormatResolverArgs } from '../../types'; 12 import { identifiers } from '../constants'; 13 14 + const defaultBaseResolver = ({ 15 + pipes, 16 schema, 17 + v, 18 + }: FormatResolverArgs): boolean | number => { 19 if (shouldCoerceToBigInt(schema.format)) { 20 pipes.push( 21 $(v) ··· 37 pipes.push($(v).attr(identifiers.actions.integer).call()); 38 } 39 } 40 + 41 + return true; 42 + }; 43 + 44 + export const numberToAst = ({ 45 + plugin, 46 + schema, 47 + }: IrSchemaToAstOptions & { 48 + schema: SchemaWithType<'integer' | 'number'>; 49 + }) => { 50 + const v = plugin.referenceSymbol({ 51 + category: 'external', 52 + resource: 'valibot.v', 53 + }); 54 + 55 + if (schema.const !== undefined) { 56 + return $(v) 57 + .attr(identifiers.schemas.literal) 58 + .call(maybeBigInt(schema.const, schema.format)); 59 + } 60 + 61 + const pipes: Array<ReturnType<typeof $.call>> = []; 62 + 63 + const args: FormatResolverArgs = { $, pipes, plugin, schema, v }; 64 + const resolver = plugin.config['~resolvers']?.number?.base; 65 + if (!resolver?.(args)) defaultBaseResolver(args); 66 67 let hasLowerBound = false; 68 let hasUpperBound = false;
+9 -8
packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts
··· 9 import { identifiers } from '../constants'; 10 import { irSchemaToAst } from '../plugin'; 11 12 - function defaultObjectBaseResolver({ 13 additional, 14 pipes, 15 - plugin, 16 shape, 17 }: ObjectBaseResolverArgs): number { 18 - const v = plugin.referenceSymbol({ 19 - category: 'external', 20 - resource: 'valibot.v', 21 - }); 22 - 23 // Handle `additionalProperties: { type: 'never' }` → v.strictObject() 24 if (additional === null) { 25 return pipes.push($(v).attr(identifiers.schemas.strictObject).call(shape)); ··· 52 }: IrSchemaToAstOptions & { 53 schema: SchemaWithType<'object'>; 54 }): Omit<Ast, 'typeName'> => { 55 const result: Partial<Omit<Ast, 'typeName'>> = {}; 56 const pipes: Array<ReturnType<typeof $.call>> = []; 57 ··· 103 plugin, 104 schema, 105 shape, 106 }; 107 const resolver = plugin.config['~resolvers']?.object?.base; 108 - if (!resolver?.(args)) defaultObjectBaseResolver(args); 109 110 result.pipes = [pipesToAst(pipes, plugin)]; 111 return result as Omit<Ast, 'typeName'>;
··· 9 import { identifiers } from '../constants'; 10 import { irSchemaToAst } from '../plugin'; 11 12 + function defaultBaseResolver({ 13 additional, 14 pipes, 15 shape, 16 + v, 17 }: ObjectBaseResolverArgs): number { 18 // Handle `additionalProperties: { type: 'never' }` → v.strictObject() 19 if (additional === null) { 20 return pipes.push($(v).attr(identifiers.schemas.strictObject).call(shape)); ··· 47 }: IrSchemaToAstOptions & { 48 schema: SchemaWithType<'object'>; 49 }): Omit<Ast, 'typeName'> => { 50 + const v = plugin.referenceSymbol({ 51 + category: 'external', 52 + resource: 'valibot.v', 53 + }); 54 + 55 const result: Partial<Omit<Ast, 'typeName'>> = {}; 56 const pipes: Array<ReturnType<typeof $.call>> = []; 57 ··· 103 plugin, 104 schema, 105 shape, 106 + v, 107 }; 108 const resolver = plugin.config['~resolvers']?.object?.base; 109 + if (!resolver?.(args)) defaultBaseResolver(args); 110 111 result.pipes = [pipesToAst(pipes, plugin)]; 112 return result as Omit<Ast, 'typeName'>;
+2 -7
packages/openapi-ts/src/plugins/valibot/v1/toAst/string.ts
··· 8 9 const defaultFormatResolver = ({ 10 pipes, 11 - plugin, 12 schema, 13 }: FormatResolverArgs): boolean | number => { 14 - const v = plugin.referenceSymbol({ 15 - category: 'external', 16 - resource: 'valibot.v', 17 - }); 18 - 19 switch (schema.format) { 20 case 'date': 21 return pipes.push($(v).attr(identifiers.actions.isoDate).call()); ··· 55 const pipes = [$(v).attr(identifiers.schemas.string).call()]; 56 57 if (schema.format) { 58 - const args: FormatResolverArgs = { $, pipes, plugin, schema }; 59 const resolver = 60 plugin.config['~resolvers']?.string?.formats?.[schema.format]; 61 if (!resolver?.(args)) defaultFormatResolver(args);
··· 8 9 const defaultFormatResolver = ({ 10 pipes, 11 schema, 12 + v, 13 }: FormatResolverArgs): boolean | number => { 14 switch (schema.format) { 15 case 'date': 16 return pipes.push($(v).attr(identifiers.actions.isoDate).call()); ··· 50 const pipes = [$(v).attr(identifiers.schemas.string).call()]; 51 52 if (schema.format) { 53 + const args: FormatResolverArgs = { $, pipes, plugin, schema, v }; 54 const resolver = 55 plugin.config['~resolvers']?.string?.formats?.[schema.format]; 56 if (!resolver?.(args)) defaultFormatResolver(args);
+10
packages/openapi-ts/src/plugins/zod/mini/api.ts
··· 22 }); 23 if (!symbol) return; 24 25 const args: ValidatorResolverArgs = { 26 $, 27 chain: undefined, 28 operation, 29 plugin, 30 schema: symbol, 31 }; 32 const validator = plugin.config['~resolvers']?.validator; 33 const resolver = ··· 59 }); 60 if (!symbol) return; 61 62 const args: ValidatorResolverArgs = { 63 $, 64 chain: undefined, 65 operation, 66 plugin, 67 schema: symbol, 68 }; 69 const validator = plugin.config['~resolvers']?.validator; 70 const resolver =
··· 22 }); 23 if (!symbol) return; 24 25 + const z = plugin.referenceSymbol({ 26 + category: 'external', 27 + resource: 'zod.z', 28 + }); 29 const args: ValidatorResolverArgs = { 30 $, 31 chain: undefined, 32 operation, 33 plugin, 34 schema: symbol, 35 + z, 36 }; 37 const validator = plugin.config['~resolvers']?.validator; 38 const resolver = ··· 64 }); 65 if (!symbol) return; 66 67 + const z = plugin.referenceSymbol({ 68 + category: 'external', 69 + resource: 'zod.z', 70 + }); 71 const args: ValidatorResolverArgs = { 72 $, 73 chain: undefined, 74 operation, 75 plugin, 76 schema: symbol, 77 + z, 78 }; 79 const validator = plugin.config['~resolvers']?.validator; 80 const resolver =
+9 -8
packages/openapi-ts/src/plugins/zod/mini/toAst/object.ts
··· 8 import type { ObjectBaseResolverArgs } from '../../types'; 9 import { irSchemaToAst } from '../plugin'; 10 11 - function defaultObjectBaseResolver({ 12 additional, 13 - plugin, 14 shape, 15 }: ObjectBaseResolverArgs): ReturnType<typeof $.call> { 16 - const z = plugin.referenceSymbol({ 17 - category: 'external', 18 - resource: 'zod.z', 19 - }); 20 - 21 if (additional) { 22 return $(z) 23 .attr(identifiers.record) ··· 34 }: IrSchemaToAstOptions & { 35 schema: SchemaWithType<'object'>; 36 }): Omit<Ast, 'typeName'> => { 37 const result: Partial<Omit<Ast, 'typeName'>> = {}; 38 39 // TODO: parser - handle constants ··· 89 plugin, 90 schema, 91 shape, 92 }; 93 const resolver = plugin.config['~resolvers']?.object?.base; 94 - const chain = resolver?.(args) ?? defaultObjectBaseResolver(args); 95 result.expression = chain; 96 97 return result as Omit<Ast, 'typeName'>;
··· 8 import type { ObjectBaseResolverArgs } from '../../types'; 9 import { irSchemaToAst } from '../plugin'; 10 11 + function defaultBaseResolver({ 12 additional, 13 shape, 14 + z, 15 }: ObjectBaseResolverArgs): ReturnType<typeof $.call> { 16 if (additional) { 17 return $(z) 18 .attr(identifiers.record) ··· 29 }: IrSchemaToAstOptions & { 30 schema: SchemaWithType<'object'>; 31 }): Omit<Ast, 'typeName'> => { 32 + const z = plugin.referenceSymbol({ 33 + category: 'external', 34 + resource: 'zod.z', 35 + }); 36 + 37 const result: Partial<Omit<Ast, 'typeName'>> = {}; 38 39 // TODO: parser - handle constants ··· 89 plugin, 90 schema, 91 shape, 92 + z, 93 }; 94 const resolver = plugin.config['~resolvers']?.object?.base; 95 + const chain = resolver?.(args) ?? defaultBaseResolver(args); 96 result.expression = chain; 97 98 return result as Omit<Ast, 'typeName'>;
+1 -1
packages/openapi-ts/src/plugins/zod/mini/toAst/string.ts
··· 71 chain = $(z).attr(identifiers.string).call(); 72 73 if (schema.format) { 74 - const args: FormatResolverArgs = { $, chain, plugin, schema }; 75 const resolver = 76 plugin.config['~resolvers']?.string?.formats?.[schema.format]; 77 chain = resolver?.(args) ?? defaultFormatResolver(args);
··· 71 chain = $(z).attr(identifiers.string).call(); 72 73 if (schema.format) { 74 + const args: FormatResolverArgs = { $, chain, plugin, schema, z }; 75 const resolver = 76 plugin.config['~resolvers']?.string?.formats?.[schema.format]; 77 chain = resolver?.(args) ?? defaultFormatResolver(args);
+10 -1
packages/openapi-ts/src/plugins/zod/types.d.ts
··· 759 */ 760 chain?: ReturnType<typeof $.call>; 761 plugin: ZodPlugin['Instance']; 762 }; 763 764 export type FormatResolverArgs = Required<SharedResolverArgs> & { ··· 771 schema: IR.SchemaObject; 772 shape: ReturnType<typeof $.object>; 773 }; 774 775 export type ValidatorResolverArgs = SharedResolverArgs & { 776 operation: IR.Operation; ··· 790 */ 791 number?: { 792 /** 793 * Resolvers for number formats (e.g., `float`, `double`, `int32`). 794 * 795 * Each key represents a specific format name with a custom ··· 802 */ 803 formats?: Record< 804 string, 805 - (args: FormatResolverArgs) => boolean | number | undefined 806 >; 807 }; 808 /**
··· 759 */ 760 chain?: ReturnType<typeof $.call>; 761 plugin: ZodPlugin['Instance']; 762 + z: Symbol; 763 }; 764 765 export type FormatResolverArgs = Required<SharedResolverArgs> & { ··· 772 schema: IR.SchemaObject; 773 shape: ReturnType<typeof $.object>; 774 }; 775 + 776 + type ResolverResult = boolean | number; 777 778 export type ValidatorResolverArgs = SharedResolverArgs & { 779 operation: IR.Operation; ··· 793 */ 794 number?: { 795 /** 796 + * Controls the base segment for number schemas. 797 + * 798 + * Returning `undefined` will execute the default resolver logic. 799 + */ 800 + base?: (args: FormatResolverArgs) => ResolverResult | undefined; 801 + /** 802 * Resolvers for number formats (e.g., `float`, `double`, `int32`). 803 * 804 * Each key represents a specific format name with a custom ··· 811 */ 812 formats?: Record< 813 string, 814 + (args: FormatResolverArgs) => ResolverResult | undefined 815 >; 816 }; 817 /**
+10
packages/openapi-ts/src/plugins/zod/v3/api.ts
··· 22 }); 23 if (!symbol) return; 24 25 const args: ValidatorResolverArgs = { 26 $, 27 chain: undefined, 28 operation, 29 plugin, 30 schema: symbol, 31 }; 32 const validator = plugin.config['~resolvers']?.validator; 33 const resolver = ··· 59 }); 60 if (!symbol) return; 61 62 const args: ValidatorResolverArgs = { 63 $, 64 chain: undefined, 65 operation, 66 plugin, 67 schema: symbol, 68 }; 69 const validator = plugin.config['~resolvers']?.validator; 70 const resolver =
··· 22 }); 23 if (!symbol) return; 24 25 + const z = plugin.referenceSymbol({ 26 + category: 'external', 27 + resource: 'zod.z', 28 + }); 29 const args: ValidatorResolverArgs = { 30 $, 31 chain: undefined, 32 operation, 33 plugin, 34 schema: symbol, 35 + z, 36 }; 37 const validator = plugin.config['~resolvers']?.validator; 38 const resolver = ··· 64 }); 65 if (!symbol) return; 66 67 + const z = plugin.referenceSymbol({ 68 + category: 'external', 69 + resource: 'zod.z', 70 + }); 71 const args: ValidatorResolverArgs = { 72 $, 73 chain: undefined, 74 operation, 75 plugin, 76 schema: symbol, 77 + z, 78 }; 79 const validator = plugin.config['~resolvers']?.validator; 80 const resolver =
+9 -8
packages/openapi-ts/src/plugins/zod/v3/toAst/object.ts
··· 8 import type { ObjectBaseResolverArgs } from '../../types'; 9 import { irSchemaToAst } from '../plugin'; 10 11 - function defaultObjectBaseResolver({ 12 additional, 13 - plugin, 14 shape, 15 }: ObjectBaseResolverArgs): ReturnType<typeof $.call> { 16 - const z = plugin.referenceSymbol({ 17 - category: 'external', 18 - resource: 'zod.z', 19 - }); 20 - 21 if (additional) { 22 return $(z).attr(identifiers.record).call(additional); 23 } ··· 34 }): Omit<Ast, 'typeName'> & { 35 anyType?: string; 36 } => { 37 let hasLazyExpression = false; 38 39 // TODO: parser - handle constants ··· 85 plugin, 86 schema, 87 shape, 88 }; 89 const resolver = plugin.config['~resolvers']?.object?.base; 90 - const chain = resolver?.(args) ?? defaultObjectBaseResolver(args); 91 result.expression = chain; 92 93 return {
··· 8 import type { ObjectBaseResolverArgs } from '../../types'; 9 import { irSchemaToAst } from '../plugin'; 10 11 + function defaultBaseResolver({ 12 additional, 13 shape, 14 + z, 15 }: ObjectBaseResolverArgs): ReturnType<typeof $.call> { 16 if (additional) { 17 return $(z).attr(identifiers.record).call(additional); 18 } ··· 29 }): Omit<Ast, 'typeName'> & { 30 anyType?: string; 31 } => { 32 + const z = plugin.referenceSymbol({ 33 + category: 'external', 34 + resource: 'zod.z', 35 + }); 36 + 37 let hasLazyExpression = false; 38 39 // TODO: parser - handle constants ··· 85 plugin, 86 schema, 87 shape, 88 + z, 89 }; 90 const resolver = plugin.config['~resolvers']?.object?.base; 91 + const chain = resolver?.(args) ?? defaultBaseResolver(args); 92 result.expression = chain; 93 94 return {
+1 -1
packages/openapi-ts/src/plugins/zod/v3/toAst/string.ts
··· 62 chain = $(z).attr(identifiers.string).call(); 63 64 if (schema.format) { 65 - const args: FormatResolverArgs = { $, chain, plugin, schema }; 66 const resolver = 67 plugin.config['~resolvers']?.string?.formats?.[schema.format]; 68 chain = resolver?.(args) ?? defaultFormatResolver(args);
··· 62 chain = $(z).attr(identifiers.string).call(); 63 64 if (schema.format) { 65 + const args: FormatResolverArgs = { $, chain, plugin, schema, z }; 66 const resolver = 67 plugin.config['~resolvers']?.string?.formats?.[schema.format]; 68 chain = resolver?.(args) ?? defaultFormatResolver(args);
+10
packages/openapi-ts/src/plugins/zod/v4/api.ts
··· 22 }); 23 if (!symbol) return; 24 25 const args: ValidatorResolverArgs = { 26 $, 27 chain: undefined, 28 operation, 29 plugin, 30 schema: symbol, 31 }; 32 const validator = plugin.config['~resolvers']?.validator; 33 const resolver = ··· 59 }); 60 if (!symbol) return; 61 62 const args: ValidatorResolverArgs = { 63 $, 64 chain: undefined, 65 operation, 66 plugin, 67 schema: symbol, 68 }; 69 const validator = plugin.config['~resolvers']?.validator; 70 const resolver =
··· 22 }); 23 if (!symbol) return; 24 25 + const z = plugin.referenceSymbol({ 26 + category: 'external', 27 + resource: 'zod.z', 28 + }); 29 const args: ValidatorResolverArgs = { 30 $, 31 chain: undefined, 32 operation, 33 plugin, 34 schema: symbol, 35 + z, 36 }; 37 const validator = plugin.config['~resolvers']?.validator; 38 const resolver = ··· 64 }); 65 if (!symbol) return; 66 67 + const z = plugin.referenceSymbol({ 68 + category: 'external', 69 + resource: 'zod.z', 70 + }); 71 const args: ValidatorResolverArgs = { 72 $, 73 chain: undefined, 74 operation, 75 plugin, 76 schema: symbol, 77 + z, 78 }; 79 const validator = plugin.config['~resolvers']?.validator; 80 const resolver =
+9 -8
packages/openapi-ts/src/plugins/zod/v4/toAst/object.ts
··· 8 import type { ObjectBaseResolverArgs } from '../../types'; 9 import { irSchemaToAst } from '../plugin'; 10 11 - function defaultObjectBaseResolver({ 12 additional, 13 - plugin, 14 shape, 15 }: ObjectBaseResolverArgs): ReturnType<typeof $.call> { 16 - const z = plugin.referenceSymbol({ 17 - category: 'external', 18 - resource: 'zod.z', 19 - }); 20 - 21 if (additional) { 22 return $(z) 23 .attr(identifiers.record) ··· 34 }: IrSchemaToAstOptions & { 35 schema: SchemaWithType<'object'>; 36 }): Omit<Ast, 'typeName'> => { 37 const result: Partial<Omit<Ast, 'typeName'>> = {}; 38 39 // TODO: parser - handle constants ··· 89 plugin, 90 schema, 91 shape, 92 }; 93 const resolver = plugin.config['~resolvers']?.object?.base; 94 - const chain = resolver?.(args) ?? defaultObjectBaseResolver(args); 95 result.expression = chain; 96 97 // Return with typeName for circular references
··· 8 import type { ObjectBaseResolverArgs } from '../../types'; 9 import { irSchemaToAst } from '../plugin'; 10 11 + function defaultBaseResolver({ 12 additional, 13 shape, 14 + z, 15 }: ObjectBaseResolverArgs): ReturnType<typeof $.call> { 16 if (additional) { 17 return $(z) 18 .attr(identifiers.record) ··· 29 }: IrSchemaToAstOptions & { 30 schema: SchemaWithType<'object'>; 31 }): Omit<Ast, 'typeName'> => { 32 + const z = plugin.referenceSymbol({ 33 + category: 'external', 34 + resource: 'zod.z', 35 + }); 36 + 37 const result: Partial<Omit<Ast, 'typeName'>> = {}; 38 39 // TODO: parser - handle constants ··· 89 plugin, 90 schema, 91 shape, 92 + z, 93 }; 94 const resolver = plugin.config['~resolvers']?.object?.base; 95 + const chain = resolver?.(args) ?? defaultBaseResolver(args); 96 result.expression = chain; 97 98 // Return with typeName for circular references
+2 -6
packages/openapi-ts/src/plugins/zod/v4/toAst/string.ts
··· 9 chain, 10 plugin, 11 schema, 12 }: FormatResolverArgs): ReturnType<typeof $.call> => { 13 - const z = plugin.referenceSymbol({ 14 - category: 'external', 15 - resource: 'zod.z', 16 - }); 17 - 18 switch (schema.format) { 19 case 'date': 20 return $(z).attr(identifiers.iso).attr(identifiers.date).call(); ··· 71 chain = $(z).attr(identifiers.string).call(); 72 73 if (schema.format) { 74 - const args: FormatResolverArgs = { $, chain, plugin, schema }; 75 const resolver = 76 plugin.config['~resolvers']?.string?.formats?.[schema.format]; 77 chain = resolver?.(args) ?? defaultFormatResolver(args);
··· 9 chain, 10 plugin, 11 schema, 12 + z, 13 }: FormatResolverArgs): ReturnType<typeof $.call> => { 14 switch (schema.format) { 15 case 'date': 16 return $(z).attr(identifiers.iso).attr(identifiers.date).call(); ··· 67 chain = $(z).attr(identifiers.string).call(); 68 69 if (schema.format) { 70 + const args: FormatResolverArgs = { $, chain, plugin, schema, z }; 71 const resolver = 72 plugin.config['~resolvers']?.string?.formats?.[schema.format]; 73 chain = resolver?.(args) ?? defaultFormatResolver(args);