OpenAPI 3.1 specification generator for Lemma specs.
Takes a Lemma Engine and produces a complete OpenAPI specification as JSON.
Used by both lemma server (CLI) and LemmaBase.com for consistent API docs.
Temporal versioning
Lemma specs can have multiple temporal versions (e.g. spec pricing 2024-01-01
and spec pricing 2025-01-01) with potentially different interfaces (facts, rules,
types). The OpenAPI spec must reflect the interface active at a specific point in
time. Use [generate_openapi_effective] with an explicit DateTimeValue to get the
spec for a given instant. [generate_openapi] is a convenience wrapper that uses
the current time.
For Scalar multi-spec rendering, [temporal_api_sources] returns the list of
temporal version boundaries so the Scalar UI can offer a source selector.