Skip to main content

Module api

Module api 

Source
Expand description

JSON API types for Engine boundary documents.

Types reachable from crate::Engine carry no JSON-shaping serde attributes and no custom serde except exact scalar codecs (rationals, date/time strings, decimal strings). JSON shape for show / run / SDK documents lives only in lemma::api.

Structs§

CalendarResult
LemmaType
LiteralValue
MeasureUnit
NamedBound
Unit-scoped bound { value, unit } (decimal magnitude + unit name).
PathSegment
One uses hop on a Show data or rule path.
RangeResult
RatioUnit
RationalFactor
Exact rational factor as reduced numer/denom integer strings.
Response
RuleResult
Rule result JSON: flattened value fields, no rule/veto_detail.
RuleResultValue
ShowBranch
ShowRule

Enums§

ListKey
How a list addresses its rows: by row number, or by the ordered -> key fields.
MeasureTrait
ShowConversionTarget
ShowExpression
Resolved expression on a Show rule branch.
ShowListCommand
Postfix list command on Show.
SortDirection
TypeDefiningSpec
TypeExtends
TypeSpecification
ValueKind
Externally tagged value payload matching today’s ValueKind Serialize shape.

Functions§

evaluate_data_value_from_json_value
Parse one JSON value into a EvaluateDataValue. JSON null means omit: Ok(None). A null list item is a request error: a list has no unsupplied row.
measure_pattern
pattern for a measure value.
number_pattern
pattern for a number value.
parse_evaluate_data_object
Optional data object from MCP / HTTP JSON → overlay tree for crate::Engine::evaluate. null / omitted → empty map. Non-object → error. JSON null values are omitted.
ratio_pattern
pattern for a ratio value.
resolve_evaluate_rules
MCP rules / HTTP query ?rule= — one name, a JSON array of names, or omit (all).
row_def_name
LemmaRow_ plus the row spec identity, injectively escaped to [A-Za-z0-9_-] (a valid OpenAPI component name): _ becomes __, any other character _<hex code point>_. One name per identity, so documents of different specs agree on shared row specs.
show_document
The Show document: a Draft 2020-12 JSON Schema for the spec’s evaluation-data inputs.