Skip to content

Combine required and dependentRequired error messages#160

Open
Sam-61s wants to merge 2 commits intohyperjump-io:mainfrom
Sam-61s:feat/combine-required-message
Open

Combine required and dependentRequired error messages#160
Sam-61s wants to merge 2 commits intohyperjump-io:mainfrom
Sam-61s:feat/combine-required-message

Conversation

@Sam-61s
Copy link
Contributor

@Sam-61s Sam-61s commented Feb 3, 2026

When required and dependentRequired fail at the same instance location, they previously produced multiple duplicate messages. This change consolidates those failures into a single required-message, combining and deduplicating missing properties while preserving schema locations.

Adds test coverage for the original issue scenario and keeps existing dependentRequired and dependency behavior unchanged.

Fixes #134

Copy link
Collaborator

@jdesrosiers jdesrosiers left a comment

Choose a reason for hiding this comment

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

Try again. You should end up with one error handler that handles required, dependentRequired, and the array form of dependencies. There doesn't need to be a separate error handler for each keyword. They're defined separately specifically for that reason.

@Sam-61s
Copy link
Contributor Author

Sam-61s commented Feb 4, 2026

Thanks for the clarification. I plan to unify required, dependentRequired, and the array-form of dependencies into required.js, while keeping schema-form dependencies handled separately through normal nested validation.

The unified handler will consolidate missing properties into a single required-message, deduplicate properties, and preserve schemaLocations. Since dependentRequired will be handled by the unified handler, I also plan to remove the separate dependentRequired.js handler.

Does that match your expectation?

@jdesrosiers
Copy link
Collaborator

Yep. That sounds right.

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.

Combine required/dependentRequired messages

2 participants