ADL 4 · Part I — Documents and conformance

0.6.0 reconciled + 0.5.1 detail

Document structure and the parse pipeline

ADL 0.6.0 reference · Review draft 1 · November 14, 2026.

Contents · Source map · Evidence

The 0.6 edition note

A complete document crosses several boundaries before it can serve an application: representation, version admission, composition and resolution, model validation, activation, and runtime execution. A rejection at one boundary says little about the others. Keep the source file and the entry point with the result.

The complete domain root

The minimal document is a standalone domain with an exact language declaration, an application name and version, and one resource. It passes the strict C++ validation command and the independent reference check used by this edition. The latter has its own coverage limits. Neither command starts an HTTP application or performs a schema migration.

# Illustrative excerpt; the linked file is complete.
adl: "0.6.0"
domain:
  name: reference
  version: "1.0.0"

The language declaration belongs to the root submission. Suite members inherit the suite root’s version and must not independently redeclare it in that context. An included fragment is not automatically a complete standalone document. See the retained pipeline for include, substitution, reference, and merge order, and ADL 5/6 for suite and version rules. New checks in this draft exercise standalone documents; suite-member and boot-reparse behavior remain source-reviewed or inherited evidence.

Placement added or emphasized in this edition

ConstructPlacementOwning chapter
queriesdomainADL 38
policiesresourceADL 21
ranked classificationsdomain privacy declarationsADL 45
handling privacyresourceADL 45
integrity, immutableresource historyADL 24
journeys, Journey sourcesdomainADL 48–54

A broad declaration container does not make every child key extensible. Unknown-key treatment is specific to the grammar and entry point. The parser’s general unknown-key sweep produces warnings, while new policy and query blocks have explicit key admission and can reject unknown keys. --strict also affects particular semantic/value checks; it is not a promise that every unknown key everywhere becomes the same error. The policy-unknown-key fixture demonstrates one concrete rejection.

Parsing, building a model, compiling a Journey, and activating a domain are separate checks even when a command invokes more than one. Follow their reported diagnostics rather than treating a command’s name as a complete stage trace. The current edition records raw command output so later tooling can be compared without reconstructing it from prose.

Retained reference detail

The numbered sections below are carried from 04-document-structure-and-the-parse-pipeline.md. Their original baseline and evidence remain attached to the source. Statements about “current” or “checked” behavior in this retained text refer to those original observations unless the edition note explicitly updates them. This is a consolidated draft, not a claim of complete re-verification.

4.1 Scope and authority

An ADL document describes a domain or identifies the domains belonging to a suite. Before a host can use it, source files, substituted values, reusable fragments, and references must be interpreted in a defined order. This chapter specifies that document boundary and processing order.

The governing provisions are Draft 05 §§1–2 and §4, its A1/A2 amendments, and the later version-admission rulings. Material not replaced by those provisions is carried from reduced v0.3.1 Chapter 6 (retired). The revision record distinguishes amendments, editorial corrections, and unresolved source contradictions.

This chapter owns placement and processing. Other chapters own the constructs placed within the document:

SubjectOwning reference
Requirement levels and evidence conventionsADL 2
Suite membership, licensing, and capabilitiesADL 5
Language admission and domain/suite version identityADL 6
Address grammar and resolution identityADL 7
Imports and registry loadingADL 8
Canonical serialization and digestsADL 9
Types, enumerations, reusable objects, and traitsADL 10, ADL 11, ADL 13
Derivation and resource subtypingADL 14
Diagnostic envelopesADL 31

A successfully parsed document is not evidence of successful activation, a completed migration, or enforcement of every declared rule. Those are separate host operations; see ADL 3.

4.2 Text formats and scalar values

ADL accepts YAML and JSON representations of its document model. The root is a mapping/object. Selecting JSON because the first non-whitespace character is [ does not make an array a valid ADL root.

The inherited format-detection rule selects JSON when the first non-whitespace character is { or [, and YAML otherwise. Equivalent supported YAML and JSON inputs describe equivalent values. This is a semantic comparison, not a claim about identical source bytes, comments, or in-memory object layouts.

Format-hint discrepancy. The inherited chapter says an explicit format hint does not override content detection. The checked parser instead uses a nonempty hint to select its decoder. The examples here use automatic detection. Explicit hints should match the supplied text; the disagreement remains a publication item rather than a newly ratified override rule.

4.2.1 Quoting and serialization

The inherited specification names YAML 1.2 and requires emitters to quote strings that YAML 1.1 readers would interpret as another type. These are separate obligations: acceptance by one parser does not prove either full YAML conformance or interoperability of its output.

Quote language and application versions, and quote string values such as "no", "16:9", and "1_000". The checked example’s "no" remains a string when the production YAML bundle is read by PyYAML.

The older claim that the plain scalar 1.0.0 necessarily becomes a float and loses its patch component is withdrawn as an erroneous explanation. The requirement to author quoted version strings remains; version admission belongs to ADL 6.

YAML comments are absent from the resolved value tree. Authored text can still be retained separately and returned as authored source (§4.10). Discarding comments during parsing does not imply that the original submission is unavailable.

4.2.2 JSON and file composition

The carried-forward contract restricts $include to YAML and requires JSON submissions to be self-contained. JSON can represent the expanded result of a YAML package, including ordinary mappings and arrays.

Observed limitation. The checked production parser also processes $include in JSON when a filesystem base is provided. That acceptance exceeds the inherited contract; it is not presented here as portable JSON grammar. Another observed limitation is that JSON suite members fail the current member-loading path (§4.3.3), although a standalone JSON domain works.

4.3 Root forms and entry context

A directly submitted document carries adl: beside its suite: or domain: root. A referenced suite member carries domain: and inherits the suite’s language version. A file fragment contributes sections to another document and is not independently admitted as a domain.

Input contextStructural formLanguage version
Standalone domainadl and domain at the rootDeclared by the document
Explicit suiteadl and suite at the rootDeclared by the suite root; suite grammar requires "0.5.1" in this edition
File named by suite.domainsdomain rootInherited; a member MUST NOT declare adl
$include fragmentSection mappings, optionally wrapped in domainNo independent language-admission role
HTTP submission envelopeRequest data containing document text and, for suites, member textThe declaration is in the ADL text, not supplied by the envelope

A root that is neither a suite nor a domain is malformed. A document declaring both is not a third form. The checked suite dispatcher reports DOCUMENT_ROOT_INVALID. SUITE_ROOT_MISSING is retired by the A2/D4-1 ruling.

4.3.1 Standalone domain: the permanent suite-of-one form

The bare-domain form is permanent sugar for a suite named and versioned by its single domain. “Bare domain” means a domain: root without a suite: root; it does not mean omitting the language declaration.

# Illustrative complete input: standalone.yaml
adl: "0.5.0"
domain:
  name: catalog
  version: "1.0.0"
  resources:
    Book:
      object:
        id: { type: uuid, primaryKey: true }
        title: { type: string, required: true, maxLength: 80 }

This example uses only baseline grammar and therefore declares "0.5.0", the lowest required language version. The ratified rule distinguishes the language declaration from release cuts: adl-v0.5.1-a is a server tag, not an adl value.

Suite-of-one equivalence establishes a language interpretation. It does not require a particular registry row layout or make the source digest of a bare domain identical to that of a separately packaged suite.

4.3.2 Explicit suite

# Illustrative complete suite root: suite.yaml
adl: "0.5.1"
suite:
  name: catalog
  version: "1.0.0"
  domains: [./member.yaml]

The suite body admits name, version, description, license, capabilities, and domains. Its identity and member list are required; description, license, and capabilities are optional. domains is a sequence of member-path strings, not an inline resource map. List order does not specify execution order; dependency handling belongs to ADL 5 and ADL 17.

Draft 05’s older suite examples still say adl: "0.5.0". This chapter applies the later ruling and implemented suite gate: explicit suites use "0.5.1". The suite: # REQUIRED comment in Draft 05 §4.2 is also read together with the permanent bare-domain exception, not as its repeal.

4.3.3 Member document

# Illustrative member.yaml, loaded by suite.yaml
# No adl declaration: the member inherits "0.5.1".
domain:
  name: catalog
  version: "1.0.0"
  resources:
    Book:
      object:
        id: { type: uuid, primaryKey: true }
        title: { type: string, required: true, maxLength: 80 }

The same resource definitions appear in the standalone example. The different container and language declarations are deliberate; the example compares the business model, not package digests.

Loading this member directly without suite context MUST reject it as ADL_VERSION_MISSING. Adding its own adl: while it is loaded as a member MUST reject it as ADL_VERSION_MEMBER_FORBIDDEN, even if that value matches the suite’s declaration. Member inheritance is not a textual authoring shortcut that each member may override.

Observed entry-point limits. Production adl validate calls the single-domain parser and rejects the explicit suite root. The suite parser and host suite bootstrap/submit paths accept suites. The verification adapter therefore calls SuiteParser explicitly. The current member path injects inherited version text through a YAML parse; a checked JSON member failed that path. Use the checked YAML member form for these examples and retain the JSON discrepancy.

4.3.4 Filesystem and HTTP loading

A filesystem loader supplies member text relative to the suite file. The host’s HTTP suite-submit contract supplies it through a request-level members map, keyed by the path strings written in suite.domains:

{
  "content": "adl: \"0.5.1\"\nsuite:\n  name: catalog\n  version: \"1.0.0\"\n  domains: [./member.yaml]\n",
  "members": {
    "./member.yaml": "domain:\n  name: catalog\n  version: \"1.0.0\"\n  resources:\n    Book:\n      object:\n        title: {type: string}\n"
  }
}

This is an illustrative request body. content and members are transport fields; they are not extra ADL document keys. Missing member text is reported as SUITE_MEMBER_MISSING by the checked host.

The client does not provide a filesystem base for the server to follow. Self-contained submission permits member texts carried in the request, but not arbitrary server file reads. A residual $include without a loader-supplied base rejects. The current suite-member parser also supplies no include base, even on the file-backed suite path: flatten a member’s include composition before loading it through that path.

4.4 Domain sections and resource placement

Within a domain, keys selecting language sections form a defined vocabulary. Names inside a declarations map identify the author’s constructs. They do not become additional section keywords.

PathShape and purposeOwner
domain.name, domain.versionDomain identity and application versionADL 6
domain.descriptionOptional descriptive textThis structure; generated presentation in ADL 32/33
domain.propertiesMap of reusable field definitionsADL 13
domain.objectsMap of reusable field groupsADL 13
domain.enumsMap of enum definitionsADL 11
domain.traitsMap of trait definitionsADL 13
domain.resourcesMap from resource names to resource bodiesADL 10 onward
domain.resources.Book.objectMap from field names to field definitionsADL 10/13
domain.imports, domain.extends, domain.derivedFromReuse, linked derivation, and detached provenanceADL 8/14
domain.extensions and declared x-… keysVendor namespace declarations and metadata§4.9

This is a structural guide, not a complete catalog of every legal domain key. Automation, content registries, media, privacy, and presentation sections retain their owning chapters. A specification entry in the table does not establish that the checked host implements it.

properties describes reusable fields, objects groups fields, and resources declares entities. Moving a field directly under a resource body does not make it part of that resource’s object map. Relationships, permissions, indexes, and state machines are resource sections with their own grammar.

An unrecognized key at a defined language level must be reported. Declaring a vendor namespace does not legalize a misspelling such as resourses or maxLenght. In the checked CLI, many unknown domain/resource/field keys are W001 warnings; an unknown suite-body key is a rejection. A warning is not a recognized extension or proof that the value reaches the runtime model.

shared: is removed by Draft 05 §4.2/§15. It is not another spelling of properties, objects, or traits.

Empty-domain boundary. The inherited prose permits zero-resource domains and says they SHOULD be reported, while its key table calls resources required. This draft does not invent a new rejection to resolve that conflict. Complete authoring examples supply resources; the checked CLI reports a zero-resource result as W000. Final wording for an omitted section remains a publication item.

4.5 Composition across files

$include assembles sections into one domain before substitution and reference resolution. The carried-forward authoring form is an array of paths under the domain body. It is different from suite.domains: a fragment contributes to the current domain, while a suite member declares a domain of its own.

# Illustrative fragment of composed.yaml; full file linked in §4.10.
domain:
  $include: [./parts/types.yaml, ./parts/book-extra.yaml]

Paths are relative to the file containing the directive. An included mapping can expose its sections directly or place them under a domain wrapper, which is unwrapped. Root-level name, version, and description from an include do not replace the root domain’s identity. This protection does not apply to a field whose name happens to be name or version.

4.5.1 Include precedence

The carried-forward merge rule is first definition wins. The root’s existing values are already present before included files contribute theirs. For a mapping present on both sides, merge recursively. Add a missing key; retain an existing non-mapping value when another file supplies that key.

In the worked example, the root supplies title.maxLength: 80. A later fragment supplies title.maxLength: 999 and adds edition. The result keeps 80 and gains edition. It does not replace the first resource definition with the second.

This rule belongs to $include. It must not be generalized to $merge, trait composition, or domain derivation. Their collision and override rules are specified in ADL 13 and ADL 14.

4.5.2 Globs, nested includes, and loader limits

Paths may contain glob patterns. The checked loader supports * and ? in the filename component and sorts matches; this observation is not a general recursive-glob grammar. Use explicit paths when precedence should be apparent from the source.

Ruling R7 (kalos#477). A glob matching no files is a warning, not an error. A literal path that does not exist is an error.

A missing literal file rejects. An unmatched glob emits an include warning and contributes no files.

The distinction is the difference between a promise and a request. ./base.yaml names a file the author asserts is there; its absence is a broken document. An optional layer is declared exactly as ./schedules*.yaml, and half the corpus relies on that — making an unmatched glob fatal would reject every domain whose optional layer is simply not present, which is the normal case, not a defect.

What the warning is for is the other half: “the layer is deliberately absent” and “the pattern is wrong” produce an identical document, and without a report they are indistinguishable. That is how content goes missing silently (#380). Review the warning before concluding a layer was meant to be absent.

The inherited chapter describes depth-first inclusion. The checked production loader does not recursively expand an included fragment’s own $include: a probe’s nested leaf resource was absent without a warning. Do not teach nested include expansion as verified host behavior. Use a root-level list of the needed fragments until the discrepancy is resolved.

The checked loader rejects a literal absolute include path, and no-base submission is rejected before expansion. These checks do not prove complete filesystem containment for every traversal or symlink case. Filesystem trust policy belongs to the host; this chapter grants no client-controlled base path.

4.6 Environment substitution

Substitution operates on string values, including values inside mappings and arrays. It does not rename keys or create YAML structure. Replacing a placeholder with 42 leaves a string value; it is not a second parse of the replacement as a number.

The carried-forward forms are:

FormInherited rule when the variable is unsetChecked production behavior
${VAR}Substitute an empty stringRejects in the checked ordinary field-default case; discrepancy retained
${VAR:default}Substitute defaultUses the fallback; demonstrated by the worked example
${VAR!}Reject because the variable is requiredRejects in the checked ordinary field-default case

AVOID the bare form when absence would change intended behavior. Use a meaningful explicit default or the required form. A deliberately empty value and an unset variable are distinct inputs to the checked lookup: defaults apply when the variable is absent.

# Illustrative reusable field fragment.
properties:
  Title:
    type: string
    required: true
    default: "${ADL4_LABEL:Untitled}"

The checked implementation additionally disables individual entries under integrations, schedules, templates, or channels for missing configuration variables and emits warnings. Privacy is explicitly excluded from that fallback. This is an implementation observation with a broader exception than the inherited rule; the owning automation/integration chapters need to settle its language status. It does not make a missing required field-default value optional.

ADL substitution is separate from server-configuration environment handling. This chapter specifies the document transformation, not deployment credential configuration.

4.7 Processing order

Draft 05 §4.1 retains the original stages and inserts stage 5.5. The table is the language processing contract, not the order of methods in one implementation.

StageTransformationResult or required boundary
1Format detection and decodingA document value tree; a valid ADL root is a mapping
2$includeThe domain’s file fragments are assembled
3${VAR}String values contain substituted values or the stage fails
4Lookup tablesReusable properties, objects, and enums can be named
5$ref / $mergeLocal composition is expanded recursively under its owning rules
5.5Address lexing and intra-suite resolutionValid typed addresses; eligible local targets resolved and external targets deferred
6ValidationApplicable structural, directive, type, and semantic constraints checked
7Model constructionThe model supplied to downstream consumers

The order gives three useful predictions. Included definitions participate in substitution. A property containing ${VAR:default} has its value substituted before a resource’s $ref expands it. Local composition directives do not need to be reinterpreted by each generated client or runtime action.

Composition added by ADL 13/14 must be accounted for before its resulting members are validated and modeled. At the inspected revision, the production composition pass expands domain derivation, then traits, then resource subtyping after local directive resolution. That is implementation evidence; the detailed dependency and override rules remain in their owning chapters. A domain derivation requiring a base uses a supplied base source. It is not a license for general stage-5.5 address lexing to fetch packages over the network.

Digest boundaries are related but distinct. Draft 05 §21.2 defines the source digest from the included authored model before environment substitution, with its specified package-file coverage. The resolved digest covers the resulting resolved tree. The example’s changed environment value leaves its source digest unchanged and changes its resolved digest. YAML text formatting is not the digest algorithm; ADL 9 owns the canonical encoding rules.

4.8 Addresses that remain unresolved

Stage 5.5 lexes and shape-checks address literals and resolves eligible targets inside the current suite. It MUST follow substitution, because a substituted value may supply an address.

An address targeting another suite MUST NOT be resolved by this parse-time stage. It is carried forward as an unresolved typed value for the appropriate registry/load or bus/call operation. For example, from suite catalog, a target in adl.partner.crm.Contact is external even if its spelling is valid.

Consequently, resolved document does not mean “every external target has been fetched and exists.” It means the applicable source transformations have run. Syntactic validity, target existence, authorization, and load/call success remain different questions.

This is the explicit exception to the older blanket claim that all references resolve away before model construction. A local $ref selecting a reusable field and an address naming another suite have different lifetimes.

The checked address tests establish lexer behavior and the intra-suite helper’s cross-suite deferral. They do not establish exhaustive stage-5.5 traversal of every address-bearing construct or a live remote resolution. The chapter keeps that evidence limit; ADL 7 and the owning declaration chapters supply the full address contract.

4.9 Declared vendor extensions

Draft 05 §4.3 defines domain-declared extension namespaces. A key has the form x-{namespace}-{name}. Both namespace and name follow ns-segment as defined by the address grammar; they are not arbitrary punctuation-bearing labels.

# Illustrative fragment; complete extensions.yaml is linked in §4.10.
domain:
  extensions: [acme]
  x-acme-retention-class: regulated

A domain using an extension key MUST declare its namespace. Undeclared namespaces are rejected as unknown keys. The declaration does not legalize an ordinary unknown key. adl, kalos, and the reserved names in Draft 05 §16 MUST NOT be used as extension namespaces.

Extension values MUST be preserved losslessly in source and resolved models and covered by both digests. The core runtime assigns them no semantics. A vendor value such as regulated therefore does not itself implement retention, access control, or a compliance policy.

Implementation gap. The checked production parser reports both extensions and the declared vendor key as unknown-key warnings. Removing the namespace declaration still produces acceptance with a warning. Preservation of those values in the resolved JSON tree is observable, but it does not prove the required namespace admission rules or model round-trip contract. The adl-ref warnings similarly do not establish support. Keep the requirement and the gap separate.

4.10 Worked sources and observable results

The example directory contains complete inputs and identifies the fragments that must not be submitted alone.

InputPurposeChecked result
standalone.yaml, standalone.jsonTwo encodings of a baseline domainProduction and adl-ref accept; production resolved trees agree
suite.yaml, member.yamlExplicit suite and inherited memberSuite parser accepts one member at 0.5.1; its resource tree matches the standalone form
reject-suite-member-version.yamlMember declares its own language versionADL_VERSION_MEMBER_FORBIDDEN
composed.yaml and its parts/Include, substitution, lookup, and local expansionBoth implementations accept and agree on the resolved business definitions
extensions.yamlRequired extension declaration contractWarnings and missing admission enforcement; §4.9 records the gap

In composed.yaml, the first include declares a reusable Title property and an Identified object. The root merges the object’s id field and references Title with an explicit maxLength: 80. The second include attempts maxLength: 999 and supplies an edition field. With ADL4_LABEL unset, the resulting resource body is:

# Illustrative resolved resource fragment, not a complete document.
Book:
  object:
    id: { type: uuid, primaryKey: true }
    title:
      type: string
      required: true
      maxLength: 80
      default: Untitled
    edition: { type: string, default: "no" }

With ADL4_LABEL set to Review copy, title.default changes to that string. The property was substituted before the reference expanded. The first include rule still selects 80; the environment does not select include precedence.

The production bundle contains the expanded document. Source endpoints have a separate role: authored source preserves the submitted text; resolved source exposes the processed form. Authored and resolved representations are not interchangeable editing inputs. The metadata describing member origin is also separate from the origin-free resolved document used for canonical digests. ADL 9 and ADL 13 own those serialization/provenance details.

4.11 Diagnostics and failure boundaries

A pipeline failure MUST identify its stage, location, and nature and MUST NOT produce a partial domain model, under the carried-forward structure requirement. A warning and a successful model are different from a rejecting error. The host’s transaction boundary for a suite is an additional obligation, not something established merely by a single parser call.

ConditionGoverning or checked diagnostic
Direct document lacks adlADL_VERSION_MISSING
Explicit unsupported language declarationADL_VERSION_UNSUPPORTED
Suite member declares adlADL_VERSION_MEMBER_FORBIDDEN
Invalid suite/domain root classificationDOCUMENT_ROOT_INVALID in the suite dispatcher
Listed member text unavailableSUITE_MEMBER_MISSING
Unknown suite-body keyUNKNOWN_KEY in the suite parser
Malformed addressAddress grammar diagnostics, including ADDRESS_SYNTAX_ERROR; ADL 7/31 own the detailed cases
$include on a no-base pathChecked parser rejection explaining the self-contained-input requirement
Unset required field-default variableChecked parser rejection naming variable and value path
Unknown domain/resource/field key in CLI validationChecked W001 warning; not a general rejection guarantee
Zero-resource CLI resultChecked W000 warning

The checked CLI wraps parse failures in E000, with zero line/column values. A semantic error name can appear inside the message without being the outer CLI diagnostic code. Do not treat that envelope as proof of the complete stage/location requirement or confuse it with the host’s HTTP error mapping.

A focused host suite test verifies rejection of a member that declares adl without writing the suite. That is concrete evidence for the tested submit case, not proof of every rollback or external-side-effect scenario.

4.12 Verification and remaining publication work

The verification record records production and independent-modeller results, the explicit parser adapter, source hashes, and the focused existing tests. Seven relevant test targets passed, covering 91 test cases. The ordered-ingest target initially encountered unavailable manifest/golden paths during a documentation reorganization; after those files became available again, its two tests passed. The verification record retains both results rather than counting the initial empty-corpus pass as evidence.

The chapter is a written draft with checked examples. Publication still needs resolution or explicit host qualifications for:

  • Format-hint precedence, JSON include acceptance, and JSON member loading.
  • The omitted/empty resources wording and completeness of unknown-key reporting.
  • Nested include expansion and the scope of filesystem path guarantees.
  • Unset ${VAR} behavior and section-specific substitution fallbacks.
  • Declared extension admission and lossless model preservation.
  • Complete stage-5.5 coverage and stage/location diagnostics.

These findings do not change the accepted example spellings or ratify a new language rule. Continue with ADL 6 for version admission, ADL 5 for suites, and ADL 13 for the composition semantics used by the worked document.