resolvers

📋 Validation resolvers: Yup, Zod, AJV, Joi, Superstruct, Vest, class-validator, io-ts, typanion, Ajv, TypeBox, Valibot and nope.

MIT License

Downloads
14.5M
Stars
1.6K
Committers
51

Bot releases are hidden (Show)

resolvers - Version 1.3.1

Published by bluebill1049 almost 4 years ago

esm support to fix bundler incompatibility (#95)

resolvers - Version 1.3.0

Published by bluebill1049 almost 4 years ago

Support Yup ^0.32.0 (#92)

resolvers - Version 1.2.0

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>
  );
};
resolvers - Version 1.1.2

Published by bluebill1049 almost 4 years ago

fix: superstruct filename typo (#89)

resolvers - Version 1.1.1

Published by bluebill1049 almost 4 years ago

fix: IE11 build (#85)

resolvers - Version 1.1.0

Published by bluebill1049 almost 4 years ago

Update Superstruct version (#83)

resolvers - Version 1.0.1

Published by bluebill1049 almost 4 years ago

  • build: add TS declaration file to ie11 build (#72)
  • Use right version of react-hook-form for ie11 bundle (#68)
resolvers - Version 1.0.0

Published by bluebill1049 about 4 years ago

🎉 Resolver version 1.0.0 is LIVE.

resolvers - Version v1.0.0-rc.2

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>
  );
};
resolvers - v1.0.0-rc.1

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.

Breaking changes

- 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'; 
resolvers - Version 0.1.1

Published by bluebill1049 about 4 years ago

fix errors with validateAllFieldCriteria (#54)

resolvers - Version 0.1.0

Published by bluebill1049 about 4 years ago

  • Support multiple errors messages(#32)
resolvers - Version 0.0.6

Published by bluebill1049 over 4 years ago

fix ESLint error: Unable to resolve the path to module '@hookform/resolvers' #19

resolvers - Version 0.0.5

Published by kotarella1110 over 4 years ago

  • fix types
  • change umd name from HookFormResolvers to ReactHookFormResolvers
resolvers - Version 0.0.4

Published by kotarella1110 over 4 years ago

resolvers - Version 0.0.2-rc.0

Published by bluebill1049 over 4 years ago

Package Rankings
Top 1.0% on Npmjs.org
Badges
Extracted from project README
npm downloads npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm
Related Projects