We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm getting a weird error when using coerce with an async refine.
I have this validation schema:
const schema = { id: z.coerce .number() .int() .pipe( z.number().refine(async (id) => this.exists(id), { message: "Not found", }) ) }
The doc generation:
registry.registerPath({ method: "get", path: "...", summary: "...", description: "...", request: { query: schema, }, responses: { 200: { description: "...", content: { "application/json": { schema: z.object({}), }, }, }, }, });
It doesn't generate the docs. It is throwing the following error:
Error: Async refinement encountered during synchronous parse operation. Use .parseAsync instead.
If I remove the .coerce or the .refine, it generates the docs.
.coerce
.refine
{ id: z .number() .int() .pipe( z.number().refine(async (id) => this.exists(id), { message: "Not found", }) ) }
or
{ id: z.coerce .number() .int() .pipe( z.number() ) }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm getting a weird error when using coerce with an async refine.
I have this validation schema:
The doc generation:
It doesn't generate the docs. It is throwing the following error:
If I remove the
.coerce
or the.refine
, it generates the docs.or
The text was updated successfully, but these errors were encountered: