Live data from Hacker News

JSON Schema Store

schemastore.org

11–20 of 150 posts

Re: JSON Schema Store

#13
post #9

Does anyone know of a typescript translation for each of those validation models? Or maybe even a way to discover related statically typed definitions based on the validation rules? It would be really nice to not define parts of a data model that provide little to no business value - but where you can easily “stub your toe”.

You could use this[0] package but you would need to download the schema first into a folder say "schemas" and then add a build step as a script in your package.json '"compile-schemas": "json2ts -i schemas -o types"' to export to a "type" folder

[0] json-schema-to-typescript

Re: JSON Schema Store

#14

Earlier quoted context omitted.

I wish it had comments. And for that reason, I prefer yaml.

I prefer JSON's strictness. A Boolean cannot be confused for a string. In yaml: country: no Now your country is Boolean(false) Now, I still prefer yaml overall. Also, I hate that GitHub actions don't support anchors.

That's a false dichotomy. JSON could have comments and not be ambiguous like YAML.

In fact: there exists a specification called JSON5 which does include comments.

But I agree that it would've been nice if it had comments before it achieved a critical mass of adoption.

Re: JSON Schema Store

#16
post #9

Does anyone know of a typescript translation for each of those validation models? Or maybe even a way to discover related statically typed definitions based on the validation rules? It would be really nice to not define parts of a data model that provide little to no business value - but where you can easily “stub your toe”.

use quicktype: https://quicktype.io/

Re: JSON Schema Store

#20

Earlier quoted context omitted.

I wish it had comments. And for that reason, I prefer yaml.

I prefer JSON's strictness. A Boolean cannot be confused for a string. In yaml: country: no Now your country is Boolean(false) Now, I still prefer yaml overall. Also, I hate that GitHub actions don't support anchors.

In YAML 1.2 that gives the string "no".
Post reply on HN