Skip to main content

OpenAPI schema

mykal is a FastAPI app and ships a native OpenAPI 3 schema. You can use it for codegen (openapi-generator, swagger-codegen, or modern tools like fern and speakeasy).

Live schema (development only)

When the server runs with DEBUG=true the live schema is served at:

url
GET /openapi.json

The interactive Swagger UI lives at /docs and the Redoc view at /redoc.

Production snapshot

In production DEBUG=false hides the live route. A snapshot of the schema is committed under /mykal/developer-examples/openapi.json:

Regenerate the snapshot with:

bash
cd backend
python -c "
from fastapi.openapi.utils import get_openapi
import app.main as m
spec = get_openapi(title='mykal', version='1.0.0', routes=m.app.routes)
import json
json.dump(spec, open('app/static/mykal/developer-examples/openapi.json','w'), indent=2)
"

Codegen example

bash
# Python client from the snapshot
openapi-generator generate \
    -i backend/app/static/mykal/developer-examples/openapi.json \
    -g python \
    -o clients/mykal-python
The alias /v1/* mounts are marked include_in_schema=False; they don't appear in the schema but behave identically to /api/v1/*.