Commit Graph

6 Commits

Author SHA1 Message Date
Wez Furlong 37111c8036 add auto-gen docs for proxy-server http api and metrics
refs: https://github.com/KumoCorp/kumomta/pull/472
2026-02-06 07:11:56 +00:00
Wez Furlong bd4e3f72c8 docs: add jsonschematodocs utility
We currently use a rather hacky embedding of rapidoc to provide a
generic browser around the jsonschema export from our API interface.

It's not great for a couple of reasons:

* The font sizes are tiny
* The documentation rapidoc produces is not indexable, being
  generated by javascript when the browser loads.  This also
  prevents making proper links to the various doc pages

This commit introduces a little utility that we can use during
the doc build to translate the schema into documentation files
that can then be processed as normal by the build.

This commit does this just for kumod at this time, but we could
also add tsa daemon in the future if we expand its API surface.
2026-01-30 15:43:09 +00:00
Wez Furlong c9b98adc10 ci: cache target dir directly 2024-06-12 12:19:29 -07:00
Wez Furlong a768c6dc79 update-openapi.sh: only run when jq is available
This script is triggered as part of `make test` which is not
really a great place for it.

Its purpose is to extract the auto-generated openapi spec
from the kumod and tsa binaries and update the snapshot
that is present in the docs.

It needs kumod and tsa-daemon to have been built in debug mode
to run successfully.

It piggy-backs on `make test` on the assumption that it will
cause the person who is making changes to it to include those
spec updates in their commit/PR.

Since `make test` invokes it, the various builders may try
and fail to execute jq in the `test` step.  This is mostly
harmless, but looks noisy in the logs.

The ideal situation for this would be:

* at PR time and push time: add a check that runs this script and that
  fails if the specs are updated for the docs and are not part of the PR
  itself. (eg: status is dirty after running it).
  This way it will be visible from the CI state that something is awry.
2024-04-20 07:17:02 -07:00
Wez Furlong 837f9e5c0e automate updating the openapi spec files
I definitely forgot to do this on the very first change after
adding them, so I want to make it less likely in the future.

This causes the specs to get updated in the docs if they have
changed (other than the version field) since the last time they
were updated.

We check this during test and doc building.  That should be
sufficient to catch this during my dev loop.

refs: https://github.com/KumoCorp/kumomta/issues/96
2023-11-23 09:02:00 -07:00
Wez Furlong 0b87c020b4 add openapi.json metadata for http api
Adds `/api-docs/openapi.json` and `/rapidoc` endpoints to both
kumod and tsa-daemon.

The former exposes the subset of the API that is expressable
in the openapi schema as a json file that can be imported into
other tools.

The latter is a single-page web app that consumes the former
to provide an interactive API explorer.
We're using rapidoc for this, because I happen to think it looks
nicest and easiest to use, and we can integrate it into the docs
fairly nicely.

Which leads in nicely to say: I've integrated a read-only version
of rapidoc into the docs, and it even detects and adjusts to the
selected light/dark mode.

The `docs/update-openapi.sh` extracts the openapi.json data from
kumod and tsa-daemon and outputs to the correct place in the docs
directory structure to enable this.

refs: https://github.com/KumoCorp/kumomta/issues/96
2023-11-21 15:30:13 -07:00