Re:Transit – A format for conveying values between different...
by alexatkeplar on Wednesday July 23, 2014 @07:02AM
(#8073681)
Here is a JSON Schema validation failure taken straight out of the Snowplow test suite (pretty printed):
{
"level": "error",
"schema": {
"loadingURI": "#",
"pointer": ""
},
"instance": {
"pointer": ""
},
"domain": "validation",
"keyword": "required",
"message": "object has missing required properties ([\"targetUrl\"])",
"required": [
"targetUrl"
],
"missing": [
"targetUrl"
]
}
You can't seriously prefer a NullPointerException (or choose your poison) three functions later.
I'd argue that it's not.
Your schema is implicitly defined somewhere in the business logic, and you have to first learn the schema description language in order to translate your application code into schema description code. And when the application code changes, you won't be very excited to adjust the schema again.
Sometimes it's worth the effort and makes development easier, often it's the opposite. An error message saying `error: articleId missing in sale object` is more informative than `schema error in line 4282`.