Plugins
Open API
Generate an OpenAPI document and Scalar UI for the mounted auth surface.
The Open API plugin walks the registered Kernia router and emits an OpenAPI 3.1 document with routes from core and enabled plugins. It also serves a Scalar documentation page backed by that document.
Installation
uv add kerniaImport path
from kernia.plugins.open_api import open_apiServer configuration
import os
from kernia import KerniaOptions
from kernia.auth import init
from kernia.plugins.open_api import open_api
from .db import adapter
auth = init(KerniaOptions(
database=adapter,
secret=os.environ["KERNIA_SECRET"],
base_url=os.environ["KERNIA_BASE_URL"],
base_path="/api/auth",
plugins=(
open_api(),
),
))API routes
GET
/api/auth/openapi.jsonReturns the generated OpenAPI 3.1 document for the current Kernia route table.
GET
/api/auth/scalarServes an HTML Scalar UI pointed at /openapi.json.
Schema impact
No database changes. The document is generated from router metadata and Pydantic request models.
Behavior and options
- Generated schemas reflect only plugins enabled in the current
authinstance. - Treat the document as public API documentation; avoid exposing private admin instances without access controls.
- Rebuild after route or plugin changes.