ADL 30 · Part IV — Generated interfaces

0.5.1 baseline + 0.6 edition note

Content and media types

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

Contents · Source map · Evidence

The 0.6 edition note

This chapter retains the detailed language contract and its source-specific observations. Its chapter number and numbered sections remain stable. The 0.6 additions do not by themselves change this subject’s defaults or supply fresh execution evidence for it.

Reverification should cover request/response representation and media negotiation. Use the original examples and evidence links below to recover the earlier test context. The new edition’s source map records this chapter as inherited detail; the current draft does not claim those historical tests were rerun.

Retained reference detail

The numbered sections below are carried from 30-content-and-media-types.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.

30.1 Purpose and scope

Content fields hold values within a resource: a media reference, SVG markup, blocks, an icon or font name, a component, or a repeater. They share the field placement and presence rules of ADL 10, the write validation contract of ADL 20, and the errors of ADL 31. ADL 41 owns the media library’s upload, permissions, reference tracking, and deletion lifecycle. File providers and byte storage belong to the platform manual. A stored media reference is not an uploaded file.

The inherited chapter (v0.5.0, retired) is the baseline language contract. This draft checks it against production revision 3a1655dc. Its strong claims about missing media, SVG sanitization, and nested validation do not all match that implementation. Requirements and observations below remain distinct; documenting a disagreement does not amend ADL.

30.2 Values, placement, and defaults

Declare these types under domain.resources.<Resource>.object.<field>, or in a reusable field declaration expanded there. Their outer values are:

TypeBaseline valueChecked implementation boundary
mediaUUID string identifying a library assetAlso accepts URL/path-like strings; create/PATCH/PUT check UUIDs against the library
svgSVG markup stringTop-level create/PATCH/PUT sanitize before content validation
blocksArray of objects with a string typeAn object is also admitted and bypasses array block checks
iconset:name stringAccepts a third variant segment; checks sets, not individual icon names
fontNonempty family-name stringProvider catalog membership is not enforced
componentObject without independent record identityNested model retains only part of the declared constraints
repeaterArray of component objectsCount and basic nested checks; sortable items receive _order

Omitted optional values and explicit null follow ordinary field nullability. Omitting a constraint does not impose a hidden allow-list. The built-in and custom content registries belong at domain level; they do not create resources or REST collections.

For multiple media items, declare type: array with items.type: media, and put the media constraints in items. A scalar type: media declaration does not change into an array because the submitted JSON happens to be an array.

# Illustrative field fragment; the complete domain is in the examples.
image:
  type: media
  accept: [image/png]
  maxSize: 1kb
  minWidth: 16
  aspectRatio: "1:1"
gallery:
  type: array
  items:
    type: media
    accept: [image/png]

30.3 Media references and constraints

accept is an array of MIME patterns; exact MIME names, wildcard families, */*, and filename-extension matching have helper support. maxSize accepts an integer byte count or a size string such as 500kb, 5mb, or 1gb. minWidth, maxWidth, minHeight, and maxHeight are integer image dimensions. aspectRatio is a quoted string such as "16:9"; quoting also avoids YAML readers treating sexagesimal notation as a number.

On the checked create, PATCH, and PUT paths, the runtime first checks the value’s shape, then looks up UUID references in <domain>_media_library. It validates stored MIME, size, and dimensions against the field declaration. These are checks of library metadata, not a second decoding of asset bytes. When image dimensions cannot be measured, the dimension helper skips that check. The related upload and image-decoder unit tests are identified in the evidence.

The inherited rule says an unknown UUID is accepted and remains untracked. Current MediaLibrary::validate_field_assignments instead reports unknown_media for a missing UUID on create/PATCH/PUT. The fixture distinguishes a known PNG, a missing UUID, and a known asset violating MIME/size/dimensions. The last yields media_constraint. Preserve this conflict when choosing an interoperability target.

The string-format helper accepts any non-UUID string containing :// or /. Such values skip the library lookup. This is more permissive than the UUID baseline and is not URL validation. The checked response returns the raw reference; clients resolve metadata through the library interface separately.

PUT is a separate handler with its own call to the media-assignment helper; the missing-UUID replacement is rejected. Bulk create/update dispatch the individual create/update actions internally. Import calls field validators directly and does not perform this library-assignment lookup. Operation coverage therefore follows the actual handler path, not parser admission.

30.4 SVG validation and transformation

The baseline requires sanitization on write, removal of dangerous markup and external references, and a maxSize bound on submitted markup. The reviewed parser additionally reads these controls:

KeyValueDefault
sanitizeBooleantrue
stripCommentsBooleantrue
stripMetadataBooleantrue
maxSizeByte count or size stringNo explicit bound
allowedElementsArray of tag namesNo explicit allow-list
allowedAttributesArray of attribute namesParsed; not consulted by the validator

The implementation is a regular-expression sanitizer, not an XML parser. It removes paired or self-closing dangerous elements, selected quoted event-handler attributes, and quoted javascript: href values. The dangerous element list includes script, foreignObject, iframe, embed, object, style, and form-related elements. Comment and metadata removal obey their flags.

Three limits matter to the value contract:

  1. Ordinary external HTTPS references survive the checked transformation.
  2. An unquoted event-handler attribute survives the checked transformation.
  3. maxSize is checked after sanitization on the normal write path. Large removed content can therefore reduce to an accepted small stored value.

Consequently, the inherited statement that every external reference is removed, and its blanket guarantee about safe round trips, are not established by this implementation. Treat SVG rendering policy as a separate consumer concern. The examples use inert markup and perform no browser execution or remote fetch.

The validator requires the literal substring <svg, checks the size of the string it receives, rejects remaining dangerous elements, and applies the optional element allow-list. A lowercase <svg root is the reproducible form; this check is not a complete XML well-formedness test. sanitize: false skips transformation but does not itself disable validation.

Create, PATCH, and PUT have explicit sanitization calls. Bulk create delegates to create and the checked bulk write stores the same sanitized value. Import validates the original markup directly: the checked script-bearing import is rejected with IMPORT_VALIDATION_ERROR, while create accepts and sanitizes it. Read-back values in the examples establish actual persisted markup, rather than merely a successful write status.

30.5 Blocks and their registry

A normal blocks value is an ordered JSON array. Each item must be an object with a string type. allowedBlocks restricts the types; omission or an empty list is permissive. maxBlocks bounds the array length. Names are matched case-insensitively against allowed names and available definitions.

The parser supplies these built-ins: paragraph, heading, quote, list, code, image, embed, divider, callout, accordion, and tabs. Domain-level blocks: adds named definitions with label, icon, category, and props. Definitions can be referenced through #/blocks/<Name> during composition; ADL 8 owns reference resolution.

The inherited chapter spells the inline-content flag hasContent. Current model construction reads content and children booleans. That is a grammar mismatch, not permission to silently substitute a new language rule.

# Illustrative registry fragment using the current parser's content spelling.
blocks:
  Notice:
    label: Notice
    content: true
    props:
      title: {type: string, required: true}
      style: {type: string, enum: [info, warning]}

The baseline promises validation of declared prop types. Current block validation checks required and enum properties only when props is already an object. Entirely absent props bypass those checks, and unknown definitions are allowed. Built-ins are registered before custom definitions; lookup takes the first case-insensitive match, so a custom Callout can be shadowed by the built-in callout. Use distinct custom names and check the behavior you need.

Recursive child checks apply only to definitions with children: true, with an implementation depth limit of ten. They do not amount to general nested field validation. The outer field validator also accepts object-form blocks without applying allowedBlocks or maxBlocks; this differs from the array contract. None of these gaps should be presented as a successful validation of the inherited semantics.

30.6 Icons and fonts

iconSets and sets are both read as arrays of allowed set names; if both are present their entries are accumulated. Prefer the inherited iconSets spelling. An empty allowed set is permissive. A domain registry can additionally restrict sets:

# Illustrative domain fragment.
icons:
  sets:
    lucide: {prefix: lucide, source: local}
fonts:
  local: {source: local, provider: local}

Icons require a nonempty string with a colon. The implementation accepts set:name:variant, compares the set against the field allow-list, and, when configured, against domain set names or prefixes. It does not resolve the named icon in a provider. A plausible but nonexistent icon name in an allowed set can pass.

A font field’s sources array is validated. ADL plugin 0.9.1 (2026-09-13) replaced the inert treatment described here through 2026-09-22: the content validator checks the source provider against the accepted set (google, adobe, system, custom), checks URI protocol and host structure for http:// and https:// references, verifies the family against the declared catalogue (preload for Google sources, families for system and custom ones), accepts source-prefixed identifiers such as google:Inter, and gates URL-based references on a custom or URL source being declared (content_validator.cpp, validate_font). It still does not fetch anything over the network, so a family absent from a declared catalogue is caught while a provider’s live availability is not.

30.7 Components and repeaters

Declare nested fields with object:. The baseline requires their ordinary field constraints to apply. Current parsing of nested members retains the name, type, and required flag; it does not recursively call the full field builder. Thus a nested maxLength, numeric bound, enum, deeper object, or ui payload cannot be assumed to reach the runtime model.

The component validator enforces object shape, required members, and basic scalar types for selected types. Although its direct helper supports a string maximum when supplied a populated model, a parsed declaration may have already lost that maximum. The examples specifically separate missing-required-member failure from accepted values exceeding declared nested bounds.

Repeaters apply the component check per item, honor minItems and maxItems, and can check uniqueItems by full JSON equality. For sortable: true, normal writes assign zero-based _order values in array order, overwriting supplied values. Without that flag the write path does not inject ordering metadata. Reordering requires sending the new array. These items have no independent resource identity or generated item API; use relationships when that is needed.

30.8 Diagnostics, persistence, and verification

Content failures normally use 422 VALIDATION_ERROR, with entries such as unknown_media, media_constraint, invalid_ref, svg_too_large, invalid_svg, disallowed_block, too_many_blocks, disallowed_icon_set, required, or too_few_items. A field’s final detail can hide another failure at the same key; ADL 20 explains accumulation limits.

The examples inspect both generated-action results and disposable SQLite rows. They also compare parsed/exported models, retained-source reload, source-free reload, and independent modeller diagnostics. Model export is a distinct projection. The checked export loses domain block, icon, and font registries, image dimensions, font sources, icon sets, and repeater count bounds. Array-media accept moves to the outer field, where the parser does not read it for items. The import feature is exported using retired import, breaking reparse and source-free restoration. Successful export therefore does not establish an equivalent document.

The evidence record contains the commands, source hashes, assertion results, and operation limits. It establishes local native behavior for the checked inputs. It does not certify browser sanitization, upload authorization, byte-provider behavior, all MIME decoders, PostgreSQL behavior, or full nested-schema conformance.