why do you define "path" for errors of isValidDecimalInput. I think it doesn't make sense because it affects the default behaviour. As a result, the error messages for these properties are not accessible in the same way as the messages for the other properties
export const MyModelSchema = z.object({
id: z.number(),
decimal: z
.union([z.number(), z.string(), DecimalJSLikeSchema])
.refine((v) => isValidDecimalInput(v), {
message: 'Field "decimal" must be a Decimal',
path: ['Models', 'DecimalModel'],
}),
});
why do you define "path" for errors of isValidDecimalInput. I think it doesn't make sense because it affects the default behaviour. As a result, the error messages for these properties are not accessible in the same way as the messages for the other properties
export const MyModelSchema = z.object({ id: z.number(), decimal: z .union([z.number(), z.string(), DecimalJSLikeSchema]) .refine((v) => isValidDecimalInput(v), { message: 'Field "decimal" must be a Decimal', path: ['Models', 'DecimalModel'], }), });