Skip to content
This repository has been archived by the owner on Feb 20, 2022. It is now read-only.

Use zod's superRefine methods to validate rules, communities, users etc. with "helper" validation methods #227

Open
oof2win2 opened this issue Dec 21, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@oof2win2
Copy link
Member

Something such as:

async function validateRule(val, ctx) {
 // check rule, use ctx.addIssue if the rule is invalid
}

const schema = z.object({
  ruleId: z.string().superRefine(validateRule),
})
@oof2win2 oof2win2 added the enhancement New feature or request label Dec 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
No open projects
Status: Todo
Development

No branches or pull requests

1 participant