Socket
Socket
Sign inDemoInstall

@hookform/resolvers

Package Overview
Dependencies
Maintainers
3
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hookform/resolvers - npm Package Compare versions

Comparing version 2.8.10 to 2.9.0

ajv/dist/ajv.d.ts

19

package.json
{
"name": "@hookform/resolvers",
"amdName": "hookformResolvers",
"version": "2.8.10",
"version": "2.9.0",
"description": "React Hook Form validation resolvers: Yup, Joi, Superstruct, Zod, Vest, Class Validator, io-ts, Nope, computed-types and Typanion",

@@ -78,2 +78,8 @@ "main": "dist/resolvers.js",

},
"./ajv": {
"browser": "./ajv/dist/ajv.module.js",
"umd": "./ajv/dist/ajv.umd.js",
"import": "./ajv/dist/ajv.mjs",
"require": "./ajv/dist/ajv.js"
},
"./package.json": "./package.json",

@@ -113,3 +119,6 @@ "./*": "./*"

"typanion/src",
"typanion/dist"
"typanion/dist",
"ajv/package.json",
"ajv/src",
"ajv/dist"
],

@@ -133,2 +142,3 @@ "publishConfig": {

"build:typanion": "microbundle --cwd typanion --globals '@hookform/resolvers=hookformResolvers'",
"build:ajv": "microbundle --cwd ajv --globals '@hookform/resolvers=hookformResolvers'",
"postbuild": "node ./config/node-13-exports.js",

@@ -157,3 +167,4 @@ "lint": "eslint . --ext .ts,.js --ignore-path .gitignore",

"computed-types",
"typanion"
"typanion",
"ajv"
],

@@ -178,2 +189,4 @@ "repository": {

"@typescript-eslint/parser": "^5.10.0",
"ajv": "^8.11.0",
"ajv-errors": "^3.0.0",
"check-export-map": "^1.2.0",

@@ -180,0 +193,0 @@ "class-transformer": "^0.5.1",

@@ -30,9 +30,9 @@ <div align="center">

```
type Options = {
type Options = {
mode: 'async' | 'sync',
rawValues?: boolean
rawValues?: boolean
}
resolver(schema: object, schemaOptions?: object, resolverOptions: Options)
````
```

@@ -409,2 +409,52 @@ | | type | Required | Description |

### [Ajv](https://github.com/ajv-validator/ajv)
The fastest JSON validator for Node.js and browser
[![npm](https://img.shields.io/bundlephobia/minzip/ajv?style=for-the-badge)](https://bundlephobia.com/result?p=ajv)
```tsx
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>
);
};
```
## Backers

@@ -411,0 +461,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc