diff --git a/.husky/pre-commit b/.husky/pre-commit
index b6e504cf..4855f612 100755
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -18,40 +18,38 @@ call_lefthook()
lefthook "$@"
else
dir="$(git rev-parse --show-toplevel)"
- if test -f "$dir/node_modules/lefthook/bin/index.js"
+ osArch=$(uname | tr '[:upper:]' '[:lower:]')
+ cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
+ if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook"
+ then
+ "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@"
+ elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook"
+ then
+ "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@"
+ elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook"
+ then
+ "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@"
+ elif test -f "$dir/node_modules/lefthook/bin/index.js"
then
"$dir/node_modules/lefthook/bin/index.js" "$@"
+
+ elif bundle exec lefthook -h >/dev/null 2>&1
+ then
+ bundle exec lefthook "$@"
+ elif yarn lefthook -h >/dev/null 2>&1
+ then
+ yarn lefthook "$@"
+ elif pnpm lefthook -h >/dev/null 2>&1
+ then
+ pnpm lefthook "$@"
+ elif swift package plugin lefthook >/dev/null 2>&1
+ then
+ swift package --disable-sandbox plugin lefthook "$@"
+ elif command -v mint >/dev/null 2>&1
+ then
+ mint run csjones/lefthook-plugin "$@"
else
- osArch=$(uname | tr '[:upper:]' '[:lower:]')
- cpuArch=$(uname -m | sed 's/aarch64/arm64/')
- if test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook_${osArch}_${cpuArch}/lefthook"
- then
- "$dir/node_modules/@evilmartians/lefthook/bin/lefthook_${osArch}_${cpuArch}/lefthook" "$@"
- elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook_${osArch}_${cpuArch}/lefthook"
- then
- "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook_${osArch}_${cpuArch}/lefthook" "$@"
-
- elif bundle exec lefthook -h >/dev/null 2>&1
- then
- bundle exec lefthook "$@"
- elif yarn lefthook -h >/dev/null 2>&1
- then
- yarn lefthook "$@"
- elif pnpm lefthook -h >/dev/null 2>&1
- then
- pnpm lefthook "$@"
- elif swift package plugin lefthook >/dev/null 2>&1
- then
- swift package --disable-sandbox plugin lefthook "$@"
- elif command -v mint >/dev/null 2>&1
- then
- mint run csjones/lefthook-plugin "$@"
- elif command -v npx >/dev/null 2>&1
- then
- npx lefthook "$@"
- else
- echo "Can't find lefthook in PATH"
- fi
+ echo "Can't find lefthook in PATH"
fi
fi
}
diff --git a/.husky/prepare-commit-msg b/.husky/prepare-commit-msg
index c27ffd25..2655902b 100755
--- a/.husky/prepare-commit-msg
+++ b/.husky/prepare-commit-msg
@@ -18,40 +18,38 @@ call_lefthook()
lefthook "$@"
else
dir="$(git rev-parse --show-toplevel)"
- if test -f "$dir/node_modules/lefthook/bin/index.js"
+ osArch=$(uname | tr '[:upper:]' '[:lower:]')
+ cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
+ if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook"
+ then
+ "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@"
+ elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook"
+ then
+ "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@"
+ elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook"
+ then
+ "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@"
+ elif test -f "$dir/node_modules/lefthook/bin/index.js"
then
"$dir/node_modules/lefthook/bin/index.js" "$@"
+
+ elif bundle exec lefthook -h >/dev/null 2>&1
+ then
+ bundle exec lefthook "$@"
+ elif yarn lefthook -h >/dev/null 2>&1
+ then
+ yarn lefthook "$@"
+ elif pnpm lefthook -h >/dev/null 2>&1
+ then
+ pnpm lefthook "$@"
+ elif swift package plugin lefthook >/dev/null 2>&1
+ then
+ swift package --disable-sandbox plugin lefthook "$@"
+ elif command -v mint >/dev/null 2>&1
+ then
+ mint run csjones/lefthook-plugin "$@"
else
- osArch=$(uname | tr '[:upper:]' '[:lower:]')
- cpuArch=$(uname -m | sed 's/aarch64/arm64/')
- if test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook_${osArch}_${cpuArch}/lefthook"
- then
- "$dir/node_modules/@evilmartians/lefthook/bin/lefthook_${osArch}_${cpuArch}/lefthook" "$@"
- elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook_${osArch}_${cpuArch}/lefthook"
- then
- "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook_${osArch}_${cpuArch}/lefthook" "$@"
-
- elif bundle exec lefthook -h >/dev/null 2>&1
- then
- bundle exec lefthook "$@"
- elif yarn lefthook -h >/dev/null 2>&1
- then
- yarn lefthook "$@"
- elif pnpm lefthook -h >/dev/null 2>&1
- then
- pnpm lefthook "$@"
- elif swift package plugin lefthook >/dev/null 2>&1
- then
- swift package --disable-sandbox plugin lefthook "$@"
- elif command -v mint >/dev/null 2>&1
- then
- mint run csjones/lefthook-plugin "$@"
- elif command -v npx >/dev/null 2>&1
- then
- npx lefthook "$@"
- else
- echo "Can't find lefthook in PATH"
- fi
+ echo "Can't find lefthook in PATH"
fi
fi
}
diff --git a/README.md b/README.md
index ad18fc7b..16a22980 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,8 @@
## Install
+Install your preferred validation library alongside `@hookform/resolvers`.
+
npm install @hookform/resolvers
## Links
diff --git a/arktype/src/__tests__/Form-native-validation.tsx b/arktype/src/__tests__/Form-native-validation.tsx
index c271055a..2e007dc9 100644
--- a/arktype/src/__tests__/Form-native-validation.tsx
+++ b/arktype/src/__tests__/Form-native-validation.tsx
@@ -33,7 +33,7 @@ function TestComponent({ onSubmit }: Props) {
);
}
-test("form's native validation with Zod", async () => {
+test("form's native validation with Arktype", async () => {
const handleSubmit = vi.fn();
render();
@@ -57,14 +57,14 @@ test("form's native validation with Zod", async () => {
usernameField = screen.getByPlaceholderText(/username/i) as HTMLInputElement;
expect(usernameField.validity.valid).toBe(false);
expect(usernameField.validationMessage).toBe(
- 'username must be more than length 1',
+ 'username must be at least length 2',
);
// password
passwordField = screen.getByPlaceholderText(/password/i) as HTMLInputElement;
expect(passwordField.validity.valid).toBe(false);
expect(passwordField.validationMessage).toBe(
- 'password must be more than length 1',
+ 'password must be at least length 2',
);
await user.type(screen.getByPlaceholderText(/username/i), 'joe');
diff --git a/arktype/src/__tests__/Form.tsx b/arktype/src/__tests__/Form.tsx
index e29fd935..034beb0f 100644
--- a/arktype/src/__tests__/Form.tsx
+++ b/arktype/src/__tests__/Form.tsx
@@ -47,10 +47,10 @@ test("form's validation with arkType and TypeScript's integration", async () =>
await user.click(screen.getByText(/submit/i));
expect(
- screen.getByText('username must be more than length 1'),
+ screen.getByText('username must be at least length 2'),
).toBeInTheDocument();
expect(
- screen.getByText('password must be more than length 1'),
+ screen.getByText('password must be at least length 2'),
).toBeInTheDocument();
expect(handleSubmit).not.toHaveBeenCalled();
});
diff --git a/arktype/src/__tests__/__fixtures__/data.ts b/arktype/src/__tests__/__fixtures__/data.ts
index a3915787..5f0495e7 100644
--- a/arktype/src/__tests__/__fixtures__/data.ts
+++ b/arktype/src/__tests__/__fixtures__/data.ts
@@ -7,7 +7,7 @@ export const schema = type({
repeatPassword: 'string>1',
accessToken: 'string|number',
birthYear: '19001',
diff --git a/arktype/src/__tests__/__snapshots__/arktype.ts.snap b/arktype/src/__tests__/__snapshots__/arktype.ts.snap
index 2ed29acd..51991b6c 100644
--- a/arktype/src/__tests__/__snapshots__/arktype.ts.snap
+++ b/arktype/src/__tests__/__snapshots__/arktype.ts.snap
@@ -3,463 +3,70 @@
exports[`arktypeResolver > should return a single error from arktypeResolver when validation fails 1`] = `
{
"errors": {
- "accessToken": ArkError {
- "code": "required",
- "data": {
- "birthYear": "birthYear",
- "email": "",
- "like": [
- {
- "id": "z",
- },
- ],
- "password": "___",
- "url": "abc",
- },
- "input": {
- "code": "required",
- "missingValueDescription": "a number or a string",
- "relativePath": [
- "accessToken",
- ],
- },
- "missingValueDescription": "a number or a string",
- "nodeConfig": {
- "actual": [Function],
- "description": [Function],
- "expected": [Function],
- "message": [Function],
- "problem": [Function],
- },
- "path": [
- "accessToken",
- ],
+ "accessToken": {
+ "message": "accessToken must be a number or a string (was missing)",
"ref": undefined,
- "relativePath": [
- "accessToken",
- ],
"type": "required",
- Symbol(ArkTypeInternalKind): "error",
},
- "birthYear": ArkError {
- "code": "domain",
- "data": "birthYear",
- "description": "a number",
- "domain": "number",
- "input": {
- "code": "domain",
- "description": "a number",
- "domain": "number",
- },
- "nodeConfig": {
- "actual": [Function],
- "description": [Function],
- "expected": [Function],
- "message": [Function],
- "problem": [Function],
- },
- "path": [
- "birthYear",
- ],
+ "birthYear": {
+ "message": "birthYear must be a number (was a string)",
"ref": undefined,
"type": "domain",
- Symbol(ArkTypeInternalKind): "error",
},
- "dateStr": ArkError {
- "code": "required",
- "data": {
- "birthYear": "birthYear",
- "email": "",
- "like": [
- {
- "id": "z",
- },
- ],
- "password": "___",
- "url": "abc",
- },
- "input": {
- "code": "required",
- "missingValueDescription": "a Date",
- "relativePath": [
- "dateStr",
- ],
- },
- "missingValueDescription": "a Date",
- "nodeConfig": {
- "actual": [Function],
- "description": [Function],
- "expected": [Function],
- "message": [Function],
- "problem": [Function],
- },
- "path": [
- "dateStr",
- ],
+ "dateStr": {
+ "message": "dateStr must be a Date (was missing)",
"ref": undefined,
- "relativePath": [
- "dateStr",
- ],
"type": "required",
- Symbol(ArkTypeInternalKind): "error",
},
- "email": ArkError {
- "code": "pattern",
- "data": "",
- "description": "a valid email",
- "flags": "",
- "input": {
- "code": "pattern",
- "description": "a valid email",
- "flags": "",
- "rule": "^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$",
- },
- "nodeConfig": {
- "actual": [Function],
- "description": [Function],
- "expected": [Function],
- "message": [Function],
- "problem": [Function],
- },
- "path": [
- "email",
- ],
+ "email": {
+ "message": "email must be an email address (was "")",
"ref": {
"name": "email",
},
- "rule": "^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$",
"type": "pattern",
- Symbol(ArkTypeInternalKind): "error",
},
- "enabled": ArkError {
- "code": "required",
- "data": {
- "birthYear": "birthYear",
- "email": "",
- "like": [
- {
- "id": "z",
- },
- ],
- "password": "___",
- "url": "abc",
- },
- "input": {
- "code": "required",
- "missingValueDescription": "boolean",
- "relativePath": [
- "enabled",
- ],
- },
- "missingValueDescription": "boolean",
- "nodeConfig": {
- "actual": [Function],
- "description": [Function],
- "expected": [Function],
- "message": [Function],
- "problem": [Function],
- },
- "path": [
- "enabled",
- ],
+ "enabled": {
+ "message": "enabled must be boolean (was missing)",
"ref": undefined,
- "relativePath": [
- "enabled",
- ],
"type": "required",
- Symbol(ArkTypeInternalKind): "error",
},
"like": [
{
- "id": ArkError {
- "code": "domain",
- "data": "z",
- "description": "a number",
- "domain": "number",
- "input": {
- "code": "domain",
- "description": "a number",
- "domain": "number",
- },
- "nodeConfig": {
- "actual": [Function],
- "description": [Function],
- "expected": [Function],
- "message": [Function],
- "problem": [Function],
- },
- "path": [
- "like",
- 0,
- "id",
- ],
+ "id": {
+ "message": "like[0].id must be a number (was a string)",
"ref": undefined,
"type": "domain",
- Symbol(ArkTypeInternalKind): "error",
},
- "name": ArkError {
- "code": "required",
- "data": {
- "id": "z",
- },
- "input": {
- "code": "required",
- "missingValueDescription": "a string",
- "relativePath": [
- "name",
- ],
- },
- "missingValueDescription": "a string",
- "nodeConfig": {
- "actual": [Function],
- "description": [Function],
- "expected": [Function],
- "message": [Function],
- "problem": [Function],
- },
- "path": [
- "like",
- 0,
- "name",
- ],
+ "name": {
+ "message": "like[0].name must be a string (was missing)",
"ref": undefined,
- "relativePath": [
- "name",
- ],
"type": "required",
- Symbol(ArkTypeInternalKind): "error",
},
},
],
- "password": ArkError {
- "code": "union",
- "data": "___",
- "errors": [
- ArkError {
- "code": "pattern",
- "data": "___",
- "description": "matched by .*[A-Za-z].*",
- "input": {
- "code": "pattern",
- "description": "matched by .*[A-Za-z].*",
- "rule": ".*[A-Za-z].*",
- },
- "nodeConfig": {
- "actual": [Function],
- "description": [Function],
- "expected": [Function],
- "message": [Function],
- "problem": [Function],
- },
- "path": [
- "password",
- ],
- "rule": ".*[A-Za-z].*",
- Symbol(ArkTypeInternalKind): "error",
- },
- ArkError {
- "code": "pattern",
- "data": "___",
- "description": "matched by .*\\d.*",
- "input": {
- "code": "pattern",
- "description": "matched by .*\\d.*",
- "rule": ".*\\d.*",
- },
- "nodeConfig": {
- "actual": [Function],
- "description": [Function],
- "expected": [Function],
- "message": [Function],
- "problem": [Function],
- },
- "path": [
- "password",
- ],
- "rule": ".*\\d.*",
- Symbol(ArkTypeInternalKind): "error",
- },
- ],
- "input": {
- "code": "union",
- "errors": [
- ArkError {
- "code": "pattern",
- "data": "___",
- "description": "matched by .*[A-Za-z].*",
- "input": {
- "code": "pattern",
- "description": "matched by .*[A-Za-z].*",
- "rule": ".*[A-Za-z].*",
- },
- "nodeConfig": {
- "actual": [Function],
- "description": [Function],
- "expected": [Function],
- "message": [Function],
- "problem": [Function],
- },
- "path": [
- "password",
- ],
- "rule": ".*[A-Za-z].*",
- Symbol(ArkTypeInternalKind): "error",
- },
- ArkError {
- "code": "pattern",
- "data": "___",
- "description": "matched by .*\\d.*",
- "input": {
- "code": "pattern",
- "description": "matched by .*\\d.*",
- "rule": ".*\\d.*",
- },
- "nodeConfig": {
- "actual": [Function],
- "description": [Function],
- "expected": [Function],
- "message": [Function],
- "problem": [Function],
- },
- "path": [
- "password",
- ],
- "rule": ".*\\d.*",
- Symbol(ArkTypeInternalKind): "error",
- },
- ],
- },
- "nodeConfig": {
- "actual": [Function],
- "description": [Function],
- "expected": [Function],
- "message": [Function],
- "problem": [Function],
- },
- "path": [
- "password",
- ],
+ "password": {
+ "message": "password must be matched by .*[A-Za-z].* or matched by .*\\d.* (was "___")",
"ref": {
"name": "password",
},
"type": "union",
- Symbol(ArkTypeInternalKind): "error",
},
- "repeatPassword": ArkError {
- "code": "required",
- "data": {
- "birthYear": "birthYear",
- "email": "",
- "like": [
- {
- "id": "z",
- },
- ],
- "password": "___",
- "url": "abc",
- },
- "input": {
- "code": "required",
- "missingValueDescription": "a string",
- "relativePath": [
- "repeatPassword",
- ],
- },
- "missingValueDescription": "a string",
- "nodeConfig": {
- "actual": [Function],
- "description": [Function],
- "expected": [Function],
- "message": [Function],
- "problem": [Function],
- },
- "path": [
- "repeatPassword",
- ],
+ "repeatPassword": {
+ "message": "repeatPassword must be a string (was missing)",
"ref": undefined,
- "relativePath": [
- "repeatPassword",
- ],
"type": "required",
- Symbol(ArkTypeInternalKind): "error",
},
- "tags": ArkError {
- "code": "required",
- "data": {
- "birthYear": "birthYear",
- "email": "",
- "like": [
- {
- "id": "z",
- },
- ],
- "password": "___",
- "url": "abc",
- },
- "input": {
- "code": "required",
- "missingValueDescription": "an array",
- "relativePath": [
- "tags",
- ],
- },
- "missingValueDescription": "an array",
- "nodeConfig": {
- "actual": [Function],
- "description": [Function],
- "expected": [Function],
- "message": [Function],
- "problem": [Function],
- },
- "path": [
- "tags",
- ],
+ "tags": {
+ "message": "tags must be an array (was missing)",
"ref": undefined,
- "relativePath": [
- "tags",
- ],
"type": "required",
- Symbol(ArkTypeInternalKind): "error",
},
- "username": ArkError {
- "code": "required",
- "data": {
- "birthYear": "birthYear",
- "email": "",
- "like": [
- {
- "id": "z",
- },
- ],
- "password": "___",
- "url": "abc",
- },
- "input": {
- "code": "required",
- "missingValueDescription": "a string",
- "relativePath": [
- "username",
- ],
- },
- "missingValueDescription": "a string",
- "nodeConfig": {
- "actual": [Function],
- "description": [Function],
- "expected": [Function],
- "message": [Function],
- "problem": [Function],
- },
- "path": [
- "username",
- ],
+ "username": {
+ "message": "username must be a string (was missing)",
"ref": {
"name": "username",
},
- "relativePath": [
- "username",
- ],
"type": "required",
- Symbol(ArkTypeInternalKind): "error",
},
},
"values": {},
diff --git a/arktype/src/arktype.ts b/arktype/src/arktype.ts
index 6ba83aa6..4d90e585 100644
--- a/arktype/src/arktype.ts
+++ b/arktype/src/arktype.ts
@@ -3,11 +3,22 @@ import { ArkErrors } from 'arktype';
import { FieldError, FieldErrors } from 'react-hook-form';
import type { Resolver } from './types';
-const parseErrorSchema = (e: ArkErrors): Record => {
- // copy code to type to match FieldError shape
- e.forEach((e) => Object.assign(e, { type: e.code }));
- // need to cast here because TS doesn't understand we added the type field
- return e.byPath as never;
+const parseErrorSchema = (arkErrors: ArkErrors): Record => {
+ const errors = [...arkErrors];
+ const fieldsErrors: Record = {};
+
+ for (; errors.length; ) {
+ const error = errors[0];
+ const _path = error.path.join('.');
+
+ if (!fieldsErrors[_path]) {
+ fieldsErrors[_path] = { message: error.message, type: error.code };
+ }
+
+ errors.shift();
+ }
+
+ return fieldsErrors;
};
export const arktypeResolver: Resolver =
diff --git a/bun.lockb b/bun.lockb
index e1de2b95..9d0994bb 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/package.json b/package.json
index 1dc5734f..4463852c 100644
--- a/package.json
+++ b/package.json
@@ -256,53 +256,53 @@
},
"homepage": "https://react-hook-form.com",
"devDependencies": {
- "@sinclair/typebox": "^0.32.34",
- "@testing-library/dom": "^10.3.1",
- "@testing-library/jest-dom": "^6.4.6",
- "@testing-library/react": "^16.0.0",
- "@testing-library/user-event": "^14.5.2",
- "@types/node": "^20.14.9",
- "@types/react": "^18.3.3",
- "@typeschema/core": "^0.13.2",
- "@typeschema/main": "^0.13.10",
- "@typeschema/zod": "^0.13.3",
- "@vinejs/vine": "^2.1.0",
- "@vitejs/plugin-react": "^4.3.1",
- "ajv": "^8.16.0",
+ "@sinclair/typebox": "^0.34.15",
+ "@testing-library/dom": "^10.4.0",
+ "@testing-library/jest-dom": "^6.6.3",
+ "@testing-library/react": "^16.2.0",
+ "@testing-library/user-event": "^14.6.1",
+ "@types/node": "^22.12.0",
+ "@types/react": "^19.0.8",
+ "@typeschema/core": "^0.14.0",
+ "@typeschema/main": "^0.14.1",
+ "@typeschema/zod": "^0.14.0",
+ "@vinejs/vine": "^3.0.0",
+ "@vitejs/plugin-react": "^4.3.4",
+ "ajv": "^8.17.1",
"ajv-errors": "^3.0.0",
- "arktype": "2.0.0-dev.26",
+ "arktype": "2.0.4",
"check-export-map": "^1.3.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"computed-types": "^1.11.2",
"cross-env": "^7.0.3",
- "effect": "^3.10.3",
+ "effect": "^3.12.7",
"fluentvalidation-ts": "^3.2.0",
- "fp-ts": "^2.16.7",
- "io-ts": "^2.2.21",
+ "fp-ts": "^2.16.9",
+ "io-ts": "^2.2.22",
"io-ts-types": "^0.5.19",
"joi": "^17.13.3",
- "jsdom": "^24.1.0",
- "lefthook": "^1.6.18",
+ "jsdom": "^26.0.0",
+ "lefthook": "^1.10.10",
"microbundle": "^0.15.1",
"monocle-ts": "^2.3.13",
"newtype-ts": "^0.3.5",
"nope-validator": "^1.0.4",
"npm-run-all": "^4.1.5",
- "react": "^18.3.1",
- "react-dom": "^18.3.1",
- "react-hook-form": "^7.52.1",
+ "react": "^19.0.0",
+ "react-dom": "^19.0.0",
+ "react-hook-form": "^7.54.2",
"reflect-metadata": "^0.2.2",
- "superstruct": "^1.0.4",
+ "superstruct": "^2.0.2",
"typanion": "^3.14.0",
- "typescript": "^5.5.3",
- "valibot": "^1.0.0-beta.0",
- "vest": "^5.3.0",
- "vite": "^5.3.3",
- "vite-tsconfig-paths": "^4.3.2",
- "vitest": "^1.6.0",
- "yup": "^1.4.0",
- "zod": "^3.23.8"
+ "typescript": "^5.7.3",
+ "valibot": "1.0.0-beta.12",
+ "vest": "^5.4.6",
+ "vite": "^6.0.11",
+ "vite-tsconfig-paths": "^5.1.4",
+ "vitest": "^3.0.4",
+ "yup": "^1.6.1",
+ "zod": "^3.24.1"
},
"peerDependencies": {
"react-hook-form": "^7.0.0"
diff --git a/typebox/src/__tests__/__snapshots__/typebox-compiler.ts.snap b/typebox/src/__tests__/__snapshots__/typebox-compiler.ts.snap
index c5f60cd5..f5c378e9 100644
--- a/typebox/src/__tests__/__snapshots__/typebox-compiler.ts.snap
+++ b/typebox/src/__tests__/__snapshots__/typebox-compiler.ts.snap
@@ -4,7 +4,7 @@ exports[`typeboxResolver (with compiler) > should return a single error from typ
{
"errors": {
"accessToken": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
},
@@ -14,7 +14,7 @@ exports[`typeboxResolver (with compiler) > should return a single error from typ
"type": "41",
},
"dateStr": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
},
@@ -26,7 +26,7 @@ exports[`typeboxResolver (with compiler) > should return a single error from typ
"type": "48",
},
"enabled": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
},
@@ -38,7 +38,7 @@ exports[`typeboxResolver (with compiler) > should return a single error from typ
"type": "41",
},
"name": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
},
@@ -52,17 +52,17 @@ exports[`typeboxResolver (with compiler) > should return a single error from typ
"type": "52",
},
"repeatPassword": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
},
"tags": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
},
"username": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": {
"name": "username",
},
@@ -77,11 +77,11 @@ exports[`typeboxResolver (with compiler) > should return all the errors from typ
{
"errors": {
"accessToken": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
"types": {
- "45": "Required property",
+ "45": "Expected required property",
"62": "Expected union value",
},
},
@@ -94,12 +94,12 @@ exports[`typeboxResolver (with compiler) > should return all the errors from typ
},
},
"dateStr": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
"types": {
"20": "Expected Date",
- "45": "Required property",
+ "45": "Expected required property",
},
},
"email": {
@@ -113,12 +113,12 @@ exports[`typeboxResolver (with compiler) > should return all the errors from typ
},
},
"enabled": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
"types": {
"14": "Expected boolean",
- "45": "Required property",
+ "45": "Expected required property",
},
},
"like": [
@@ -132,11 +132,11 @@ exports[`typeboxResolver (with compiler) > should return all the errors from typ
},
},
"name": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
"types": {
- "45": "Required property",
+ "45": "Expected required property",
"54": "Expected string",
},
},
@@ -154,31 +154,31 @@ exports[`typeboxResolver (with compiler) > should return all the errors from typ
},
},
"repeatPassword": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
"types": {
- "45": "Required property",
+ "45": "Expected required property",
"54": "Expected string",
},
},
"tags": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
"types": {
- "45": "Required property",
+ "45": "Expected required property",
"6": "Expected array",
},
},
"username": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": {
"name": "username",
},
"type": "45",
"types": {
- "45": "Required property",
+ "45": "Expected required property",
"54": "Expected string",
},
},
diff --git a/typebox/src/__tests__/__snapshots__/typebox.ts.snap b/typebox/src/__tests__/__snapshots__/typebox.ts.snap
index 7addc74a..bb150782 100644
--- a/typebox/src/__tests__/__snapshots__/typebox.ts.snap
+++ b/typebox/src/__tests__/__snapshots__/typebox.ts.snap
@@ -4,7 +4,7 @@ exports[`typeboxResolver > should return a single error from typeboxResolver whe
{
"errors": {
"accessToken": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
},
@@ -14,7 +14,7 @@ exports[`typeboxResolver > should return a single error from typeboxResolver whe
"type": "41",
},
"dateStr": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
},
@@ -26,7 +26,7 @@ exports[`typeboxResolver > should return a single error from typeboxResolver whe
"type": "48",
},
"enabled": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
},
@@ -38,7 +38,7 @@ exports[`typeboxResolver > should return a single error from typeboxResolver whe
"type": "41",
},
"name": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
},
@@ -52,17 +52,17 @@ exports[`typeboxResolver > should return a single error from typeboxResolver whe
"type": "52",
},
"repeatPassword": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
},
"tags": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
},
"username": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": {
"name": "username",
},
@@ -77,11 +77,11 @@ exports[`typeboxResolver > should return all the errors from typeboxResolver whe
{
"errors": {
"accessToken": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
"types": {
- "45": "Required property",
+ "45": "Expected required property",
"62": "Expected union value",
},
},
@@ -94,12 +94,12 @@ exports[`typeboxResolver > should return all the errors from typeboxResolver whe
},
},
"dateStr": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
"types": {
"20": "Expected Date",
- "45": "Required property",
+ "45": "Expected required property",
},
},
"email": {
@@ -113,12 +113,12 @@ exports[`typeboxResolver > should return all the errors from typeboxResolver whe
},
},
"enabled": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
"types": {
"14": "Expected boolean",
- "45": "Required property",
+ "45": "Expected required property",
},
},
"like": [
@@ -132,11 +132,11 @@ exports[`typeboxResolver > should return all the errors from typeboxResolver whe
},
},
"name": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
"types": {
- "45": "Required property",
+ "45": "Expected required property",
"54": "Expected string",
},
},
@@ -154,31 +154,31 @@ exports[`typeboxResolver > should return all the errors from typeboxResolver whe
},
},
"repeatPassword": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
"types": {
- "45": "Required property",
+ "45": "Expected required property",
"54": "Expected string",
},
},
"tags": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": undefined,
"type": "45",
"types": {
- "45": "Required property",
+ "45": "Expected required property",
"6": "Expected array",
},
},
"username": {
- "message": "Required property",
+ "message": "Expected required property",
"ref": {
"name": "username",
},
"type": "45",
"types": {
- "45": "Required property",
+ "45": "Expected required property",
"54": "Expected string",
},
},
diff --git a/valibot/package.json b/valibot/package.json
index 8c36ba42..ee682513 100644
--- a/valibot/package.json
+++ b/valibot/package.json
@@ -13,6 +13,6 @@
"peerDependencies": {
"@hookform/resolvers": "^2.0.0",
"react-hook-form": "^7.0.0",
- "valibot": "^1.0.0 || ^1.0.0-beta || ^1.0.0-rc"
+ "valibot": "^1.0.0 || ^1.0.0-beta.4 || ^1.0.0-rc"
}
}
diff --git a/vitest.config.ts b/vitest.config.mts
similarity index 100%
rename from vitest.config.ts
rename to vitest.config.mts