Architecture maps
render_architecture draws an architecture map from a merlion-architecture/1 JSON spec: zones and items placed by the author on a grid of columns, zones nested inside zones with their members flowing into columns, and flows routed orthogonally through the gutters between them. It draws the genre of vendor reference architectures: stage columns, a platform boundary with header bars, dashed panels, icon lists and cards, numbered steps, a feedback flow around the map, and highlighted-path variants of one base map. Output follows the shared SVG contract (svg-output.md): one self-contained SVG, labels as <text>, colours as CSS custom properties, role="img" with <title> and <desc>, no script, and byte-identical bytes from the native core and WASM. ADR-0019 records why architecture maps take their own JSON spec.
The input rules are those of chart and layer-map specs (chart.md), read by the same JSON reader:
- The input is one UTF-8 JSON document (RFC 8259) of at most
limits.input_bytes(1 MiB); a larger one fails withE004. - Invalid JSON, nesting deeper than
limits.nesting(64), an object with more than 64 members, an array with more than 10,000 items, and a duplicate member name in one object fail withE020at the byte where reading stopped. - A member the spec does not define fails with
E021naming its JSON Pointer path (/items/3/colour), so a misspelt member never draws a different map. - Every spec error carries its line, column and byte span in the input.
| Member | Type | Required | Meaning |
|---|---|---|---|
architecture |
the number 1 |
yes | Format version |
title |
text, 1–200 characters | yes | The map’s accessible name, written into <title>. The map draws no visible title |
description |
text, 1–2,000 characters | no | The second line of the outline and <desc> |
columns |
array of 1–16 columns | yes | The top-level grid’s columns, left to right |
zones |
array of 0–64 zones | no | Boundaries, panels and layout containers |
items |
array of 1–1,000 items | yes | Components |
flows |
array of 0–500 flows | no | Arrows between items, zones and columns |
views |
array of 0–16 views | no | Highlighted paths over the same map (Views) |
A column:
| Member | Type | Required | Meaning |
|---|---|---|---|
id |
id | yes | Names the column in at.column and as a flow end |
title |
text, 1–80 characters | no | Drawn in the header strip above the grid |
separator |
"dashed" |
no | A dashed rule in the gutter before this column, as before a side rail. Column 0 has no gutter before it and fails with E026 |
A zone:
| Member | Type | Required | Meaning |
|---|---|---|---|
id |
id | yes | The zone group’s data-merlion-id |
title |
text, 1–80 characters | no | The zone’s title |
header |
"bar", "plain" or "none" |
no | bar draws the title in a filled strip across the zone’s top; plain draws it at the top-left; none draws no title. Default plain with a title, none without. bar and plain without a title fail with E021 |
style |
"solid", "dashed", "filled" or "none" |
no | The zone’s box (Zones). Default solid. none is an invisible layout container |
role |
role name | no | A cluster role (Roles) |
icon |
icon name | no | A badge at the centre of the zone’s top edge (Icons) |
cols |
whole number, 1–8 | no | Member columns; members flow into them in order. Default 1 |
at |
cell | one of at, in |
A top-level cell |
in |
zone id | one of at, in |
The zone this zone is a member of |
span |
whole number, 1–8 | no | Member columns this zone covers inside its zone; only with in. Default 1 |
An item:
| Member | Type | Required | Meaning |
|---|---|---|---|
id |
id | yes | The item group’s data-merlion-id |
label |
text, 1–80 characters | yes | The item’s name |
detail |
text, 1–400 characters | no | Drawn below the label in smaller, muted text |
icon |
icon name | no | A built-in glyph (Icons) |
form |
"chip", "icon", "row", "card" or "list" |
no | How the item draws (Item forms). Default chip |
shape |
"box", "store" or "pill" |
no | The outline: a rounded box, a cylinder, a stadium. A chip defaults to box; the other forms draw no outline unless shape is set |
role |
role name | no | A node role (Roles) |
list |
array of 1–12 texts, each 1–80 characters | with form: "list" |
The entries of a list item. list on another form, and form: "list" without list, fail with E021 |
check |
boolean | no | List entries draw a check mark instead of a bullet; only with form: "list" |
at |
cell | one of at, in |
A top-level cell |
in |
zone id | one of at, in |
The zone this item is a member of |
span |
whole number, 1–8 | no | Member columns this item covers inside its zone; only with in. Default 1 |
A cell places a top-level zone or item on the grid:
| Member | Type | Required | Meaning |
|---|---|---|---|
column |
whole number 0–15, or a column id | yes | The first column |
span |
whole number, 1–16 | no | Columns covered. Default 1 |
row |
whole number, 0–63 | no | The first row. Default 0 |
rows |
whole number, 1–64 | no | Rows covered. Default 1 |
A flow:
| Member | Type | Required | Meaning |
|---|---|---|---|
id |
id | no | The flow group’s data-merlion-id; lets a view light it |
from, to |
item, zone or column id | yes | The ends. A zone or column end attaches to that rect’s side, not to a member |
label |
text, 1–80 characters | no | A label chip on the flow |
step |
whole number, 1–99 | no | A numbered badge on the flow |
note |
text, 1–200 characters | no | The step’s legend entry. A note without a step fails with E021 |
style |
"solid" or "dashed" |
no | Default solid |
both |
boolean | no | Arrowheads at both ends |
around |
"top" or "bottom" |
no | Routes outside the whole grid, on that side |
A view:
| Member | Type | Required | Meaning |
|---|---|---|---|
id |
id | yes | Named by the view render option |
title |
text, 1–80 characters | yes | Added to <title> and the outline when the view is drawn |
lit |
array of 1–2,000 item, zone or flow ids | yes | What the view lights (Views) |
Placement
Section titled “Placement”- A top-level zone or item takes
atand noin; a member takesinand noat. Both, or neither, fail withE021.spanon a top-level element fails withE021: a top-level cell spans withat.span. - A cell outside the columns (
column ≥ columns,column + span > columns, orrow + rows > 64) fails withE026at the cell’s path. Two top-level cells that share a grid position fail withE026at the later one, naming the earlier one’s path. - A zone’s members are the zones whose
innames it, inzonesorder, then the items whoseinnames it, initemsorder. A zone with members and items to interleave nests the items in astyle: "none"zone. - Members flow row-major into the zone’s
colscolumns: each takesspancolumns at the next free position of its row, and a member that does not fit in the row’s remaining columns starts the next row. Aspanwider than the zone’scolsfails withE026. - Zones nest at most 4 deep: a top-level zone is depth 1. Deeper nesting, and an
inchain that returns to a zone it left, fail withE026. - The top-level cells are drawn zones first, then items, each in array order.
- An id is 1–64 ASCII letters, digits,
-and_; anything else fails withE021. - Columns, zones, items, flows and views share one namespace: an id that an earlier element already uses fails with
E025at the later one, and the message names the earlier one’s path. - An id that
in,at.column,from,toorlitnames and no element of the right kind has fails withE027at that member’s path. Theviewoption naming no view fails withE027at/views. - A flow from an element to itself, and a flow between a zone or a column and an element inside it, fail with
E026.
Every text member is plain text, under the layer map’s rules (layer-map.md): no Markdown and no <br>; tab, line feed and carriage return count as spaces; runs of spaces collapse to one; leading and trailing spaces are dropped; other control characters and U+FFFE/U+FFFF are dropped; bidirectional formatting characters are stripped with W014; text empty after these rules fails with E021; length limits count characters after them.
Text is measured with the diagram font tables (text-measurement.md), and its drawn width is its measured width times the tolerance t of the font mode: 1.06 for system, 1 for link and embed. A text wrapped to a drawn width w breaks where its measured width would exceed w ÷ t.
| Text | Size and weight |
|---|---|
| Zone title, column title | font_size (default 14), SemiBold |
| Item label | T = 6/7 × font_size (12 at the default): SemiBold for chip, card and list, regular for icon and row |
| Item detail | 0.8 × T (9.6 at the default), regular, muted, below the label with the title + detail gap of svg-output.md |
| List entry, flow label, legend note | T, regular |
| Step number | T, SemiBold |
Item text is laid out once, at its form’s wrap width, and never rewraps; a zone title rewraps at its zone’s drawn width.
An icon names one of 26 built-in glyphs: api, app, catalog, chart, cloud, code, dashboard, database, file, folder, gear, globe, lock, model, notebook, pipeline, queue, search, server, shield, storage, stream, table, user, users, warehouse. A list item draws two more, a check mark in a circle and a bullet.
- Every glyph is an original outline drawn on a 24 × 24 grid from lines and circular or elliptical arcs, in absolute
M,L,H,V,AandZcommands only, and stays inside the grid. It copies no icon library. - A glyph is scaled to its drawn size and written as one inline
<path class="merlion-arch-icon">withfill="none",stroke="currentColor", acolorpresentation attribute,stroke-width="1.25"at every size, and round caps and joins. The SVG never uses<use>. - An icon draws in its item’s text colour, and a badge icon in its zone’s title colour.
- An unknown icon name is
W027at the member’s path, and the element draws no icon.strictmakes it an error. - Brand and product logos are not built in; they belong to the caller icon hook (svg-output.md).
Layout
Section titled “Layout”All sizes are in px at the default font_size of 14; text sizes scale with font_size, every other size is fixed. The target width W is target_width clamped to 240–20,000.
Item forms
Section titled “Item forms”| Form | Widest | Icon | Text | Outline |
|---|---|---|---|---|
chip |
160 | 14, left of the text, 4 before it | Centred | box |
icon |
112 | 32, centred above the text, 4 above it | Centred | none |
row |
148 | 16, left of the text, 6 before it | Left-aligned | none |
card |
112 | 32, centred above the text, 4 above it | Centred: the label as a title, the detail as a subtitle | none |
list |
148 | a 12 px marker left of each entry, 6 before it | Left-aligned: the label, then the entries, 4 below the label and 2 apart | none |
- An item’s text wraps at its form’s widest width less 6 of padding on each side and less the icon and its gap where the icon sits beside the text. The text block and the icon are centred vertically in the item.
- An item’s natural size is its text block plus its icon, plus 6 of padding on every side. A chip with a
storeoutline adds 10 above its text for the top cap. - An item takes its slot’s width and its natural height, at the top of its slot; no item stretches to fill a taller row. An item whose form draws no outline still has a transparent box that takes pointer events.
- No line of an item’s text lies outside the item’s box.
- A zone’s padding is 8 on every side. A
style: "none"zone has none, except 4 below its title when it draws one. - A
barheader is the title plus 4 above and below, across the zone’s full width, the title centred; aplainheader is the title 4 below the zone’s top and 8 from its left. The title wraps at the zone’s width, at least 96, less 8 on each side. - Titled zones that start in the same grid row, or sit in the same member row of a zone, share one header height: the tallest of their headers at their drawn widths, each title centred vertically in it. A zone’s natural height counts the shared header, so the row holds it.
- Members are 6 apart across and down. A member column is as wide as its widest single-column member; a spanning member, taken in order of span and then of position, widens the columns it covers by equal shares until they hold it. A member row is as tall as its tallest member.
- A zone’s natural width is its member columns, gaps and padding, at least its title plus 16; with a badge, at least 22 plus 16. Its natural height is its header, padding, member rows and gaps.
- A zone shares out width beyond its natural width equally among its member columns, and height beyond it equally among the member rows that hold a zone with members. Members sit at the top of their rows, and height that no such row takes stays below the last row, so a zone’s items pack at its top with the normal gap.
- A zone without members that draws a
barheader is the bar alone; any other zone without members is its header and padding. - A badge is a circle of radius 11 centred on the zone’s top edge, holding a 14 px icon.
The grid
Section titled “The grid”- Top-level cells are 16 apart across and down, and 24 apart before a column with a separator. The grid has 8 of room on each side, inside a margin of 2.
- A top-level zone fills its cell; a top-level item takes its cell’s width and its natural height at the cell’s top.
- A column is as wide as its widest single-column cell, and at least its title plus 8; a spanning cell, taken in order of span and then of position, widens its columns by equal shares until they hold it. A column with no cell and no title is 24 wide. Rows follow the same rule with heights, so cells in one row line up.
- When the grid’s natural width is below
W, every column widens in proportion to its natural width, each by at most 25% of it. When it is aboveW, the layout keeps its natural size and the SVG’sviewBoxscales it to its container. - When some column has a title, a header strip of the tallest title plus 4 above and below sits 8 above the grid; each titled column draws a header box as wide as the column, its title centred.
- A separator is a dashed rule (
4 4) down the middle of the gutter before its column, from the top of the header strip to the bottom of the grid. - The drawing is as wide as the grid, its outer room and margins, or the step legend when wider, and as tall as the grid, its outer room and margins, plus the legend.
Every gap between top-level cells, between members, inside a zone’s padding and around the grid is a gutter, and flows run along gutter midlines.
- Ports. A flow attaches at the midpoints of the sides that face the other end: left and right when one rect lies wholly beside the other, else top and bottom. When the facing sides overlap by 8 or more, both ports sit at the middle of the overlap, so the flow is straight. A flow with
aroundattaches at the middle of both rects’toporbottomsides. - Lattice. The lattice’s lines are every gutter’s midline and one line through each port, perpendicular to its side. A node or a segment of the lattice is open unless it lies inside an item, a zone’s header, a column’s header box or a zone’s badge, or inside or across a drawn zone (
styleother thannone) that holds neither end; a segment that crosses such a zone between two nodes outside it, as across a zone without members, is closed too. Astyle: "none"zone never blocks a flow. - Search. A route leaves its source port straight out to the first lattice node and enters its target port straight in from the first lattice node. Between them it is the cheapest path over open nodes and segments by Dijkstra’s algorithm, costing its length plus 32 per turn, with no reversal; equal costs break by the lower node index (rows of the lattice top to bottom, nodes left to right), then by direction in the order east, south, west, north. An
aroundflow routes from its source port to the outermost lane on its side, along that lane, and from it to its target port. - Tracks. Segments of different flows that overlap on one line take parallel tracks 4 apart: each, in flow order, takes the lowest track no overlapping earlier segment holds, and a group of overlapping segments is centred on the line. A port slides along its side with its track, and stays 2 inside the side’s ends.
- Gutter widths. A gutter is at least its base width, and widens to what the routes through it need: room for its tracks,
(n − 1) × 4 + 8forntracks; where an arrowhead ends,28 + (n − 1) × 4; where a label chip or a badge sits, its extent across the gutter plus 8, or along a flow that crosses the gutter its extent plus 28; in the gutter above a zone badge,30 + (n − 1) × 4, so its tracks clear the badge. Layout and routing run up to 4 times, each widening the gutters the last routes need; a gutter only widens, and the last pass is drawn. - Labels and badges. A flow’s label chip and step badge sit on its longest horizontal segment that holds them both, else on its longest segment, centred on its midpoint, the badge first and the chip 3 after it. A badge is a filled circle of radius 9 holding the step number.
- Fallback. A flow the lattice cannot connect draws as a direct path with one or two turns and reports
W028. - A route never crosses an item it does not join, a header, a badge, or a drawn zone that holds neither end; the acceptance tests check this on every fixture and synthetic map at three widths.
The step legend
Section titled “The step legend”Each flow with a note adds a legend entry, in step order and then flow order: a step badge, then the note 6 after it, wrapped at 320. Entries run left to right 16 apart, 8 below the grid’s outer room, and wrap to a new line 4 below when the next one would pass the right edge of the grid’s outer room; an entry wider than that room sits alone on its line.
The render option view (CLI --view <id>, WASM view) draws one view. Without it, everything draws normally.
- A view’s lit set: each listed item; each listed zone and everything inside it; each zone that holds a lit item or zone; each listed flow; and each flow whose ends are both lit, a column end counting as lit.
- Every element outside the lit set dims: the outermost unlit element of each branch carries the class
merlion-arch-dimandopacity="0.3", so opacity never compounds. Lit elements draw exactly as without the view. - The root carries
data-merlion-view="{id}",<title>is{title}: {view title}, and the id hash includes the view, so two views of one map on a page do not share an id. - One SVG is drawn per view, with no script. A switcher that changes views in the viewer is a later step.
A role is a class name matching [A-Za-z_][A-Za-z0-9_-]{0,63} (svg-output.md); another value fails with E021. Role classes carry presentation only.
- An item’s
roleaddsmerlion-c-{role}to its group; the built-in node roles (accent,ok,warn,danger,muted,store) draw as on a flowchart node, and tone the item’s icons too. - A zone’s
roleaddsmerlion-cc-{role}to its group. The built-in cluster roles (group,series-1…series-8) and the six tone roles draw at the cluster mix, as a sequence fragment’s do (sequence.md); the tone also colours the zone’s header bar, its filled box and its badge. - Automatic tones (svg-output.md): with
auto_toneon, top-level zone numbern(0-based, every top-level zone counted) without aroletakesseries-{n mod 8 + 1}andmerlion-auto. Nested zones, items and flows take no automatic tone.auto_tone: false,--no-auto-toneand the WASMautoTone: falseturn them off. - A stylesheet or page tone for a custom role reaches the box, the bar and the icons through
--merlion-tone, and a baked palette carries it (Palette).
- The root has
class="merlion merlion-architecture"anddata-merlion-architecture="1", nevermerlion-chart.<title>holdstitle;<desc>holds the outline (Text alternative). - Every flow’s arrowhead is the
{id}-arrowmarker of svg-output.md. - The SVG has no
<a>, no hover rules, nodata-merlion-layoutand no<use>.
Groups and data attributes
Section titled “Groups and data attributes”Titled zones are cluster groups, items node groups and flows edge groups, so every rule of svg-output.md and interaction.md that reads those classes reaches them unchanged. Groups appear in drawing order: the column headers, the separators, each top-level zone with its members nested inside it in member order, the top-level items, the flows in array order, then the legend.
| Element | Markup |
|---|---|
| Column headers | <g class="merlion-arch-columns"> holding a <g class="merlion-arch-column" data-merlion-id="…"> per titled column, with <rect class="merlion-arch-column-box"> and <text class="merlion-arch-column-title"> |
| Titled zone | <g class="merlion-cluster merlion-arch-zone merlion-arch-{style}">, then its role classes, and data-merlion-id. Its children are <rect class="merlion-cluster-box"> (radius 4; none for style: "none"), a header bar <path class="merlion-arch-bar">, the title <text class="merlion-cluster-title"> (also merlion-arch-bar-title in a bar), the badge <g class="merlion-arch-badge">, then its members |
| Untitled zone | The same with merlion-arch-untitled in place of merlion-cluster: the viewer names a cluster by its title |
| Item | <g class="merlion-node merlion-arch-item merlion-arch-{form}" data-merlion-id="…" data-merlion-rank="0"> plus its role class, holding <path class="merlion-shape"> (merlion-shape merlion-arch-bare when no outline is drawn), its icon paths, and one <text class="merlion-label"> |
| Flow | <g class="merlion-edge merlion-arch-flow" data-merlion-from="…" data-merlion-to="…"> with data-merlion-id when it has an id and data-merlion-step when it has a step, holding <path class="merlion-edge-path"> (also merlion-dotted when dashed), the label <g class="merlion-edge-label"> with <text class="merlion-edge-text">, and the badge <g class="merlion-arch-step"> |
| Separator | <path class="merlion-arch-separator"> |
| Legend | <g class="merlion-arch-legend"> holding a <g class="merlion-arch-legend-entry"> per entry: a step badge and <text class="merlion-arch-legend-text"> |
- An item’s label lines, detail lines and list entries form its one
.merlion-labeltext: each line is a<tspan>with its ownxandy; a detail line carriesmerlion-detailwith its measuredfont-size; a SemiBold line carriesmerlion-b; a line that continues a word broken at the wrap width carriesdata-merlion-join="true"(interaction.md). data-merlion-fromanddata-merlion-tohold the ends’ ids: an item, a zone or a column.- The SVG id is the
id_prefix, orm+ 8 hex of FNV-1a 64 over the spec text, the options key andarchitecture(with|view={id}when a view is drawn) (svg-output.md).
Embedded style
Section titled “Embedded style”The embedded style is the diagram style (svg-output.md) plus the map’s own rules, emitted before the role rules so that a role rule of equal specificity wins. Each reads its token with the literal of the presentation attribute as fallback:
| Selector | Draws |
|---|---|
.merlion-arch-untitled>.merlion-cluster-box |
An untitled zone’s box as a cluster box |
.merlion-arch-dashed>.merlion-cluster-box |
stroke-dasharray: var(--merlion-dash, 5 3) |
.merlion-arch-zone.merlion-arch-filled>.merlion-cluster-box |
20% of the tone (else --merlion-cluster-border) into --merlion-cluster-bg, no stroke |
.merlion-arch-bar |
The tone, else --merlion-fg |
.merlion-arch-zone>text.merlion-arch-bar-title |
--merlion-bg |
.merlion-arch-badge>circle, .merlion-arch-badge>.merlion-arch-icon |
--merlion-bg with the tone’s stroke; the title colour |
.merlion-arch-icon |
color: the node text colour mixed with the tone, as an item label |
.merlion-arch-item>.merlion-shape.merlion-arch-bare |
fill: none; stroke: none |
.merlion-arch-item>.merlion-label, .merlion-arch-flow>.merlion-edge-label>.merlion-edge-text |
font-size at T |
.merlion-arch-column-box, .merlion-arch-column-title |
50% --merlion-border into --merlion-bg; --merlion-fg |
.merlion-arch-step>circle, .merlion-arch-step>text |
The tone, else --merlion-accent; --merlion-bg, SemiBold at T |
.merlion-arch-legend-text |
--merlion-fg at T |
.merlion-arch-separator |
--merlion-border, 4 4 |
.merlion-arch-dim |
opacity: 0.3 |
For each zone and item role in use with a tone, .merlion-cc-{role}>.merlion-arch-bar, .merlion-cc-{role}.merlion-arch-filled>.merlion-cluster-box, .merlion-cc-{role}>.merlion-arch-badge>… and .merlion-c-{role}>.merlion-arch-icon carry that tone.
Text alternative
Section titled “Text alternative”The outline is returned as plain text and written into <desc>:
Architecture map. Online ordering system: containers. 3 columns, 1 zone, 8 items, 8 flows.A customer uses the web shop and the mobile app, both of which call the ordering API; the API stores orders, queues fulfilment and calls two external systems.Columns: People, Ordering system, External systems.Zone: Online ordering systemOnline ordering system: Web shop Single-page appOnline ordering system: Mobile app iOS and AndroidOnline ordering system: Ordering API JSON over HTTPSOnline ordering system: Order database Relational storeOnline ordering system: Fulfilment queue Durable messagesCustomer Places and tracks ordersPayment provider Card processingEmail service Order notificationsCustomer → Web shop [Visits]Customer → Mobile app [Uses]Web shop → Ordering API [Calls]Mobile app → Ordering API [Calls]Ordering API → Order database [Reads and writes]Ordering API → Fulfilment queue [Enqueues]Ordering API → Payment provider [Charges]Ordering API → Email service [Sends mail]- The first line is
Architecture map. {title}.and the counts of columns, zones, items and flows. Then thedescription,View: {view title}.when a view is drawn, andColumns: {titles}.when some column has a title. - Then one line per titled zone and per item in drawing order:
Zone: {path}for a zone,{path}: {name}for an item, where{path}is the titles of the titled zones enclosing it, outermost first, joined by/(without{path}:at the top level), and{name}is the label, the detail and the list entries joined by spaces. - Then one line per flow:
{from} → {to}, with↔whenboth, then[{label}]and(step {n})when present, where a flow end is named by an item’s label or a zone’s or column’s title, else its id. ThenStep {n}: {note}per legend entry, and, with a view that lights an item,Lit in this view: {labels}.. - Every item’s line equals its viewer prefix,
{cluster path}: {name}(interaction.md), so the keyboard walk announces it.
Viewer
Section titled “Viewer”<merlion-view> loads @fractalboxdev/merlion-view/interact for an architecture map as for any Merlion SVG (viewer.md), and the module applies to it without change: the root has class merlion and no merlion-chart, and every .merlion-edge carries data-merlion-from and data-merlion-to.
- Pin. A tap on an item pins it: the item, its flows and their other items stay lit and the rest dims. A flow to a zone or a column lights no item at that end. Shift+tap lights the transitive path upstream and downstream. A second tap, a background tap or Esc clears the pin.
- Popover. The heading is the item’s label, with a list item’s entries; the body is its detail lines, its zone path, and its flows with their labels.
- Keyboard. The arrow keys walk every item in outline order; each move and each pin announces the item’s outline line.
- Collapse. A tap on a titled zone’s title collapses the zone under the cluster rules (interaction.md).
- A dimmed element of a view stays interactive. Clearing the pin and the keyboard’s current item restores
svg.outerHTMLbyte for byte. With JavaScript off, every label, detail, title and step is drawn text, and the outline is in<desc>.
Diagnostics
Section titled “Diagnostics”| Code | Severity | Meaning |
|---|---|---|
E004 |
Error | The input exceeds limits.input_bytes; more than 64 zones, 1,000 items or 500 flows; or the fuel is exhausted |
E020 |
Error | The input is not valid JSON, exceeds a nesting, object-member or array-item limit, or repeats a member name (as for charts) |
E021 |
Error | The spec’s shape (as for charts): an unknown or missing member, a wrong type or version, an id or role outside its grammar, text empty or over its length, a header without a title, list and form disagreeing, a note without a step, an array over its limit |
E025 |
Error | An id that an earlier element already uses |
E026 |
Error | Placement: a cell outside the columns or rows, two top-level cells overlapping, a span wider than its zone’s cols, zones nested deeper than 4 or in a cycle, a separator on column 0, a flow joining an element to itself or a zone or column to an element inside it |
E027 |
Error | An id that in, at.column, a flow, a view or the view option names and no element of the right kind has |
W014 |
Warning | Bidirectional formatting characters stripped from text |
W027 |
Warning | An icon name outside the built-in set; the element draws no icon |
W028 |
Warning | A flow with no open route through the gutters, drawn as a direct path |
I010 |
Info | A character outside the font tables; its width is estimated |
E020 and E021 keep the meanings they have for charts and layer maps. strict promotes W014, W027 and W028 to errors.
- Reading reports every error it finds at once. An element that fails its own shape is left out; an id it declares is still known, so a reference to it is no
E027, and what depends on it is not checked further. Placement, nesting, spans, flow ends and view ids are each checked for every element they can be. W028is located at its flow, and its message starts with the flow’s path,/flows/{k}.check_architecture,merlion check --architectureandcheckArchitectureread the spec, then measure, lay out and route it at the default options under the same fuel, so they report whatrender_architecturereports,I010,W028and fuel exhaustion included.
Limits
Section titled “Limits”| Limit | Value |
|---|---|
| Input / nesting | limits.input_bytes / limits.nesting |
| Columns / rows | 1–16 / 64 |
| Zones / items / flows / views | 64 / 1,000 / 500 / 16 |
| Zone nesting / member columns | 4 / 8 |
| List entries / ids per view | 12 / 2,000 |
| Text | title 200, description 2,000, detail 400, note 200, every other text 80 characters |
| Fuel | One unit per zone, item and flow; then, in each layout pass, one unit per lattice node for the lattice and again for each search, and one per search step, against fuel |
Out of scope
Section titled “Out of scope”Brand and product logos (the caller icon hook), Mermaid block-beta and architecture-beta sources (adapters onto this model), a view switcher in the viewer, junction and bus items for fan-in and fan-out, flow roles, links on items, rotated side labels, and a key that tells kinds of item apart.
Validation
Section titled “Validation”crates/merlion-render/tests/architecture_acceptance.rsrenders every fixture intests/fixtures/architecture/, and synthetic maps with an empty zone between two ends and flows over zone badges, strictly at 360, 720 and 1,400 px, with and without each of its views; checks byte-identical repeats; cell spans over columns and rows; member flow into zone columns, spans and nesting; zone and column flow ends; the industry-model fixture’s aspect ratio (1.5–2.2) and natural width (at most 2,000) at default options; that no item’s text or icon leaves its box, and that no item is taller than its content (label, detail, icon and padding) plus one gap, in any fixture at any width, also in thesystemfont mode; that titled zones in one row share a header height with each title centred; that no route crosses an item it does not join, a header, a badge, or a drawn zone that holds neither end, in every fixture and synthetic map at every width; thatcheckreports whatrenderreports; that every problem of a spec is reported at once; that the legend wraps at the grid; parallel tracks;aroundroutes; badges and the legend; the lit and dimmed class sets of a view; every error code with its JSON path, line and column;W027; limits and fuel; the outline; the group markup the viewer reads; roles, automatic zone tones and a palette tone; every form and icon; and that every icon’s path data holds only its commands and stays inside its 24 × 24 box. It records each fixture’s and each view’s SVG and outline digest (FNV-1a 64,data-merlion-versionblanked) intests/fixtures/architecture-digests.txt.packages/merlion-wasm/test/glue.test.mjsrenders a fixture throughrenderArchitecturefrom a string and from an object and with a view, checks errors throughcheckArchitecture, and renders every entry ofarchitecture-digests.txtthrough the WASM build to the recorded native digests.crates/merlion-cli/tests/cli.rschecks thatmerlion render --architecturewrites the core’s SVG and outline, from a file and from standard input with--view, and thatmerlion check --architecturereports errors.bench/test/viewer.browser.mjs(Playwright, headless Chromium) taps an item and checks that it and its flows’ other items light; Shift+taps an item and checks its transitive path; walks every item with the arrow keys in outline order, each announcing its outline line; pins with Enter and clears with Esc; checks that a view’s dimmed items stay interactive; and checks thatsvg.outerHTMLafter clearing equals its value before.