Skip to main content

generate_openapi_effective

Function generate_openapi_effective 

Source
pub fn generate_openapi_effective(
    engine: &Engine,
    explanations_enabled: bool,
    effective: &DateTimeValue,
) -> Value
Expand description

Generate a complete OpenAPI 3.1 specification for a specific point in time.

The specification includes:

  • GET / — list loaded specs (name, data/rule counts)
  • Spec endpoints (/{spec_name}) with ?rules= query parameter
  • GET (schema: spec_set_id, effective_from, data, rules, meta, versions) and POST (evaluate: envelope spec, effective, result) with Accept-Datetime header
  • x-effective-from / x-effective-to vendor extensions on each spec PathItem exposing the half-open [effective_from, effective_to) range of the version resolved at the document’s effective instant (both null when unbounded)

CLI lemma server also exposes shell routes (/openapi.json, /health, /docs) and legacy schema routes (/schema/{spec_name}, /schema/{spec_name}/{rules}); both are intentionally omitted from the generated document. The legacy /schema/* routes predate the spec envelope returned by GET /{spec_name} and are kept for backward compatibility only; use GET /{spec_name} instead. GET / (list loaded specs) is included alongside GET|POST /{spec_name}.

When explanations_enabled is true, the spec adds the x-explanations header parameter to evaluation endpoints and describes the optional explanation field on rule results.