Skip to content

Wire specification & derivation semantics

This is the authoritative index for the Mateu wire: the JSON contract a backend produces and a renderer consumes, plus the derivation semantics — the rules that turn a declared model into that wire. It exists so a re-implementer (a new renderer, or an alternate producer) can reproduce the behaviour, not just the shape. It gathers and points at the normative sources rather than restating them, so there is one contract, not several drifting copies.

See also: Renderer contract (what a renderer must do), Bring your own design system, and Portability & exit strategy.

  • Current wire version: 3.0. Every response envelope carries it as wireVersion (see below), so a consumer can guard against a mismatched producer.
  • Compatibility policy: additive within a major. New optional fields and new component types may be added without bumping the major; a consumer must ignore unknown fields and unknown component types gracefully (render a placeholder, keep going). The major version bumps only on a breaking change to existing wire shape or semantics.
  • Every first-party renderer checks it (web/Vaadin, Redwood, React Native, IntelliJ): the same major is accepted whatever the minor; another major shows the user one plain message — “This app’s server speaks Mateu wire 4.x; this renderer supports 3.x…” — and rendering goes on (unknown fields and types are still tolerated). A response without wireVersion is accepted.
  • Freeze-and-pin is the supported migration stance: if you build against the wire (an alternate renderer, or an extraction), pin the wireVersion you targeted; that snapshot is a stable contract.
  • The published JSON Schemas (below) are the machine-readable half; this page is the normative prose for the parts a schema cannot express (behaviour).

One endpoint, same shape on every framework and language:

POST /{baseUrl}/mateu/v3/sync/{route} // route in the PATH; "_no_route" when empty
Body: {
"route": "/...", // "" for the root
"actionId": "" | "<methodName>", // "" = the route load
"componentState": { ... },
"appState": { ... }, "parameters": { ... }, "consumedRoute": "...",
"serverSideType": null, "initiatorComponentId": null
}
  • This is the endpoint every first-party renderer sends its requests to, and the one to build against (streamed actions use POST /{baseUrl}/mateu/v3/sse/{route} with the same body). The route in the path is informative; the body decides.
  • The response is a UIIncrementDto (the envelope). The v3 in /mateu/v3/sync/… is a route path segment, not the schema version — the schema version is wireVersion in the payload.
  • The route load is dispatched as actionId: "" (empty), not "__load__" — both are treated as idempotent reads. See the transport notes in Slow connections.
  • SSE variants stream partial increments for long tasks; each streamed frame is a UIIncrementDto.

Two HTTP headers travel next to the payload. They are not part of UIIncrementDto (so neither the schema nor the conformance corpus covers them), but every first-party backend and renderer implements them:

HeaderDirectionValueMeaning
X-Mateu-Buildresponse, on every response of a path with a /mateu/ segment — refusals (403) and errors includedopaque, [A-Za-z0-9._-]{1,64}fingerprint of the deployed UI: the same on every replica of one release, different when a screen changes. Compare for equality only. Replaced by the setting mateu.build-id / MATEU_BUILD_ID
X-Mateu-Rendererrequest, on Mateu sync/SSE calls only (never on third-party REST sources)<name>/<version> wire/<major>.<minor>, e.g. vaadin/0.0.15 wire/3.0which renderer calls, and the wire it was built for. A server logs one WARN per distinct value of another wire major and never refuses the request

A consumer keeps, per backend (the URL up to the /mateu/ segment), the first build it saw as its baseline. A later response with another build means the app was deployed again; a Mateu 403 refusal carrying another build means the screen the request came from no longer exists in that form (a removed action, a renamed view model) — a stale screen, not a permission problem. With CORS enabled, X-Mateu-Build is listed in Access-Control-Expose-Headers. See Versions across teams and deployments.

FieldMeaning
wireVersionWire protocol version this payload conforms to (e.g. "3.0"). Always present.
commandsClient commands to run (SetWindowTitle, navigateTo, PushStateToHistory, CloseModal, DispatchEvent, MarkAsClean/MarkAsDirty, …).
messagesToasts / alerts (may be undoable).
fragmentsPartial UI updates (UIFragmentDto: targetComponentId, action = Replace/Add/ReplaceKeepData, component, state, data). Overlays (dialog/drawer) arrive as Add; a state-only refresh arrives as ReplaceKeepData, which keeps the component’s existing state and data instead of wiping them.
banners + appendBannersPage banners; append vs replace.
appData / appStateApp-level data / merged app state.

The three “effects” a producer can return from an action reduce to this envelope: route change (a command), ui-delta (fragments), data (fragment data/appData), and commands. A returned Step/List<Step> (the flow language) lowers 1:1 to commands — it is behaviour, not a view.

Every schema is generated from the records and pinned by a test, and served from the repository (raw files on master — the URLs editors and the starters point at):

The wire — what a server sends and a renderer reads:

  • wire-schema.json — the response envelope (UIIncrementDto) and everything reachable from it: every component metadata type (type-discriminated), every trigger, command, message, fragment and option, plus the request body (RunActionRqDto). Derived from the mateu-dtos records through Jackson’s own introspection, so it lists exactly the members that travel. It is open (unknown members are allowed — a reader must ignore them) and requires nothing but the type discriminator, because a member at its default may be absent (see Normalisation). Its test (WireSchemaTest) fails on an added member until the schema is regenerated, and fails on a removed, renamed or retyped member even when regenerating: that is a breaking change and needs a wire major.
  • One discriminator is not a bare name, on purpose: a page/form KPI (PageDto.kpis, FormDto.kpis) travels as "type": "KPIDto" — the DTO’s class name — while every other type is its bare name ("Form", "App", "Crud"…). It is not registered under a name of its own, the .NET and Python ports emit the same string, the renderers read it, and it is frozen with the rest of the wire: do not “fix” it to "KPI" within a wire major.

The authoring surface — what an author writes in YAML/JSON:

The authored YAML keys are the record components (no sugar the schema does not describe). Wire-plumbing types (ServerSideComponent, ModelViewComponent, PageView) are intentionally excluded from the authoring surface — they appear in the wire schema instead.

Normalisation (what is normative vs. noise)

Section titled “Normalisation (what is normative vs. noise)”

A member at its type’s zero value — null, [], {}, false, 0, "" — may be omitted, and a reader MUST treat an absent member exactly like that zero value. Producers legitimately differ here (the Java backend sends every member; the .NET and Python ones omit most defaults), and both are conformant. The wire schema therefore requires nothing but the type discriminator.

Exception — members whose zero is meaningful. For these the absent value is a NON-zero default, so a producer MUST send false/0 explicitly, and a reader MUST NOT read an absent one as zero:

MemberAbsent meansZero means
MessageDto.duration (also CarouselLayoutDto.duration)the renderer’s default timeouta sticky toast (every error message is sent with 0)
MenuOptionDto.visiblevisiblehidden
DetailsDto.opened, FaqItemDto.open, FoldoutPanelInfoDto.openopenclosed
CrudlDto.searchable, RecordSwitcherDto.searchablea search boxno search box
HeroSectionDto.centered, ContentLayoutDto.asideStickytruefalse
AutoSaveTriggerDto.debounceMillis800 msno debounce

A new member whose zero is meaningful must be added to this table and to the conformance runners’ MEANINGFUL_ZERO set in the same change.

The conformance corpus defines the canonical normalisation both producers and the reference apply before comparing:

  • Drop server-invented ids (not an action’s id — that is the name the client sends) and members at their default, keeping the members of the table above at false/0.
  • Mask the error boundary’s per-request reference (Reference: <ref>).
  • Sort object keys.
  • Keep everything that says what the screen is: types, field ids, labels, data types, actions, layout structure — and scalar envelope fields such as wireVersion.

If two producers normalise to the same tree for the same fixture, they are wire-equivalent. This corpus (conformance/cases/*) is the executable half of this spec: first loads and second requests (an action’s messages and commands, an overlay, a rejected save, an error-boundary answer, a wizard’s second step, a CRUD’s new/edit/view forms, a search).

Derivation semantics (behaviour a schema cannot express)

Section titled “Derivation semantics (behaviour a schema cannot express)”

These are the rules that turn a declared model into the wire. They are normative: a producer that wants to be wire-equivalent must reproduce them. The authoritative write-ups are linked; the key thresholds are inlined so a re-implementer does not have to reverse-engineer them.

@AutoLayout infers structure from the amount/shape of declared data; explicit annotations always win.

  • Field weight units: textarea/richText/html/markdown/image/uploadableImage = 4; grid = 6; radio/checkbox = 2; array/component = 6; else 1.
  • Fold-optionals: editable form, single unnamed section, no tab/inline/composition/component fields, weight > 16, ≥1 required and ≥4 optional → optionals collapse into a one-panel accordion (“More options”).
  • Sections → tabs: read-only view, ≥5 sections, total weight ≥ 30, no sticky section and no explicit @Toc → one tab per section.
  • Small enum → radio: an enum with ≤4 constants renders as radio buttons (@UseRadioButtons forces it at any size).
  • TabLayout carries groupRelationship (alternative/sequential/simultaneous) and adaptable (renderers may degrade tabs to an accordion on narrow viewports without losing disclosure semantics).

A component declares a portable sizing intent (hug / fill / fixed:<len>); a listing infers fill. In the responsive grid a track’s size is the sizing intent: hug = auto, fixed = px, fill = fr. The renderer applies it to the component’s host (a fill child takes remaining height and scrolls internally).

  • pageType (landing/collection/detail/form/process/dashboard) is on every page: @PageTemplate (or a YAML definition’s pageType:) wins > archetype family > MetricCard field → dashboard > default form. A definition-only page that declares pageType: is wrapped in a ServerSide page carrying it (a bare layout has nowhere to put it); the browser expander of a specsOnly bundle stamps it on the root component instead (pageTypeOf reads either).
  • pageWidth (fixed/fullWidth/edgeToEdge): @PageWidth on the view wins > PageWidthSupplier

    null (renderer infers from type/content).

  • labelsAside is inferred per form: aside only when single-column AND ≥6 fields AND all labels ≤20 chars AND all single-line widgets; @FormLayout(labelsAside=…) overrides.
  • Capability model: a listing declares inputs (Searchable, Filterable<F>) and implements interactions (Navigable, Editable, Creatable, Deletable); gates canView/canEdit/canCreate/ canDelete decide which routes/buttons exist. gridLayout() = auto(→table)/table/list/cards/ masterDetail/tree.
  • A filter field counts as SET only when its value differs from a freshly-constructed instance of the filters class (untouched fields keep initializers/defaults). Strings match by case-insensitive containment; other basics by equality; free-text search is word-based (every whitespace-separated word must be contained, case-insensitive, any order).
  • Range/multi-select conditions travel as FilterCriterion(field, operator, values) (between/ gte/lte/in), built from <field>_from/<field>_to keys and value lists; temporal → dateRange, @RangeFilter numerics → numberRange, enums → multiSelect (under AutoCrud’s crud-filter semantics).
  • Totals & grouping: @Aggregate/@GroupBy → ListingData.aggregates/groups + CrudlDto.groupBy; the group column becomes the implicit primary sort; marker rows are excluded from selection/click/edit.

State coercion (round-trip) — the JS client integerises whole doubles

Section titled “State coercion (round-trip) — the JS client integerises whole doubles”
  • Numeric widening: any Number widens into the target numeric field type on both read and write (a Double field’s 343.0 arriving as 343 must not reset the field).
  • Holder fields are excluded from state: fields typed Callable/Supplier/Runnable/Component are dropped on write and skipped on read (initializers survive) — no @JsonIgnore needed.
  • Routes are relative to the mount. Resolution merges authored (routes.yaml / code suppliers) over derived (annotations); authored wins and short-circuits.
  • Parameter precedence (identical on server and in the browser): fixed > client state > path > query > defaults. Fixed params are re-applied server-side, never trusted from the client.

A surface references a named endpoint by ref; the catalogue travels separately (AppDto.restSources live, or once in manifest.json for a bundle). A source gives selection, not transformation (itemsPath, totalPath, fields name→path, valuePath/labelPath, resultPath). proxy is read off the resolved source, server-side, and is the only channel that injects ${secret.KEY}.

Behaviour bus — triggers → actions, events

Section titled “Behaviour bus — triggers → actions, events”

Triggers reference an action by id; an action carries confirm + effects. Components communicate over an abstract pub/sub bus: UICommand.dispatchEvent emits, @SubscribeTo/@Emits subscribe (scopes DOCUMENT/COMPONENT/SELF). This is not the DOM event system — it is a logical bus a renderer must provide.

The wire is self-describing, so it is not only a rendering protocol — it is an agent-operation protocol. An MCP (Model Context Protocol) server is “a renderer of agents”: same self-describing model, tools instead of pixels. The rules below are normative so every host (the frontend/mcp-server/ sidecar and the native endpoint) produces the same projection, exactly like the derivation rules above are shared by every renderer.

The projection — a UIIncrementDto deep-walked into a flat, agent-friendly screen:

ProjectedDerived from
titleSetWindowTitle command → else Page.pageTitle/title → else the listing’s title.
route, serverSideType, pageTypethe primary ServerSide component node.
fields[] {id,label,dataType,stereotype,required,readOnly,value,options?}every FormField metadata node, de-duplicated by fieldId, declaration order. value from the fragment state (else the ServerSide.initialData).
actions[] {id,label,shortcut?,confirmationRequired?}ServerSide.actions[].id; label enriched from a Button whose actionId matches. RBAC is already applied server-side — an action a token may not run never reaches the wire, so it never appears as a tool.
listing? {title,searchable,columns,filters,rows?,totalElements?,pageNumber?,pageSize?}a Crud metadata node (Crudl is accepted too); rows and the paging numbers from the first fragment data entry carrying a page.content (the answer of a search), without the renderer’s _rowNumber.
messages[], commands[]UIIncrementDto.messages; and non-SetWindowTitle commands (e.g. navigateTo) surfaced so the agent sees navigation/effects.

The request mapping — a tool call becomes a sync request (see The exchange):

  • mateu_describe_screen(route) → load: actionId: "". When the answer is an app shell (an App component aimed at the route), the host follows it to the content it loads — homeRoute / homeConsumedRoute / homeServerSideType, the request the shell’s own content area sends — and again through a CRUD mediator, so the agent is given the screen, not the shell. mateu_run_action and mateu_search are sent where that screen lives (its route, consumed route and serverSideType).
  • mateu_list_routes() → the routes of the root answer’s App menu (each option’s route, captioned by its label).
  • mateu_run_action(route, actionId, componentState) → the action; componentState seeds/overrides fields.
  • mateu_search(route, searchText, filters) → the search action; filters and the searchText travel in the componentState, where the listing reads them (as the search box writes them).

Two transport gotchas (verified against a live backend, both belong to the contract):

  • consumedRoute says how much of the route an app shell has already taken, and null and "" are different requests: null (the server reads it as "_empty") is a fresh load — under an app shell it answers the shell, aimed at the route —, while "" is a content load, answered with the screen itself (what the shell asks next, and what a caller that wants the page, not the chrome, sends — see Build UIs with AI).
  • the server encodes the root/empty route as "_empty" on the wire; a host normalizes it to "".

The authoring tools (the phase-B half: an agent writing a screen rather than operating one) ride two reserved sync actions, so the sidecar and the native endpoint share one implementation per backend and the caller’s identity and the route’s access rules apply as to any action:

  • __validate__ — parameters._yaml = a YAML definition; the answer carries the validation report on appData._validation ({valid, kind, errors[], warnings[]}, each issue {code, message, path, line?, column?}) and renders nothing. mateu_validate_uidl is this call. Served only to an MCP tool call, or by an app running with mateu.mcp.enabled=true or in dev mode (mateu.dev=true; .NET MateuOptions.Mcp / development, Python mcp=True / dev=True): anywhere else it answers 403, so a production app does not hand anonymous callers a validator over its own catalogues. The sidecar’s authoring tools therefore need the backend in one of those modes.
  • __preview__ — the same text rendered as the page it describes (layout only, no view model); mateu_preview_uidl validates first and projects this answer with the rules above. A text that does not parse now renders the reason (Invalid YAML — line N (path): …), not a bare “invalid”. It stays open on every app — it is the render target of the chat’s and live push’s render-screen and of the IDE’s visual editor — and is safe to be: the 256 KiB cap applies before parsing, every component of the catalogue previews with nothing set (an absent child list is an empty one), and a failure in it, as in every reserved action, answers through the error boundary (the generic message + reference), never a raw 500.

The validation rules (scalar typing, root classification, the walk, the message texts, the semantic checks) and the tool/resource surface are normative and live with their corpus in conformance/mcp/README.md + conformance/mcp/authoring.json, pinned by the four implementations.

Two hosts, one projection. The sidecar (frontend/mcp-server/, zero-dependency Node) speaks only this wire, so it operates a Java, .NET or Python backend with no backend change. The native endpoint serves the same projection from MateuService directly, enforcing RBAC natively. Reference implementation + the tool surface: frontend/mcp-server/README.md in the repository.

An MCP caller can also send UI to a UI that is open (the phase-C half). Additive wire, all of it:

  • AppDto.agentPush: true — push is on (mateu.mcp.enabled + mateu.mcp.push.enabled); only then does the UI open its channel and offer “Connect AI”.
  • Three app-level actions (the app’s serverSideType, exempt from menu resolution, like _live-updates), each with parameters: {sessionId, secret}: _agent-channel (+ route, renderer) over the SSE endpoint — an open-ended stream, a first increment with the session’s status, one increment per message, an empty increment every 20 s, the end after 5 minutes (the UI reconnects); _agent-pair → Data{_agentPairing: {code, expiresInSeconds}}; _agent-unpair → Data{_agentPairing: null}. sessionId is the UI’s per-tab session id (the web’s X-Session-Id, which the chat sends as its sessionId too); secret is random, generated by the UI and kept with the session id.
  • A new command type AgentPush, data {kind, event, detail}:
kindeventdetail
statusmateu-agent-status{paired, agents: [label…]} — the UI updates its Connect AI control
renderrender-screen{yaml, target: content|drawer|dialog, title?} — applied like the chat’s render-screen
navigatenavigation-requested{route, consumedRoute, actionId?, baseUrl?, serverSideType?, uriPrefix?}
eventthe event’s namethe event’s detail

The events are the chat stream’s catalogue (AI chat → the event catalogue), so a UI applies a pushed message with the code that applies the chat’s. Addressing, pairing and limits are normative in conformance/mcp/README.md (“Live UI push”) and pinned by conformance/mcp/push.json; the user-facing guide is Agent operability → Drive a live UI.

A renderer’s coverage is measured, not asserted, by the harness in e2e/conformance.* against shared fixtures, at three levels — Core / Standard / Full. The producer side is pinned by the wire conformance corpus (conformance/cases/*), run by all three backends (WireConformanceTest / test_wire_conformance.py / WireConformanceTests). Passing the corpus at a wire version is the definition of “wire-equivalent at that version”.

Deliberately outside the contract, and relegated so they are never the entry cost: run-js, an arbitrary custom web-component behind a custom field or renderer, and a ComponentAdapter that renders a non-Mateu object. A renderer may decline these and still be Core/Standard conformant; they do not travel as portable data the way the declared model does. See Escaping the framework.