Skip to main content

Module expression

Module expression 

Source
Expand description

Server-side expression resolver for v2 JSON-UI Specs.

Walks every Element.props in a spec’s flat element map and substitutes two narrow expression object shapes against Spec.data:

  • {"$data": "/slash/path"} — replaced with the JSON value at the path, preserving type. Missing paths resolve to Value::Null.
  • {"$template": "literal {/path} more"} — replaced with a Value::String built by substituting every {slash-path} placeholder via resolve_path_string. Missing placeholders interpolate to "".

Infallible: malformed expressions (non-string value, sibling keys) degrade to literal JSON — no panic, no log, no Result.

Single-pass: expressions inside resolved $data output are NOT re-resolved. This is the inner-platform-effect firewall (Phase 118 D-07).

Scope: only el.props is walked. Spec.data, Spec.title, Spec.layout, el.children, el.action, el.visible are untouched.

Pipeline order: must run after resolve_actions and before Catalog::validate (Phase 118 D-08).

Functions§

resolve_expressions
Resolve every $data and $template expression in spec.elements[*].props.