4 ms·
And this is where we end up without easy to use and well supported schemas... If this was XML, you'd write a very simple RELAX NG grammar (use the compact synt
by zdw 10y ago
And this is where we end up without easy to use and well supported schemas...
If this was XML, you'd write a very simple RELAX NG grammar (use the compact syntax: http://relaxng.org/compact-tutorial-20030326.html http://relaxng.org/compact-tutorial-20030326.html ) that describes the structure of the incoming data, then use it to validate the input data before processing it.
After that, you know data is valid and in the right structure, so you can throw away most of the "is this in the right place?" checks.
JSON and YAML's various schema implementations can't hold a candle to this, and it's been around for over a decade.
The XML ecosystem does have some very bad parts, but it's not all bad, so it's worth learning from places where it actually works well.
- sk5t 10y agoIn Java land, swagger + dropwizard validation do a rather good job of this with json. I wouldn't be excited to return to using soap/xml all the time.