-
Notifications
You must be signed in to change notification settings - Fork 149
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
Slightly better error messages #451
Conversation
751554f
to
27b78a0
Compare
27b78a0
to
9806572
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.
LGTM with optional super minor nits.
dev/src/index.ts
Outdated
ArrayElement: (name, value) => | ||
validateFieldValue(name, value, /* depth */ 0, /*inArray=*/true), | ||
ArrayElement: (name, value) => validateFieldValue( | ||
name, value, /* path */ undefined, /*level=*/0, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
dev/src/index.ts
Outdated
* @param options Validation options | ||
* @param depth The current depth of the traversal. | ||
* @param level The current depth of the traversal. This is used to decided |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -477,20 +481,29 @@ export class FieldPath extends Path<FieldPath> { | |||
*/ | |||
static validateFieldPath(fieldPath: string|FieldPath) { | |||
if (!(fieldPath instanceof FieldPath)) { | |||
if (!is.string(fieldPath)) { | |||
if (fieldPath === undefined) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Fixes #436 and https://b.corp.google.com/issues/78932093
This PR: