feat: add ata-validator resolver#845
Conversation
Add a new resolver for ata-validator, an ultra-fast JSON Schema validator for Node.js.
There was a problem hiding this comment.
Pull request overview
Adds a new ataResolver package to integrate the ata-validator JSON Schema validator into the @hookform/resolvers monorepo, including exports/build wiring and a test suite to validate error mapping and native validation behavior.
Changes:
- Introduces
ata-validatorsubpackage with resolver implementation, types, and public exports. - Adds unit + React integration tests (including native browser validation) plus fixtures/snapshots.
- Updates root
package.jsonexports/build scripts/files list and lockfile to includeata-validator.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
package.json |
Adds export map entry, build script, files list, keywords, and devDependency for ata-validator. |
bun.lock |
Locks ata-validator and related dependencies. |
ata-validator/package.json |
Defines the new subpackage metadata and peer dependencies. |
ata-validator/src/types.ts |
Adds resolver and error type definitions for the subpackage. |
ata-validator/src/index.ts |
Exposes the resolver + types as the public entrypoint. |
ata-validator/src/ata-validator.ts |
Implements ataResolver and error-to-RHF mapping logic. |
ata-validator/src/__tests__/ata-validator.ts |
Unit tests covering success, raw mode, criteriaMode=all, required/undefined, and options. |
ata-validator/src/__tests__/Form.tsx |
React integration test validating RHF error rendering. |
ata-validator/src/__tests__/Form-native-validation.tsx |
Integration test for shouldUseNativeValidation. |
ata-validator/src/__tests__/__fixtures__/data.ts |
Shared schemas/data/field refs for tests. |
ata-validator/src/__tests__/__snapshots__/ata-validator.ts.snap |
Snapshots for resolver error outputs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Avoid recompiling the schema on every validation call by constructing the Validator once when the resolver is created instead of on each form submit.
|
@bluebill1049 Hey!, thank you for your support could you please check again? |
|
@bluebill1049 Thanks again, is there anything left that should i do? |
|
thanks @armagandalkiran i will merge after fix the publish action. |
|
Thanks for work, @armagandalkiran! |
|
Hi @bluebill1049 Can you merge this pr?, if hasn't any blocker |
|
Thanks ❤️ |
|
we r having some issue with publishing, so will go live once resolved. |
Summary
This PR adds a new resolver for ata-validator, an ultra-fast JSON Schema validator for Node.js.
What is ata-validator?
ata-validator is a high-performance JSON Schema validation library that compiles schemas into optimized JavaScript code at runtime. It supports JSON Schema draft 2020-12, provides AJV-compatible error format (
keyword,instancePath,schemaPath,params,message), and offers features likecoerceTypesandremoveAdditionalout of the box.What is included
ataResolver— the resolver function that integrates ata-validator with react-hook-formparseErrorSchema— maps ata-validator errors (JSON PointerinstancePath) to react-hook-form field paths (dot notation)criteriaMode: "all"viaappendErrorsshouldUseNativeValidationviavalidateFieldsNativelyresolverOptions.rawfor returning unmodified input values on valid dataschemaOptionspassthrough for ata-validator options (coerceTypes,removeAdditional,allErrors, etc.)Files added/changed
ata-validator/package.jsonata-validator/src/ata-validator.tsata-validator/src/types.tsata-validator/src/index.tsata-validator/src/__tests__/ata-validator.tsata-validator/src/__tests__/Form.tsxata-validator/src/__tests__/Form-native-validation.tsxata-validator/src/__tests__/__fixtures__/data.tspackage.jsonbun.lockChecklist
bun install— installs successfullybun test— all 8 tests passbun lint— no lint errorsbun run build:ata-validator— builds successfullyThis is my first contribution to this project. If there is anything that needs adjustment — naming conventions, test patterns, structure, or anything else — I am happy to make changes. Please do not hesitate to point out anything that should be different.