export const example = z.union([
z.string().min(10),
z.string().min(5)],
);
will generate schema like this in zod@4.1.13
"exampleField": {
"anyOf":[
{"type":"string","minLength":10},
{"type":"string","minLength":5}
]
}
but in zod v3 it generates:
"exampleField": {
"oneOf":[
{"type":"string","minLength":10},
{"type":"string","minLength":5}
]
}
I think it should use oneOf instead of anyOf
will generate schema like this in
zod@4.1.13but in zod v3 it generates:
I think it should use
oneOfinstead ofanyOf