Creating a Schema Validator for JSONML Format in TypeScript
Hi! I'm trying to create a schema validatort for the JSonML format, which is something like this:
For example:
My initial attempt is lookign something like this:
I'm having two main issues that I need help with:
1. Is there a way to make variadic tuples? For the moment I've created JSonMLNode to avoid this, but I would have to extend it a little bit, for example I coulnd't express JHeader with is as it stands.
2. Is there a way to specify a discrimination function (rather than a field) for the union type? I would like to use JHeader if the first argument is "header" and so on. This makes the errors very hard to read as they show me why a particular node doesn't match all the unions.
For example:
My initial attempt is lookign something like this:
I'm having two main issues that I need help with:
1. Is there a way to make variadic tuples? For the moment I've created JSonMLNode to avoid this, but I would have to extend it a little bit, for example I coulnd't express JHeader with is as it stands.
2. Is there a way to specify a discrimination function (rather than a field) for the union type? I would like to use JHeader if the first argument is "header" and so on. This makes the errors very hard to read as they show me why a particular node doesn't match all the unions.
