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.
Status and versioning
Section titled “Status and versioning”- Current wire version:
3.0. Every response envelope carries it aswireVersion(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
wireVersionis accepted. - Freeze-and-pin is the supported migration stance: if you build against the wire (an alternate
renderer, or an extraction), pin the
wireVersionyou 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).
The exchange
Section titled “The exchange”One endpoint, same shape on every framework and language:
POST /{baseUrl}/mateu/v3/sync/{route} // route in the PATH; "_no_route" when emptyBody: { "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). Thev3in/mateu/v3/sync/…is a route path segment, not the schema version — the schema version iswireVersionin 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.
Transport headers
Section titled “Transport headers”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:
| Header | Direction | Value | Meaning |
|---|---|---|---|
X-Mateu-Build | response, on every response of a path with a /mateu/ segment — refusals (403) and errors included | opaque, [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-Renderer | request, 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.0 | which 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.
The envelope — UIIncrementDto
Section titled “The envelope — UIIncrementDto”| Field | Meaning |
|---|---|
wireVersion | Wire protocol version this payload conforms to (e.g. "3.0"). Always present. |
commands | Client commands to run (SetWindowTitle, navigateTo, PushStateToHistory, CloseModal, DispatchEvent, MarkAsClean/MarkAsDirty, …). |
messages | Toasts / alerts (may be undoable). |
fragments | Partial 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 + appendBanners | Page banners; append vs replace. |
appData / appState | App-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.
The machine-readable schemas
Section titled “The machine-readable schemas”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 themateu-dtosrecords 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 thetypediscriminator, 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:
uidl-schema.json— the component catalog.routes-schema.json— the route registry (routes.yaml).sources-schema.json— the REST source catalogue (sources.yaml).specs-schema.json— the unifiedspecs/ui/**schema (aoneOfof every kind).
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)”Absent == default
Section titled “Absent == default”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:
| Member | Absent means | Zero means |
|---|---|---|
MessageDto.duration (also CarouselLayoutDto.duration) | the renderer’s default timeout | a sticky toast (every error message is sent with 0) |
MenuOptionDto.visible | visible | hidden |
DetailsDto.opened, FaqItemDto.open, FoldoutPanelInfoDto.open | open | closed |
CrudlDto.searchable, RecordSwitcherDto.searchable | a search box | no search box |
HeroSectionDto.centered, ContentLayoutDto.asideSticky | true | false |
AutoSaveTriggerDto.debounceMillis | 800 ms | no 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.
What the conformance corpus compares
Section titled “What the conformance corpus compares”The conformance corpus defines the canonical normalisation both producers and the reference apply before comparing:
- Drop server-invented
ids (not an action’sid— that is the name the client sends) and members at their default, keeping the members of the table above atfalse/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.
Layout inference — layout-inference
Section titled “Layout inference — layout-inference”@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 (
@UseRadioButtonsforces it at any size). TabLayoutcarriesgroupRelationship(alternative/sequential/simultaneous) andadaptable(renderers may degrade tabs to an accordion on narrow viewports without losing disclosure semantics).
Sizing — hug / fixed / fill
Section titled “Sizing — hug / fixed / fill”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).
Page type & width — page-templates
Section titled “Page type & width — page-templates”pageType(landing/collection/detail/form/process/dashboard) is on every page:@PageTemplate(or a YAML definition’spageType:) wins > archetype family >MetricCardfield → dashboard > defaultform. A definition-only page that declarespageType:is wrapped in aServerSidepage carrying it (a bare layout has nowhere to put it); the browser expander of aspecsOnlybundle stamps it on the root component instead (pageTypeOfreads either).pageWidth(fixed/fullWidth/edgeToEdge):@PageWidthon the view wins >PageWidthSuppliernull (renderer infers from type/content).
labelsAsideis inferred per form: aside only when single-column AND ≥6 fields AND all labels ≤20 chars AND all single-line widgets;@FormLayout(labelsAside=…)overrides.
Listings, filters & criteria — filters-and-listing
Section titled “Listings, filters & criteria — filters-and-listing”- Capability model: a listing declares inputs (
Searchable,Filterable<F>) and implements interactions (Navigable,Editable,Creatable,Deletable); gatescanView/canEdit/canCreate/ canDeletedecide 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>_tokeys and value lists; temporal →dateRange,@RangeFilternumerics →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
Numberwidens into the target numeric field type on both read and write (aDoublefield’s343.0arriving as343must not reset the field). - Holder fields are excluded from state: fields typed
Callable/Supplier/Runnable/Componentare dropped on write and skipped on read (initializers survive) — no@JsonIgnoreneeded.
Route resolution & parameter precedence — route-registry
Section titled “Route resolution & parameter precedence — route-registry”- 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.
Agent operability — the MCP projection
Section titled “Agent operability — the MCP projection”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:
| Projected | Derived from |
|---|---|
title | SetWindowTitle command → else Page.pageTitle/title → else the listing’s title. |
route, serverSideType, pageType | the 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 (anAppcomponent 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_actionandmateu_searchare sent where that screen lives (its route, consumed route andserverSideType).mateu_list_routes()→ the routes of the root answer’sAppmenu (each option’sroute, captioned by itslabel).mateu_run_action(route, actionId, componentState)→ the action;componentStateseeds/overrides fields.mateu_search(route, searchText, filters)→ thesearchaction;filtersand thesearchTexttravel in thecomponentState, where the listing reads them (as the search box writes them).
Two transport gotchas (verified against a live backend, both belong to the contract):
consumedRoutesays how much of the route an app shell has already taken, andnulland""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 onappData._validation({valid, kind, errors[], warnings[]}, each issue{code, message, path, line?, column?}) and renders nothing.mateu_validate_uidlis this call. Served only to an MCP tool call, or by an app running withmateu.mcp.enabled=trueor in dev mode (mateu.dev=true; .NETMateuOptions.Mcp/ development, Pythonmcp=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_uidlvalidates 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’srender-screenand 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.
Live UI push
Section titled “Live UI push”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 withparameters: {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}.sessionIdis the UI’s per-tab session id (the web’sX-Session-Id, which the chat sends as itssessionIdtoo);secretis random, generated by the UI and kept with the session id. - A new command type
AgentPush, data{kind, event, detail}:
| kind | event | detail |
|---|---|---|
status | mateu-agent-status | {paired, agents: [label…]} — the UI updates its Connect AI control |
render | render-screen | {yaml, target: content|drawer|dialog, title?} — applied like the chat’s render-screen |
navigate | navigation-requested | {route, consumedRoute, actionId?, baseUrl?, serverSideType?, uriPrefix?} |
event | the event’s name | the 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.
Conformance
Section titled “Conformance”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”.
What is NOT normative (escape hatches)
Section titled “What is NOT normative (escape hatches)”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.