4 ms·
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
by mooreed 3y ago
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”.
- vorticalbox 3y agoYou 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
- avx56 3y agoIf it's a one-off you can just use http://borischerny.com/json-schema-to-typescript-browser/ http://borischerny.com/json-schema-to-typescript-browser/ or https://transform.tools/json-schema-to-typescript https://transform.tools/json-schema-to-typescript (they both use the same library).
- tinix 3y agouse quicktype: https://quicktype.io/ https://quicktype.io/
- avel 3y agoAwesome tool, thank you for sharing. I made use of it already!
- RomanAlexander 3y agoI've been asking chatgpt to do it for me.
- andenacitelli 3y agoMost languages have some code generation tool requiring a compile step, but most of the specs in here change infrequently enough you can just do it once and commit to VC. I personally have a use case where I modify the Meltano (ETL tool) spec at runtime and use a generated scheme to validate reads and writes to the file, helping catch bugs early.