News for hackers. Stuff that matters.
Re:JSON Schema by rpedela on Sunday February 18, 2018 @12:30PM (#16407082)
Yes, but many of the implementations are a nightmare to use if you have a complex schema and you want to return a meaningful, useful error to API users. To be fair, there can be ambiguity making it difficult for the library to return the correct error such as using "oneOf". Two things make a difference.

1. if/then/else which was added in Draft-07.

2. Custom errors. For Node, I use ajv and ajv-errors.

With the combination of if/then/else and custom errors, I have found that I can always return a single, useful error to the API user regardless of the schema complexity.

There are no comments on this comment yet.