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

Using labels in error messages #306

Merged
merged 2 commits into from
Aug 30, 2022
Merged

Conversation

Abdullah0sama
Copy link

Hello,
I implemented the feature mentioned in issue #209 .
Using label in messages instead of property name.

const schema = {
	email: { type: "email", label: "Email Address" },
};
const check = v.compile(schema);
check({ email: "notAnEmail" });
/* Returns
[
  {
    type: 'email',
    message: "The 'Email Address' field must be a valid e-mail.",
    field: 'email',
    actual: 'notAnEmail',
    label: 'Email Address'
  }
]
*/

Copy link
Owner

@icebob icebob left a comment

Choose a reason for hiding this comment

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

Good job, could you add it to the readme docs as well?

@Abdullah0sama
Copy link
Author

@icebob Done!

@icebob icebob merged commit 9ca1503 into icebob:master Aug 30, 2022
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.

3 participants