Open bprusinowski opened 3 weeks ago
I think that if we want to share our definitions, we should use a format that is more interoperable than the io-ts schema. I think that we could use JSON schema ? I think then we could benefit from features like autocompletion in editors like VSCode, as well as potentially more interoperability with other languages (Python).
I think it's a good idea, we use https://github.com/vega/ts-json-schema-generator in other project with a codegen script to convert TS types to JSON Schemas and it works quite well 👍
Ah, I had not thought of using a ts -> json-schema converter, I would have treated the json schema as the source, and hopefully find json-schema to ts-converter. At this point, I think your idea is good as it would be easier to implement and test 👍
After working for a while with JSON Schema, I much more prefer doing this in TS -> JSON Schema direction, as we are more used to writing TS types, with all the handy features like unions, etc, and don't need to learn a new syntax :)
Currently, we link to a TypeScript file with a lot of nested io-ts type definitions – it's quite hard to understand the "resolved" type we actually expect.
We should have a way to either insert resolved TS type directly into the documentation, or think about some other way of making this more accessible.