Skip to content
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

chore(jsonpopulator): remove data values from validation error messages #483

Merged
merged 3 commits into from
Aug 10, 2022

Conversation

mttrbrts
Copy link
Member

This change removes the data values from error messages when model validation fails. Instead, error messages now report the path in the object being validated where the error occurs. A client application could choose to parse the JSONPath expression to find the offending value.

Before

ERROR: Expected value "2022-08-04T10:07asda" to be of type DateTime

After

ERROR: Expected value at path `$.identityVerification.date` to be of type `DateTime`

I also add a test that demonstrates the more advanced error output, previously we had full coverage, but the tests only demonstrated base cases. Surprisingly few tests failed due to this change!

Copy link
Contributor

@sstone1 sstone1 left a comment

Choose a reason for hiding this comment

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

LGTM, shame that ??= isn't available in Node.js 14!

@mttrbrts mttrbrts merged commit b11d778 into accordproject:master Aug 10, 2022
@mttrbrts mttrbrts deleted the mr-validation-errors branch August 10, 2022 13:20
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.

2 participants