Skip to content

if/then/else & error messages #638

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

Closed
delmu opened this issue Jul 17, 2018 · 1 comment
Closed

if/then/else & error messages #638

delmu opened this issue Jul 17, 2018 · 1 comment

Comments

@delmu
Copy link

delmu commented Jul 17, 2018

Hi experts,

I would like to customize some error message in the if/then/else logic. But it seems that ajv is not support that or I make some mistakes. Does anyone know how to do it? Thanks in advance.

Following is a example...

Example:

const schema_motor = {
if: {
properties: {
dad_phone_number: {
type: 'number',
}
},
errorMessage: {
properties: {
dad_phone_number: 'Dad's phone number is incorrect.'
}
}
},
then: true,
else: {
properties: {
mum_phone_number: {
type: 'number'
}
},
errorMessage: {
properties: {
mum_phone_number: 'Mum's phone number is incorrect.'
}
}

@epoberezkin

@Relequestual
Copy link
Member

There is currently no standard for outputting error messages, or defining error messages.
For discussion on adding this to the spec, please follow #396

For questions regarding the ajv implementation specifically, please file an issue on the associated project at https://github.com/epoberezkin/ajv/issues

Thanks.

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

2 participants