4 ms·
I haven't stumbled upon a better schema for JSON than the Typescript definition files. If only I could use them in non Typescript contexts. https://www.typescr
by diegoperini 5y ago
I haven't stumbled upon a better schema for JSON than the Typescript definition files. If only I could use them in non Typescript contexts.
https://www.typescriptlang.org/docs/handbook/declaration-files/deep-dive.html https://www.typescriptlang.org/docs/handbook/declaration-fil...
- YousefED 5y agoThis is why I originally started a project to convert ts to json schema; https://github.com/YousefED/typescript-json-schema https://github.com/YousefED/typescript-json-schema (and also check out a good alternative https://github.com/vega/ts-json-schema-generator https://github.com/vega/ts-json-schema-generator)
- anentropic 5y agoyou might like https://jsontypedef.com/ https://jsontypedef.com/ if you haven't seen it
- panzerklein 5y agoYou can write validation schemas using zod library [1]. They end up looking pretty similar to typescript definitions (same vocabulary, same methods for combining/intersecting/filtering). And if you migrate to typescript you'll get type definitions for free out of those schemas. [1] https://github.com/colinhacks/zod https://github.com/colinhacks/zod
- IggleSniggle 5y agoIf you like zod, you should check out myzod: https://github.com/davidmdm/myzod https://github.com/davidmdm/myzod