Skip to content

feat: indicate dependent property when required error is triggered by dependencies (#181) - #344

Open
utkarshpatwa393-sys wants to merge 1 commit into
atlassian:mainfrom
utkarshpatwa393-sys:feat/dependency-requirement-context-181
Open

utkarshpatwa393-sys wants to merge 1 commit into
atlassian:mainfrom
utkarshpatwa393-sys:feat/dependency-requirement-context-181

Conversation

@utkarshpatwa393-sys

Copy link
Copy Markdown

Resolves #181.

Summary of Changes

When a schema specifies dependencies or dependentRequired where property A requires property B, Ajv generates a required error with schemaPath: #/dependencies/A/required. Previously, RequiredValidationError only reported must have required property 'B', leaving users unclear as to why property B was suddenly required (as property B is not globally required on the parent object).

This PR:

  1. Extracts the triggering dependent property name from schemaPath in RequiredValidationError.
  2. Clarifies the error message to specify the origin of the requirement:
    • CLI frame: ☹️ contentFile is missing here (required by 'raw')!
    • Structured JS: must have required property 'contentFile' (required by 'raw')
  3. Simplifies DefaultValidationError for direct dependencies keyword errors to avoid awkward keyword prefixing.
  4. Adds unit tests covering schema dependency requirement diagnostics.

… dependencies (atlassian#181)

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: e3c0bc5

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.

Feature: improve description of dependency requirements

1 participant