3 ms·
> The moment we added JSON schema There is an amazing JSON schema syntax out there, 100% better than the official one. It is called TypeScript, and I am sad th
by com2kid 7y ago
> The moment we added JSON schema
There is an amazing JSON schema syntax out there, 100% better than the official one. It is called TypeScript, and I am sad that the TS compiler can't be made to pop out JSON validators (their philosophy being nothing at all runtime).
There is a project (I forget its name) that will insert itself into your build steps and use TS type definitions to validate JSON.
Seriously the TS syntax is great, why is anything else being used to write a schema?
The only thing I'd add to the TS syntax is the proposals to add field validation using regexs, or some type of field name validation format. There are times when TS can't model my JS objects, e.g. I have a bunch of GUID field names that map to objects of a certain type, and I have some other field names that are 100% not GUIDs, I promise, mapping to some other stuff.