3 ms·
> XML Schema is a huge PItA Yes. In the past I used to use Schematron; it's quite fun and extremely straightforward, although it's better described as a set of
by bambax 4y ago
> XML Schema is a huge PItA
Yes. In the past I used to use Schematron; it's quite fun and extremely straightforward, although it's better described as a set of rules / tests than a tool to describe the structure of a document.
https://en.wikipedia.org/wiki/Schematron https://en.wikipedia.org/wiki/Schematron
A Schematron equivalent in JS would be cool. Maybe it already exists?
- michaelmior 4y agoIn some sense, JSON Schema does lean in that direction. In JSON Schema anything is valid except what you constrain. For example, the schema {} will accept any valid JSON. Anything you add to the schema is kind of like a test that further constraints the schema. If I say {"type": "object"}, now my schema will accept any valid object. If I add {"type": "object", "properties": {"foo": "string"}}, now if there is a property "foo", it must have type string. I can still have whatever other properties I want of whatever type.