Skip to content

feat: avoid redundant keyword repetition for array constraints (#171) - #343

Open
utkarshpatwa393-sys wants to merge 1 commit into
atlassian:mainfrom
utkarshpatwa393-sys:feat/clean-array-keyword-errors-171
Open

utkarshpatwa393-sys wants to merge 1 commit into
atlassian:mainfrom
utkarshpatwa393-sys:feat/clean-array-keyword-errors-171

Conversation

@utkarshpatwa393-sys

Copy link
Copy Markdown

Resolves #171.

Summary of Changes

When formatting validation errors for array constraints such as minItems, maxItems, and uniqueItems, Ajv's default error message already forms a grammatically complete predicate (e.g. must NOT have fewer than 1 items, must NOT have more than 3 items, must NOT have duplicate items (items ## 0 and 1 are identical)).

Previously, DefaultValidationError prepended ${keyword} unconditionally, resulting in repetitive/awkward error phrasing:

  • Before: /operators: minItems must NOT have fewer than 1 items
  • After: /operators: must NOT have fewer than 1 items

Similarly in the CLI codeframe:

  • Before: 👈🏽 minItems must NOT have fewer than 1 items
  • After: 👈🏽 must NOT have fewer than 1 items

Added unit tests validating minItems, maxItems, and uniqueItems error formatting and confirmed all tests pass cleanly.

…sian#171)

Signed-off-by: Utkarsh patwa <utkarshpatwa393@gmail.com>
@changeset-bot

changeset-bot Bot commented Nov 8, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 58e41dc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

This branch has not been deployed

No deployments
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.

Confusing error message while using minItems

1 participant