-
-
Notifications
You must be signed in to change notification settings - Fork 11
Combine const and enum errors into a single message
#155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Combine const and enum errors into a single message
#155
Conversation
7646a94 to
ac73647
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach isn't going to work. Try,
{
"allOf": [
{ "const": "a" },
{ "const": "b" }
]
}ac73647 to
3b4eaf2
Compare
Hi @jdesrosiers, thanks for pointing out the issue! I understood the problem: Issue: with a schema like above one ->
const passed = normalizedErrors[...][schemaLocation] === true;
if (!passed) hasFailure = true;
// always collect
constraints.push({ allowedValues: [...], schemaLocation });now:
Tests Added:
All tests pass. Is this approach good, or does it need further improvements? |
jdesrosiers
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should work. Just a couple small things I'd like to see.
3b4eaf2 to
e7b9dec
Compare
e7b9dec to
219a62a
Compare
Description
When multiple
constorenumconstraints fail (e.g., viaallOf), produce a single message with the most restrictive constraint instead of multiple redundant messages.enummessageChecklist