-
Notifications
You must be signed in to change notification settings - Fork 338
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
Teach convertAjvErrors to provide an even better UX #1548
Conversation
packages/http/src/validator/validators/__tests__/__snapshots__/utils.spec.ts.snap
Show resolved
Hide resolved
@@ -15,17 +15,15 @@ export const convertAjvErrors = (errors: NonEmptyArray<ErrorObject>, severity: D | |||
errors, | |||
map<ErrorObject, IPrismDiagnostic>(error => { | |||
const allowedParameters = 'allowedValues' in error.params ? `: ${error.params.allowedValues.join(', ')}` : ''; | |||
const errorPath = error.dataPath.includes('.') | |||
? error.dataPath.split('.').slice(1) |
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.
@XVincentX I'm not quite sure where did the initial slice(1)
come from. Nor what requirement it was fulfilling.
Switching to a split('.')
call seems to still not break any test while making the code a bit easier to reason with.
Hi, |
We try to look at PRs in a timely manner and try to release as long as we have meaningful changes. TL;DR: no ETA. |
@XVincentX 👋 Any chance you could take a look at this? |
I'll try to get on this asap; I need to do a sanity check as well as reviewing the code. I want to make sure we're not bloating the function with edge cases and see if there are some split opportunities. I'll keep you posted. |
This is a follow up to #1530
should NOT have additional properties
). This change proposal adds the name of the superfluous property in the error message (eg. `should NOT have additional properties; found 'neither'`)