Juli4nG/elm-json-render/3.0.0

JsonRender

A native, fail-closed Elm renderer for json-render manifests, pinned to @json-render/core v0.19.0.

This top module is the convenience entry point: validate a manifest fail-closed, and get an error stub for the failure path. The renderer itself (a small TEA component: Model / Msg / Effect / update / view) lives in JsonRender.Render; the typed spec model in JsonRender.Spec; the expression dialect in JsonRender.Expr.

Typical host wiring:

case JsonRender.decodeValue manifestJson of
    Ok spec ->
        -- mount the renderer, feeding host options + host-owned state
        Html.map RendererMsg (JsonRender.Render.view options spec hostState rendererModel)


    Err message ->
        JsonRender.errorStub message

Decoding is the security gate: an off-catalog component type, a malformed prop, a dangling child key, or a missing root all produce Err, never a partial tree.

Validate a manifest

decodeValue : Value -> Result String Spec

Validate an already-parsed JSON Value into a Spec, fail-closed. Err carries a human-readable diagnostic.

decodeString : String -> Result String Spec

Validate a raw JSON string into a Spec, fail-closed.

Failure path

errorStub : String -> Html msg

The fail-closed failure view: a self-contained error stub the host renders instead of a manifest that did not validate. Never a partial tree.

It prints the decoder's diagnostic verbatim, which suits a developer host and does not suit an end user. A host with a real audience should classify the failure with Spec.errorKind and write its own copy instead. This stays the right default for a host that has none.