Automatically apply HTML validation attributes based on zod schema
See original GitHub issueIs it possible to have the conform.input
utility auto-apply HTML validation attributes based on the schema?
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Schema validation in TypeScript with Zod - LogRocket Blog
In this article, you will learn about schema design and validation in Zod and how to run it in a TypeScript codebase at...
Read more >colinhacks/zod: TypeScript-first schema validation ... - GitHub
z.enum is a Zod-native way to declare a schema with a fixed set of allowable string values. Pass the array of values directly...
Read more >Form Validation with TypeScript and Zod
This article will focus on form validation in React, but the same concepts can be applied to other frameworks (or lack thereof), and...
Read more >Validate related schema attributes with Zod
Zod is a TypeScript-first schema declaration and validation library. I'm using the term "schema" to broadly refer to any data type, from a ......
Read more >Data validation with automatic typing using zod - CodeX Team
1. Validate without description a mountain of different if, instanceof, typeof and other things. · 2. Have TypeScript types to represent the data...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That makes sense. I will take a deeper look into the reach implementation. I think there are some limitations on these userland solutions. I might also make it a opt-in feature instead.
This is the same story with yup as well. Since each of them has its own validation logic, e.g.
ab@cd
is considered a valid email in the browser but very likely not on yup or zod. I agree it would be really powerful if there is a solution that can lead the user to utilise these native browser constraint and understand when they are opting to custom validation. (e.g. In favor type and pattern to validate email instead of custom validate function).I have started working on a draft APIs for it last 2 days. I will share more details once I have a concrete proposal. 😃
Reach UI has an Auto ID module you could copy. I’d rather the IDs not be automatically added though, because you might be using something like React Aria that handles IDs itself.