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 visible (Hide)

resolvers - v2.9.1

Published by github-actions[bot] over 2 years ago

2.9.1 (2022-06-10)

Bug Fixes

  • ajv resolver to work with unlimited layers of nesting (#412) (692fe65)
resolvers - v2.9.0

Published by github-actions[bot] over 2 years ago

2.9.0 (2022-06-03)

Features

import { useForm } from 'react-hook-form';
import { ajvResolver } from '@hookform/resolvers/ajv';

// must use `minLength: 1` to implement required field
const schema = {
  type: 'object',
  properties: {
    username: {
      type: 'string',
      minLength: 1,
      errorMessage: { minLength: 'username field is required' },
    },
    password: {
      type: 'string',
      minLength: 1,
      errorMessage: { minLength: 'password field is required' },
    },
  },
  required: ['username', 'password'],
  additionalProperties: false,
};

const App = () => {
  const {
    register,
    handleSubmit,
    formState: { errors },
  } = useForm({
    resolver: ajvResolver(schema),
  });

  return (
    <form onSubmit={handleSubmit((data) => console.log(data))}>
      <input {...register('username')} />
      {errors.username && <span>{errors.username.message}</span>}
      <input {...register('password')} />
      {errors.password && <span>{errors.password.message}</span>}
      <button type="submit">submit</button>
    </form>
  );
};
resolvers - v2.8.10

Published by github-actions[bot] over 2 years ago

2.8.10 (2022-05-17)

Bug Fixes

  • update for other resolvers with new option (#404) (c560af3)
resolvers - v2.8.9

Published by github-actions[bot] over 2 years ago

2.8.9 (2022-05-15)

Bug Fixes

  • zod: add ability to skip zod's parsing (#401) (259b4dc)
resolvers - v2.8.8

Published by github-actions[bot] almost 3 years ago

2.8.8 (2022-01-18)

Bug Fixes

resolvers - v2.8.7

Published by github-actions[bot] almost 3 years ago

2.8.7 (2022-01-18)

Bug Fixes

resolvers - v2.8.6

Published by github-actions[bot] almost 3 years ago

2.8.6 (2022-01-18)

Bug Fixes

resolvers - v1.3.8

Published by github-actions[bot] almost 3 years ago

1.3.8 (2022-01-18)

Bug Fixes

resolvers - v2.8.5

Published by github-actions[bot] almost 3 years ago

2.8.5 (2021-12-12)

Bug Fixes

resolvers - v2.8.4

Published by github-actions[bot] almost 3 years ago

2.8.4 (2021-12-03)

Bug Fixes

resolvers - v2.8.3

Published by github-actions[bot] almost 3 years ago

2.8.3 (2021-11-02)

Bug Fixes

  • zodResolver: no exported member ParseParamsNoData (#264) (14683e5)
resolvers - v2.8.2

Published by github-actions[bot] about 3 years ago

2.8.2 (2021-10-06)

Bug Fixes

  • TypeScript issues with the latest react-hook-form version (66182f8)
resolvers - v2.8.1

Published by github-actions[bot] about 3 years ago

2.8.1 (2021-09-18)

Bug Fixes

resolvers - v2.8.0

Published by github-actions[bot] about 3 years ago

2.8.0 (2021-08-19)

BREAKING CHANGES

resolvers - v2.7.1

Published by github-actions[bot] about 3 years ago

2.7.1 (2021-08-04)

Performance Improvements

resolvers - v2.7.0

Published by github-actions[bot] about 3 years ago

2.7.0 (2021-07-31)

Features

import { useForm } from 'react-hook-form';
import { typanionResolver } from '@hookform/resolvers/typanion';
import * as t from 'typanion';

const isUser = t.isObject({
  username: t.applyCascade(t.isString(), [t.hasMinLength(1)]),
  age: t.applyCascade(t.isNumber(), [t.isInteger(), t.isInInclusiveRange(1, 100)]),
});

const App = () => {
  const {
    register,
    handleSubmit,
    formState: { errors },
  } = useForm({
    resolver: typanionResolver(isUser),
  });

  return (
    <form onSubmit={handleSubmit((d) => console.log(d))}>
      <input {...register('name')} />
      {errors.name?.message && <p>{errors.name?.message}</p>}
      <input type="number" {...register('age')} />
      {errors.age?.message && <p>{errors.age?.message}</p>}
      <input type="submit" />
    </form>
  );
};

resolvers - v2.6.1

Published by github-actions[bot] over 3 years ago

2.6.1 (2021-07-13)

Bug Fixes

resolvers - v2.6.0

Published by github-actions[bot] over 3 years ago

2.6.0 (2021-06-19)

Features

resolvers - v2.5.2

Published by github-actions[bot] over 3 years ago

2.5.2 (2021-05-31)

Bug Fixes

resolvers - v2.5.1

Published by github-actions[bot] over 3 years ago

2.5.1 (2021-05-16)

Bug Fixes

  • zodResolver: improve unionErrors parsing (#168) (f67a10f)
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