Expand description
GET /api/v2/openapi.json — the API describing itself.
There was no schema of any kind, so a client had to be hand-written
from prose and re-checked by hand whenever anything moved. Response
shapes are built with inline serde_json::json! literals, so there
is no Rust struct to derive a schema from — this describes them
explicitly instead.
The honest limit: the response schemas are hand-maintained and can
drift from the handlers. What cannot drift is the route list —
it comes from crate::api::ROUTE_PATHS, the same constant the
router is built from, and a test asserts every path is documented. So
a new endpoint can never be silently absent, and a removed one can
never linger.
Generate a typed client from it:
npx openapi-typescript https://example.com/api/v2/openapi.json -o api.d.tsConstants§
- PATH
- Where the document is served.