Skip to main content

Crate lemma_openapi

Crate lemma_openapi 

Source
Expand description

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.

Structs§

ApiSource
A single Scalar API reference source entry.

Functions§

generate_openapi
Generate a complete OpenAPI 3.1 specification using the current time.
generate_openapi_effective
Generate a complete OpenAPI 3.1 specification for a specific point in time.
temporal_api_sources
Compute the list of Scalar multi-source entries for temporal versioning.