📋 Validation resolvers: Yup, Zod, AJV, Joi, Superstruct, Vest, class-validator, io-ts, typanion, Ajv, TypeBox, Valibot and nope.
MIT License
Bot releases are hidden (Show)
Published by bluebill1049 almost 4 years ago
esm support to fix bundler incompatibility (#95)
Published by bluebill1049 almost 4 years ago
Support Yup ^0.32.0 (#92)
Published by bluebill1049 almost 4 years ago
vestResolver (#82)
import * as React from 'react';
import { useForm } from 'react-hook-form';
import { vestResolver } from '@hookform/resolvers/vest';
import vest, { test, enforce } from 'vest';
const validationSuite = vest.create((data = {}) => {
test('username', 'Username is required', () => {
enforce(data.username).isNotEmpty();
});
test('username', 'Must be longer than 3 chars', () => {
enforce(data.username).longerThan(3);
});
test('password', 'Password is required', () => {
enforce(data.password).isNotEmpty();
});
test('password', 'Password must be at least 5 chars', () => {
enforce(data.password).longerThanOrEquals(5);
});
test('password', 'Password must contain a digit', () => {
enforce(data.password).matches(/[0-9]/);
});
test('password', 'Password must contain a symbol', () => {
enforce(data.password).matches(/[^A-Za-z0-9]/);
});
});
const App = () => {
const { register, handleSubmit, errors } = useForm({
resolver: vestResolver(validationSuite),
});
return (
<form onSubmit={handleSubmit((data) => console.log(data))}>
<input type="text" name="username" ref={register} />
<input type="text" name="password" ref={register} />
<input type="submit" />
</form>
);
};
Published by bluebill1049 almost 4 years ago
fix: superstruct filename typo (#89)
Published by bluebill1049 almost 4 years ago
fix: IE11 build (#85)
Published by bluebill1049 almost 4 years ago
Update Superstruct version (#83)
Published by bluebill1049 almost 4 years ago
Published by bluebill1049 about 4 years ago
🎉 Resolver version 1.0.0 is LIVE.
Published by bluebill1049 about 4 years ago
🎉 Zod resolver
import React from 'react';
import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import * as z from 'zod';
const schema = z.object({
username: z.string(),
});
const App = () => {
const { register, handleSubmit } = useForm({
resolver: zodResolver(schema),
});
return (
<form onSubmit={handleSubmit((d) => console.log(d))}>
<input name="name" ref={register} />
<input name="age" type="number" ref={register} />
<input type="submit" />
</form>
);
};
Published by bluebill1049 about 4 years ago
Thanks for the amazing work that @jorisre has done ❤️ -> https://github.com/react-hook-form/resolvers/pull/60.
We finally have a solution for the modules import issue around TypeScripts -> https://github.com/react-hook-form/resolvers/issues/20.
- import { yupResolver } from '@hookform/resolvers';
- import { joiResolver } from '@hookform/resolvers';
- import { superstructResolver } from '@hookform/resolvers';
+ import { yupResolver } from '@hookform/resolvers/yup';
+ import { joiResolver } from '@hookform/resolvers/joi';
+ import { superstructResolver } from '@hookform/resolvers/superstruct';
Published by bluebill1049 about 4 years ago
fix errors with validateAllFieldCriteria (#54)
Published by bluebill1049 about 4 years ago
Published by bluebill1049 over 4 years ago
fix ESLint error: Unable to resolve the path to module '@hookform/resolvers' #19
Published by kotarella1110 over 4 years ago
HookFormResolvers
to ReactHookFormResolvers
Published by kotarella1110 over 4 years ago
dist/resolver.js
to dist/index.js
dist/resolver.es.js
to dist/index.esm.js
dist/index.umd.min.js
HookFormResolvers
Published by bluebill1049 over 4 years ago
First RC version combined with RHF V6 RC.
https://github.com/react-hook-form/react-hook-form/releases/tag/v6.0.0-rc.1