Skip to content

feat(validator): add all constrait validator#180

Merged
imdhemy merged 3 commits into
2.xfrom
add-all-constraint-to-validator
May 23, 2026
Merged

feat(validator): add all constrait validator#180
imdhemy merged 3 commits into
2.xfrom
add-all-constraint-to-validator

Conversation

@imdhemy

@imdhemy imdhemy commented May 23, 2026

Copy link
Copy Markdown
Member
Q A
License GPLv3
Issue Closes #171

This PR:

  • Adds all constraint.
  • Extends the flatten-violation helper to support nested violation flattening and formating.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new built-in all constraint to apply nested validation rules to each element of an array, and updates violation flattening so nested/indexed violation paths can be represented in a dot-notation style for easier client consumption (e.g., form error mapping).

Changes:

  • Introduces all constraint (with unit + integration tests) and registers/exports it via the constraints public API.
  • Updates createValidator nested-rule plumbing to preserve the “current value” explicitly when descending into nested validations.
  • Extends flattenViolations to format bracketed/indexed paths (e.g. matrix[1][0]) into dot notation (matrix.1.0) and adds tests.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/validator/flatten-violations.ts Formats violation paths before grouping/flattening.
src/validator/flatten-violations.test.ts Adds coverage for bracket/index path formatting cases.
src/validator/factory/create-validator.ts Adjusts nested validation value passing to preserve explicit undefined values.
src/validator/constraints/other/all.ts Adds the new all constraint implementation.
src/validator/constraints/other/all.test.ts Unit tests for all constraint behavior.
src/validator/constraints/other/all.integration.test.ts End-to-end validation tests for all in real schemas/groups/composition.
src/validator/constraints/index.ts Registers all in builtInConstraints and exports it from the public constraints API.

Comment thread src/validator/flatten-violations.ts
Comment thread src/validator/constraints/index.ts Outdated
@imdhemy imdhemy merged commit 88eb60a into 2.x May 23, 2026
1 check passed
@imdhemy imdhemy deleted the add-all-constraint-to-validator branch May 23, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[validator] Add built-in all other validator constraint

2 participants