visualization-tool icon indicating copy to clipboard operation
visualization-tool copied to clipboard

Improve calling charts via API documentation

Open bprusinowski opened this issue 1 year ago • 4 comments

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.

bprusinowski avatar Jun 10 '24 13:06 bprusinowski

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).

ptbrowne avatar Jun 11 '24 07:06 ptbrowne

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 👍

bprusinowski avatar Jun 11 '24 07:06 bprusinowski

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 👍

ptbrowne avatar Jun 11 '24 07:06 ptbrowne

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 :)

bprusinowski avatar Jun 11 '24 07:06 bprusinowski