Closed kristihoskova closed 10 months ago
Possible solutions for generating Markdown docs from Zod schemas (via JSON schema):
The Markdown files generated by @adobe/jsonschema2md
looked really bad, but found some decent alternatives.
The Python generator looks best (most compact), but requires Python and Pip installation to run.
There are still some common problems in how the generated docs look:
PluginConfig
) don't make it in, only the descriptionsz.union
s used in docsUrl
and runner
aren't handled very well, the runner function gets lost completely because it has no JSON representationThe alternatives to using a 3rd party tool are:
The main advantage to doing it ourselves is we can make it look just right for what we need.
Came up with an alternative way to document the config automatically - generate equivalent TypeScript instead of Markdown via JSON Schema - has the advantage of being able to represent what JSON can't (e.g. functions). It's not perfect, but probably the best so far.
I've used up my timebox for this one.
@BioPhoton @vmasek What do you think? How should we proceed? I've described the alternatives above 🔝
My vote would be to generate the TypeScript definitions with zod-to-ts, because it's probably most readable for users and pretty low effort for us to maintain.
Follow-up issue defined:
Spike for the research is 2h.