Every documentation page about a model reads the same facts: which nodes there are, what each holds, what it references and what references it, which requirement claims it, and which files were generated from it. The docs view is one document per build that holds those facts and nothing else. A port builds it from the model it has already loaded, and a page is then a template that reads it.
The view holds facts only: no HTML, no Markdown and no sentences. Where a page must choose
(show a section or not, draw a badge or not) the view gives it a boolean or a count, so a
logic-less template such as Mustache can render it unaided. Every port that builds the view
writes the same bytes for the same model, and the shared corpus
fixtures/explorer-conformance/ holds them to that.
TypeScript builds it today, and so do Java and Kotlin (one JVM builder, DocsView in
metadata), C# (MetaObjects.DocsView), Python (metaobjects.docs_view) and Rust
(metaobjects::docs_view). buildDocsView and serializeDocsView are exported from
@metaobjectsdev/metadata, and docsSiteFile() writes the result as the site's explorer.json
(see explorer-site.md). The explorer pages still render their HTML in
TypeScript; the JVM, C#, Python and Rust copy the app and write the same explorer.json.
A page of your own is a template over the view: the TypeScript template generator renders it
with the perNode and perRequirement scopes (and data: "docsView" on perModel and
perPackage), writes each page at its path with {path} in the output pattern, and hands
every page a root so {{root}}{{path}} links from anywhere. It can copy a directory of
assets beside the pages and check that every link lands. See
codegen-concepts.md.
| Input | Required | What it adds |
|---|---|---|
| The loaded, resolved model | yes | every node, member, attribute, reference, inheritance and claim |
The verify payload (meta verify --format json) |
no | each requirement's verdict, digest and findings; the counts; the advisories; which entity nobody claims |
The generation manifest (.metaobjects/.gen-state/.hashes/, merged) |
no | which generated files each node produced |
The routes the run mounts ([{ node, method, path }]) |
no | each node's REST routes |
The builder re-derives nothing the loader already decided. Ids come from walking the
effective tree. Inheritance comes from where each effective child is declared, and references
come from the loader's own resolution of every attribute it treats as a reference. Claims are
resolved by the same resolver the requirement gate uses. A provider's vocabulary therefore
gets its members and its links with no change to the docs code. A link needs an attribute
the loader resolves as a reference (such as @objectRef); any other attribute stays text. The
corpus's crm case
declares a page.list and a capability.module in a data-driven provider, and both appear,
linked, with nothing in the builder that names them.
The verify payload, manifest and routes are optional. A missing or malformed one leaves its
part empty, and sources says which were read. Claims do not need the verify payload: they are
the model's own @implementedBy, so they hold without it.
The input formats are described in explorer-data.md.
- Every key is always present. An absent fact is
"",false,0,[]ornull, never a missing key, so a template never tests for existence. - Key order is the order on disk, as the types below list it.
- Sorting is by code unit, never by locale, so every runtime sorts alike.
serializeDocsViewwrites the view as JSON indented by two spaces, with one trailing newline.formatis"metaobjects-docs-view/1". It changes when a field changes meaning or is removed, and not when a field is added.
A pointer to anything in the view is a link:
interface DocsViewLink {
label: string; // what a page prints
id: string; // the target's id; "" when unresolved
path: string; // site-relative page, with #<anchor> for a member; "" when unresolved
kind: string; // "<type>.<subType>"; "" when unresolved
unresolved: boolean;
}The label is a top-level node's name, a requirement's @title (else its name), or for a
member the owner's name followed by the member's id after the owner's id: Order.email, or
Order#3 for a member with no name. An unresolved link keeps the text as written in its
label, so a page can print it without linking it. A reference value or an @implementedBy
claim that names a member the owner inherits (Order.total, with total declared on Order's
base) lands on the owner's own row for that member (Order.html#m-total). extends and a
member's declaredOn name the node that declares it.
- A top-level node is
<package>::<name>, or just<name>with no package. - When top-level nodes of different types share a package and a name (an entity
Leadand an application's pageLead), the object keeps the plain id, since every model reference names an object. If none of them is an object, the first one declared keeps it. Each other one adds its type:acme::crm::Lead[page.list]. - A member is its parent's id plus
.<name>, or#<index>when it has no name. When siblings of different types share a name, the first one keeps.<name>, because that is the node a dotted@implementedBysuch asAuditEntry.idresolves to. Each later one adds its type:acme::shop::AuditEntry.id[identity.primary]. - Two nodes that would still share an id make the builder throw, naming the id.
- A name in an optional input (a file's
sourceNode, a route'snode, a finding'snode) and a claim name a node by its unqualified id, so they land on the node that holds that id, and on its members, whatever order the nodes of that name are declared in.
- A top-level node's page is
model/<package dir>/<stem>.html. The package directory is the package with::turned into/, or-rootfor no package. The stem is the name, or<name>.nodewhen the name isindex(in any case), so it never takes the package's index page. A node whose id carries a type qualifier adds.<type>-<subType>:Lead.page-list.html. - A requirement and everything inside it land on
requirements/<package dir>/<stem of its address>.html. - A direct member of a top-level node lands on its owner's page at
#<anchor>. The anchor ism-<name>for a field,m-<type>-<name>for anything else, andm-<type>-<order>for a member with no name. A deeper member lands on the anchor of the direct member that holds it. A page must carry an element with every direct member's anchor, so that every link in the view lands.
interface DocsView {
format: "metaobjects-docs-view/1";
sources: { requirements: boolean; files: boolean; routes: boolean };
counts: DocsViewCounts;
packages: DocsViewPackage[];
nodes: DocsViewNode[]; // every top-level node, sorted by id
requirements: DocsViewRequirement[];
advisories: DocsViewAdvisory[];
slices: DocsViewSlice[];
storage: DocsViewStorage;
}The types are exported from @metaobjectsdev/metadata.
One entry per top-level node of any type: objects, prompts, requirements, and any type a provider registers.
| Field | Meaning |
|---|---|
id, name, package, type, subType |
As above. package is the effective package. |
order |
Its position among the top-level nodes in declaration order, which the id sort does not keep. |
path |
Its page. |
title, description, summary |
The documentation attributes, or "". |
abstract |
As declared. |
extends |
A link to its super, or null. |
attrs |
Every effective attribute (see below). |
memberGroups |
Its members, by type (see below). |
refs |
Every reference from the node or any of its members, in walk order. |
referencedBy |
Every reference into the node or any of its members, from another top-level node. |
claims |
Every requirement claim on the node or on anything in it. |
files |
{ generatedBy, paths }, one group per generator, sorted by generator, paths sorted. |
routes |
{ method, path }, method upper-case, sorted by path then method, duplicates removed. |
unclaimed |
The gate reported that no requirement claims this entity (WARN_REQUIREMENT_OBJECT_UNCLAIMED, matched on the finding's node, never its message). |
counts |
members (direct), refs, referencedBy, claims, files, routes. |
interface DocsViewAttr {
name: string; // without the @
value: unknown; // the effective value
values: { text: string; link: DocsViewLink | null }[];
}Attributes are the effective ones, inherited through extends included, sorted by name.
value is written as the canonical serializer writes it, with every object's keys in code-unit
order, so a map attribute such as @intValueMap reads the same from every port. A
string gives one value and a list of strings gives one value per element. Any other value gives
one, written as compact JSON. link is set only on an attribute the loader resolves as a
reference. It points at the owner's row for the member the value's dotted tail names when
there is one (inherited or not), otherwise at the node the loader bound. An attribute that merely spells a node's name is text: the view
never matches names itself.
interface DocsViewMemberGroup { type: string; count: number; members: DocsViewMember[] }The members of one type (every subtype of it), in declaration order. Groups are ordered by their first member. Grouping is by type alone, so a custom type's members group with no change to the builder.
A member has id, name, type, subType, order (among its siblings in the effective tree),
anchor ("" below a direct member), path, abstract, isArray (resolved through
extends), extends, attrs, refs (from its own attributes and extends), claims (on it or
anything in it), its own memberGroups, and:
declaredOn: when the member is inherited throughextends, a link to the node that declares it, otherwisenull. An entity extendingBaseEntitylistsidamong its own members, in its effective place, withdeclaredOnpointing atBaseEntity.
interface DocsViewRef { attr: string; via: DocsViewLink | null; target: DocsViewLink }
interface DocsViewReferrer { attr: string; from: DocsViewLink; via: DocsViewLink | null; target: DocsViewLink }attr is the attribute without the @, or extends. via is the member that carries the
reference, or null when the node itself does. Only resolved references are listed. A
referencedBy entry is sorted by from, attr, via and target, with duplicates removed.
References within one top-level node are not listed as referencedBy.
interface DocsViewClaim { requirement: DocsViewLink; member: string; status: string; level: number | null }A claim is one resolved @implementedBy link. It is listed on the top-level node and on every
member down to the one it names. member is the member's id after the top-level node's
(reference, or #3 for a member with no name), or "" when the claim is on the node itself.
Every requirement at any depth, flat, in document order.
| Field | Meaning |
|---|---|
id, name, label, path |
As above. |
address |
The dotted path of requirement names that every verify diagnostic prints. |
package, qualifiedPath |
The effective requirement package, and <package>::<address>. |
subType, level, status, disposition |
As declared; level is null when not declared. |
statement, counterexample, title, description, trackedBy |
As declared. |
depth |
How many requirements are above it. |
parent, breadcrumbs, children |
Links: the requirement above, every one above (outermost first), the ones directly below. |
implementedBy |
{ ref, resolves, target } per link as authored. target is unresolved when resolves is false. |
supersededBy |
The same, as the gate resolved it; null without one or without a verify payload. |
inLedger, verdict, digest, diagnostics |
From the gate's ledger row (verdict is clean, warn or error); false / "" / [] without one. A ledger row is matched by qualifiedPath, in order, so two requirements with one path keep their own rows. |
rollup, rollupTotal |
The declared statuses of the requirements below that name the model (level 4 or 5, or no level and an @implementedBy), as one { status, count } per status in the fixed order planned, live, partial, retired (the order the status vocabulary declares). A requirement with none such below counts itself. |
belowCount, childCount |
Requirements anywhere below, and directly below. |
targets, targetCount |
The top-level nodes it and the requirements below it claim, sorted by id. |
One entry per package, sorted by name ("" for nodes with no package): { name, count, groups }, where each group is { type, subType, count, nodes }, sorted by <type>.<subType>.
nodes, packages, requirements, functional, architectural, byStatus (as rollup),
claims (resolved @implementedBy links), files (distinct paths), and routes. From the
verify payload: undecided, coverageMeasured (whether the gate measured entity coverage),
entitiesClaimed and entitiesTotal, each 0 or false without one.
Every finding meta verify reported, in its order: { code, path, subject, severity, source, message }. path is the requirement's address, or "" when the subject is not a requirement.
subject is a link to the node a non-requirement finding is about, or null. source is
gate for a finding that can fail the build and lint for one that never can.
Named node sets a map view opens on, all derived, each { id, kind, anchor, nodes } with
nodes sorted, the list sorted by id:
package:<package>: the package's top-level nodes.requirement:<id>: one per requirement with requirements below it. It holds the subtree, every node the subtree claims, and the top-level node holding each claimed member.prompt:<id>: one per template. It holds the template and what its own attributes reference (its payload and reply).
Where the model's objects are stored, as names: what the model-only agent/schema.md page is
built from in every port (fixtures/docs-page-conformance/).
interface DocsViewStorage {
physical: boolean; // true only when TypeScript filled the physical facts below
dialect: string; // the dialect they are for, or ""
tables: DocsViewTable[]; // sorted by name
views: DocsViewStoredView[]; // sorted by name
}- A table is
{ name, schema, declaredBy, objects, description, primaryKey, columns, foreignKeys, indexes, checks }: one per concrete object whose primary source is a writable, managed table. A TPH subtype shares its base's table and adds its columns there, nullable; an@unmanagedtable is only a foreign-key target.declaredBylinks the declaring object,objectsevery concrete object stored there. - A column is
{ name, field, nullable, identity, description, sqlType, default }.fieldlinks the field's member row (first writer wins on a shared table);nullableis false for a primary-key column and a required field;identityis the increment kind of a generated key. - A foreign key is
{ columns, refTable, refColumns, name, onDelete, onUpdate }, from eachidentity.reference(one with@enforce: falseis left out). - A view is
{ name, schema, declaredBy, objects, columns }, a column being{ name, field }; the lineage is read from the linked field'sorigin.*member.
Table, view and column names come from each port's own naming helpers (naming in
.metaobjects/config.json). The physical facts (sqlType, default, indexes, checks, a
foreign key's name and actions) are null in every port. The TypeScript docs-site run fills
them from the expected schema meta migrate diffs against when the project has a dialect, and
sets physical and dialect; the committed cases are built without one.
fixtures/explorer-conformance/: each case'sexpected.jsonis the view of its project and committed inputs, byte for byte.server/typescript/packages/metadata/test/docs-view-conformance.test.tsruns it, and also checks inheritance, references, the requirement list, custom vocabulary and a build without the optional inputs. The JVM runs the same cases inmetadata'sDocsViewConformanceTestand Kotlin inKotlinDocsSiteConformanceTest(CONFORMANCE.md).server/typescript/packages/cli/test/explorer-fixture.test.ts: the committedverify.jsonfiles are what the gate writes today, and a fresh verify payload builds the committedshop/expected.json.server/typescript/packages/docs-site/test/explorer-site.test.ts: the explorer site built from the view passes its own link check, and ships the view asexplorer.jsonunchanged.