Lemma.ShowData (lemma_engine v0.10.2)

Copy Markdown View Source

One evaluation-data input of a spec, as returned in Lemma.Show.data: one properties entry of the Show JSON Schema document, keyed by its input key.

Empty needed_by_rules (x-lemma-needed-by-rules) means offered for reuse (data x: alias.slot), not an eval intake key for this spec.

path (x-lemma-path) is the import hops to this slot; empty means this spec.

type is the raw x-lemma-type map (ShowPropertyType): a LemmaType without help and without text options/length. Those live on the property schema as description, enum and minLength/maxLength (schema). Pattern-match on type by "kind" (e.g. %{"kind" => "measure", "units" => units} = entry.type). A "list" type carries "element" (a bare type specification; "kind" => "spec" for instance lists) and "key" ("numbered" or %{"fields" => [...]}).

value (x-lemma-value) of an instance list lists its source rows in order: each item of "list" has only "fields", the fields that row sets, keyed relative to the row spec; neither the list nor its rows carry "result". A literal field is a typed RuleResultValue; a referenced field carries only "reference" (the input key of the referenced data). A list has no value when it has no source rows.

schema is the raw property schema map, for validating evaluation data.

Summary

Functions

Builds a Lemma.ShowData from one value of the decoded Show document's "properties" (or a row schema's "properties"). x-lemma-value and x-lemma-suggestion are absent when unset; both yield nil.

Types

t()

@type t() :: %Lemma.ShowData{
  needed_by_rules: [String.t()],
  path: [Lemma.PathSegment.t()],
  schema: map(),
  suggestion: map() | nil,
  type: map(),
  value: map() | nil
}

Functions

from_map(map)

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

Builds a Lemma.ShowData from one value of the decoded Show document's "properties" (or a row schema's "properties"). x-lemma-value and x-lemma-suggestion are absent when unset; both yield nil.