Gathering detailed insights and metrics for @felte/validator-zod
Gathering detailed insights and metrics for @felte/validator-zod
Gathering detailed insights and metrics for @felte/validator-zod
Gathering detailed insights and metrics for @felte/validator-zod
An extensible form library for Svelte, Solid and React
npm install @felte/validator-zod
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (86.37%)
Astro (5.41%)
JavaScript (4.78%)
Svelte (1.75%)
CSS (1.7%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1,058 Stars
838 Commits
41 Forks
6 Watchers
23 Branches
29 Contributors
Updated on Jul 13, 2025
Latest Version
1.0.18
Package Id
@felte/validator-zod@1.0.18
Unpacked Size
13.90 kB
Size
4.00 kB
File Count
9
NPM Version
10.9.0
Node Version
22.10.0
Published on
Oct 29, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A package to help you handle validation with Zod in Felte.
1npm install --save @felte/validator-zod zod 2 3# Or, if you use yarn 4 5yarn add @felte/validator-zod zod
Call validator
with an object containing your Zod schema in the schema
property. The result of the call can be passed as an extender to Felte:
1import { validator } from '@felte/validator-zod'; 2import { z } from 'zod'; 3 4const schema = z.object({ 5 email: z.string().email().nonempty(), 6 password: z.string().nonempty(), 7}); 8 9const { form } = createForm({ 10 // ... 11 extend: validator({ schema }), // or `extend: [validator({ schema })],` 12 // ... 13});
OR use the validateSchema
function directly in the validate
option of createForm
. (No need to extend Felte).
1import { validateSchema } from '@felte/validator-zod'; 2import { z } from 'zod'; 3 4const schema = z.object({ 5 email: z.string().email().nonempty(), 6 password: z.string().nonempty(), 7}); 8 9const { form } = createForm({ 10 // ... 11 validate: validateSchema(schema), 12 // ... 13});
Optionally, you can tell this package to assign the results of your validations to your warnings
store by setting the level
property of the validator function to warning
. It's error
by default:
1import { validator } from '@felte/validator-zod'; 2import { z } from 'zod'; 3 4const schema = z.object({ 5 email: z.string().email().nonempty(), 6 password: z.string().nonempty(), 7}); 8 9// We only warn if the user has started typing a value 10const warnSchema = zod.object({ 11 password: zod 12 .string() 13 .refine((value) => (value ? value.length > 8 : true), { 14 message: 'Password is not secure', 15 }), 16}); 17 18const { form } = createForm({ 19 // ... 20 extend: [ 21 validator({ schema }), 22 validator({ schema: warnSchema, level: 'warning' }), 23 ], 24 // ... 25});
Zod allows you to infer the type of your schema using z.infer
. This can be used so you don't need to create a type for your form's data:
1import { z } from 'zod'; 2 3const schema = z.object({ 4 email: z.string().email().nonempty(), 5 password: z.string().nonempty(), 6}); 7 8const { form } = createForm<z.infer<typeof schema>>(/* ... */);
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 6/30 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
37 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More