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