Closed catkins-miso closed 9 months ago
Another option that I'm exploring is using redocly split
and redocly bundle
. The former would happen once as part of a check-in to decompose the openapi.yaml
into smaller files. The latter would be used at build time to generate the single-file docs/openapi.yaml
again.
I think the folder structure would be
docs/_data
|___/components
| |_____/headers
| |_____/parameters
| |_____/responses
| |_____/schemas
|___/paths
|___/openapi.yaml <-- build output, should be in .gitignore
This setup will likely require a custom workflow to generate the GH Pages
We want to keep the prose used in the API specification and the external documentation DRY. We may eventually have need to include additional contributor information and/or server locations both for interactive testing and links to external documentation, while the source of truth for those values would be external.
Goals:
Some relevant constraints:
GH Pages can be built from a subfolder on a branch
GH Wiki doesn't support transclusion
Jekyll supports data files
This could be used, for example, to pull
docs/_data/spec_description.yaml
into the the gh-pages via standard Jekyll features, then using e.g.yq (.info.description)=$(yq .description docs/_data/spec_description.yaml)
to include it in theopenapi.yaml
There is a
yq
gh ActionThis would be an effective way to ensure that every commit builds the OpenAPI spec as well as the gh-pages. One problem with using this is that we want to the same transclusion to happen locally. How might we reuse the
yq
commands?The redoc visualization can be included via HTML tags and Jekyll supports raw HTML
VS Code supports .devcontainers and there is a run on save extensions
Proposal
yq
docs/_data
oropenapi-dev.yaml
openapi.yaml
which will be in .gitignoreopenapi.yaml
will be used as it is today, i.e., for the Redoc site and as the primary deliverabledocs/_data/adrs.yaml