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

Allow different messages for each validation #189

Open
jmendiola222 opened this issue Mar 28, 2018 · 0 comments
Open

Allow different messages for each validation #189

jmendiola222 opened this issue Mar 28, 2018 · 0 comments

Comments

@jmendiola222
Copy link

In revalidator documentation, with is refereed by yours, there is the possibility to assign different error messages depending on the validation it fails:

type: 'string',
format: 'url'
messages: {
  type: 'Not a string type',
  format: 'Expected format is a url'
}

But when I try this schema on prompt it doesn't work, just gives the default error: error: Invalid input for

My actual use case is with conform if that makes any difference:

pattern: /^[(0-9a-f)]{64}$/,
conform: (value) => {
  return false;
},
messages: {
  pattern: '64 chars hexa',
  conform: 'I expect this message!'
}     
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

No branches or pull requests

1 participant