Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isValidDecimalInput error message path #100

Closed
michiim opened this issue Mar 9, 2023 · 2 comments
Closed

isValidDecimalInput error message path #100

michiim opened this issue Mar 9, 2023 · 2 comments

Comments

@michiim
Copy link

michiim commented Mar 9, 2023

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'],
}),
});

@chrishoermann
Copy link
Owner

@michiim true. I'll change it and add this hint to the model in the message string.

@chrishoermann
Copy link
Owner

@michiim I changed this behaviour in the latest release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants