Lemma.Response (lemma_engine v0.9.1)

Copy Markdown View Source

Typed projection of the JSON map returned by Lemma.run/3: evaluated rule results and the resolved temporal window of the spec version actually run.

Lemma.run/3 itself still returns the plain decoded JSON map for backward compatibility; call from_map/1 on that map to get a typed struct.

Summary

Functions

Builds a Lemma.Response from the map decoded from Lemma.run/3's JSON.

Types

t()

@type t() :: %Lemma.Response{
  effective: String.t(),
  results: %{optional(String.t()) => Lemma.RuleResult.t()},
  spec: String.t(),
  spec_effective_from: String.t() | nil,
  spec_effective_to: String.t() | nil
}

Functions

from_map(map)

@spec from_map(map()) :: t()

Builds a Lemma.Response from the map decoded from Lemma.run/3's JSON.

Raises KeyError if a required field (spec, effective, results) is missing — that shape never comes from a real Lemma.run/3 call.