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

Custom Error Messaging #147

Closed
aray12 opened this issue Nov 3, 2015 · 3 comments
Closed

Custom Error Messaging #147

aray12 opened this issue Nov 3, 2015 · 3 comments

Comments

@aray12
Copy link

aray12 commented Nov 3, 2015

I know some people have recommended custom error messaging. Would something like the following make more sense and be easier to declare?

var schema = {
  "id": "/All",
  "type": "object",
  "properties": {
      "validateType1": {
         "type": {
           "value": "string",
           "errorMessage": "this is now a string and I am telling you how I like"
         }
      }  
   }  
}

This would definitely make internationalization easier.

@awwright
Copy link
Collaborator

awwright commented Nov 5, 2015

It needs some documentation, maybe a tutorial on how to get it working, but the returned error list contains name and argument properties, as well as the original failing schema, including the id property if any.

The message property that's returned is computed from the name and argument properties, but you can do this yourself in your preferred locale, too.

Is that helpful at all?

@lganet
Copy link

lganet commented Nov 19, 2015

Yes, mainly for translation to other language.

@awwright
Copy link
Collaborator

Merging this with #212

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

3 participants