Skip to main content

Module docs

Module docs 

Source
Expand description

The API’s description and Swagger UI over it (see archive/PROJECT.md, Web UI and CLI: Swagger UI).

Both work behind a gateway that serves schedr under a path prefix and rewrites it away (Istio’s rewrite with an X-Forwarded-Prefix header): Swagger UI’s page refers to the description and redirects by relative URLs, and the description names the prefix as its server, so “Try it out” calls the API through the same prefix.

Constants§

FORWARDED_PREFIX_HEADER
The header a gateway names the path prefix it removed in.

Functions§

description
The OpenAPI description, naming the forwarded prefix as its server when there is one (Vary, so a cache in front keeps one per prefix).
file
A file of Swagger UI (its page for /api/v1/docs/), cached by browsers for an hour (the files change only with schedr’s version).
forwarded_prefix
X-Forwarded-Prefix when it is a plain path (/service/schedr), without a trailing slash; anything else is ignored, as is a prefix of / alone.
redirect
/api/v1/docs to /api/v1/docs/, relative, so a prefix in front stays.