ADL 10 · Part II — Data, composition, and evolution

0.5.1 baseline + 0.6 edition note

Type system

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 field type coercion, exact numeric boundaries, and SQLite/PostgreSQL differences. 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 10-type-system.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.

10.1 Scope and authority

A field type specifies the values a client can send, the values it receives, and the constraints a host enforces. Storage choices may differ between adapters; the declared API guarantee must survive those choices. A parser accepting type: decimal does not establish exact decimal writes or reads.

The inherited contract is reduced v0.3.1 Chapter 7 (retired). Draft 05 §18 item 26 retires alternative and nonexistent type spellings; §10.2 adds reference and its stable wire representation. The older chapter’s alias permission is therefore superseded. Its error record (v0.3.1, retired) also identifies an omitted enumRef entry and an unverified blanket claim about ignoring client-supplied generated values.

The edition inventory is 39 canonical type spellings: the inherited 38 plus reference. All 39 occur in the reviewed production parser’s table and pass the chapter’s explicit field-declaration checks. The delta’s parenthetical “37 spellings” and several implementation comments are stale counts; they are not grounds for deleting an existing type. Group names below are reading aids. They assign no capability tier or storage requirement.

ADL 11 owns enumerations; ADL 12 owns relationships and reference binding; ADL 13 owns shared objects and composition; ADL 20 owns validation ordering and cross-field rules; ADL 21 owns permissions; and ADL 32 owns the complete generated OpenAPI contract.

10.2 Field declarations and accepted vocabulary

Declare resource fields beneath domain.resources.<Resource>.object. Use a mapping with an explicit, canonical lowercase type; the remaining keys describe constraints, generation, or metadata. This fragment declares two fields, not a complete domain:

code: { type: string, required: true, maxLength: 24 }
unitPrice: { type: decimal, precision: 19, scale: 4, default: "0.0000" }

type is a type name, precision and scale are integer declarations, required is a boolean, and the decimal default is text. A resource name, enum name, shared-object name, or plugin name is not an additional primitive type. Use the owning declaration mechanism to reference such definitions.

The vocabulary is closed. An unknown type is an authoring error, and the retired spellings in §10.11 are rejection cases. enum is a constraint/declaration construct, not a field type. vector is deferred; the informative ADL 43 pattern does not add it to the vocabulary.

Observed parser limits. The checked parser accepts INTEGER and binds it to integer. Missing type and a non-string type: 123 silently bind to string. Scalar shorthand value: integer also works, but value: int silently binds to string, bypassing the explicit mapping’s rejection. These fallbacks do not make malformed declarations portable. Complete examples in this chapter use explicit mappings.

10.3 Complete type inventory

The JSON column describes the inherited language contract, with the v0.5.1 reference amendment. It is not a transcription of generated schemas. The last column points out checked disagreements or the limit of the evidence; an empty disagreement is not a claim that all values or operations were tested.

TypeGroupContract JSON and meaningChecked boundary
stringCoreString; short text, default maxLength: 255Implicit 255 limit absent; §10.4
textCoreString; long text, no default length limitRepresentative string accepted
integerCoreNumber; signed 64-bit whole valuePast-int64 input refused too_large; §10.4
decimalCoreString; exact decimalNumeric schema/output and precision loss; §10.4
booleanCoreBoolean; inherited input also permits 1/0Numeric 1 rejected by field validator
dateCoreString; calendar dateRegex accepts an impossible date
datetimeCoreString; timestamp with timezoneRegex accepts impossible components
uuidCoreString; inherited UUID v4 identityValidator accepts another UUID version; generation is separate
emailCoreString; inherited RFC 5322 address requirementRepresentative address accepted; full RFC coverage untested
urlCoreString; absolute URL with schemeValidator restricts to HTTP(S)
floatExtendedNumber; binary floating pointNumeric output; unsuitable for an exact money contract
timestampExtendedNumber; Unix epoch secondsNumeric input, string output, date-time schema disagree
slugExtendedString; URL-safe text, generation through fromGeneration qualifications in §10.7
jsonExtendedObject; arbitrary untyped contentsValidator also accepts scalars and JSON text
markdownExtendedString; raw MarkdownNo rendering contract
autoincrementExtendedNumber; server-assigned, read-only, never reusedSupplied ID ignored in tested create; non-reuse untested
phoneSpecializedString; author pattern, no inherited E.164 assumptionBuilt-in phone pattern narrows accepted values
timeSpecializedString; time of dayRepresentative time accepted; full format coverage untested
passwordSpecializedString in; absent out; hashed on writeResponse omission works; tested storage is plaintext
tokenSpecializedString; generated, read-only after createSchema says write-only; row helper returns supplied stored token
arraySpecializedArray; typed listItem validation coverage varies; §10.5
moneyDomainString; exact value, implicit precision 19/scale 4SQLite round trip loses digits
percentageDomainNumber; percentageChecked validator/schema impose 0–100
currencyDomainString; inherited ISO 4217, three uppercase lettersShape validation does not establish code membership
countryDomainString; inherited ISO 3166-1 alpha-2Shape validation, not a verified code registry
languageDomainString; inherited ISO 639-1, two lowercase lettersValidator rejects en-US; schema describes BCP 47
timezoneDomainString; inherited IANA identifierShape validation accepts Nowhere/Imaginary
colorDomainString; inherited #RRGGBBSchema keeps that shape; validator source accepts wider CSS forms
bytesDomainString; inherited base64 and maxSizeRuntime instead treats it as a numeric byte count
setDomainArray; uniqueness always requiredDuplicate string values rejected
mediaContentObject; file referenceValidator/schema expect a string reference
svgContentString; sanitized on writeSanitization was not exercised
blocksContentArray; block documentValidator also accepts an arbitrary object
iconContentString; set:name, constrained by iconSetsRepresentative value accepted
fontContentString; family, origins constrained by sourcesRepresentative value accepted
componentContentObject; one nested objectNested declaration loses constraints beyond its small parsed subset
repeaterContentArray; ordered nested objectsBare declaration generates object schema; §10.5
geometrySpatialObject; GeoJSON geometryRepresentative point accepted; spatial operations untested
referenceReferenceString; canonical address:uuidScalar shape validation does not prove target binding

The generated catalog retains all 39 declaration results, schemas, dialect type names, sample validation results, and row-helper output. Its sample media:example is deliberately an observed value rejection (invalid_ref), despite successful declaration parsing.

10.4 Scalar constraints and exact numeric values

Text constraints include minLength, maxLength, pattern, trim, lowercase, uppercase, and enum. Numeric constraints include min and max; decimal additionally uses precision and scale. The inherited contract also allows ISO-form min/max bounds for dates and times. Parsing a constraint without enforcing it is a host defect under the inherited contract.

Exact values need attention at every boundary: document ingestion, default binding, request validation, storage, and response serialization. Quote decimal defaults in YAML and send decimal/money request values as JSON strings. ADL 9 documents the separate loss that can occur before canonical hashing. Quoting the input avoids that ingestion loss; it does not repair the checked runtime’s storage or output conversions.

In the disposable SQLite sequence, fields declared with precision 19 and scale 4 produced these generated-action results:

FieldSubmitted JSON valueStored row textReturned JSON value
amount: decimal"0.10000000000000001"0.10.1 — number
price: money"12345678901234.5678"12345678901234.6"12345678901234.6" — string
epoch: timestamp100100"100" — string
byteCount: bytes1212"12" — string
flag: booleantruetruetrue — boolean

The decimal payload deliberately exceeds the declared scale. Accepting and rounding it is evidence of missing scale enforcement, not a valid precision-19, scale-4 example. The money payload fits 19 total digits and four fractional digits, yet still loses precision. Create, get, and a label-only update retain these observations. The tested SQL dialect maps both types to SQLite REAL. The PostgreSQL helper reports NUMERIC and NUMERIC(19,4) respectively; no PostgreSQL database was exercised, and those type names alone prove no API guarantee.

integer is a signed 64-bit value on every store (#1410). PostgreSQL stores it, and autoincrement, as BIGINT, whatever min/max declare; SQLite’s INTEGER is already 64-bit. A JSON whole number above 9223372036854775807 is refused with too_large (422) before it reaches the database. Before the fix PostgreSQL used a 32-bit INTEGER, so a value such as a 3000000000 image seed failed with a 500, and SQLite stored 2^64−1 as a mangled float. Repro 37 shows both.

A PostgreSQL table created before this change keeps its 32-bit columns: the migration planner does not widen a column it did not create. Widen one by hand when its values need the room:

ALTER TABLE <table> ALTER COLUMN "<field>" TYPE BIGINT;

Other direct validator observations establish narrower limits:

Input/declarationObserved result and implication
Decimal "12.3456", precision 5/scale 2Accepted; those declarations do not enforce digit counts here
Decimal or money "NaN"Accepted through numeric parsing; text input is not an exact finite-decimal validator
Money JSON number 100000000000000Rejected with precision_loss; this guard does not make other numeric inputs exact
String of 256 characters, no maxLengthAccepted; the inherited default of 255 is not installed
"é", maxLength: 1Rejected with too_long; checked length is UTF-8 bytes
2026-02-31 dateAccepted; calendar validity is not established by the regex
2026-99-99T99:99:99Z datetimeAccepted; component ranges are not fully checked
Timestamp 1.5Accepted; the current validator does not require an integer
ftp://example.test/file URLRejected with invalid_url; broader absolute-URL contract is not implemented
(202) 555-0123 phoneRejected with invalid_phone; built-in pattern applies without an authored one
SGVsbG8= bytesRejected with invalid_type; inherited base64 contract is not implemented here

The reviewed parser only binds numeric min/max values, so ISO-string bounds are not represented by that path. External-standard names in the inventory identify inherited ADL requirements; these checks do not independently validate the current contents of an ISO/IANA registry or full RFC grammar.

10.5 Arrays, sets, and nested objects

Use array with items: { type: string } for a typed sequence. minItems and maxItems bound its length; uniqueItems: true disallows duplicates. set uses an array representation with uniqueness always enforced. The name does not authorize arbitrary reordering of the array or its canonical bytes.

Use component with object: for one nested object and repeater with object: for an ordered sequence of them. A shared-object $ref may supply that object definition through ADL 13. A nested value has no independent record identity or relationship target. The inherited contract stores and returns it whole and does not give its members independent filtering or query endpoints. Use a resource and relationship when that API is required.

The complete example in §10.10 includes all three shapes. Observed limits:

  • set rejects duplicate strings, and a required nested member rejects when absent. These paths were exercised directly.
  • The reviewed nested parser retains name, type, and required, but does not carry the full field constraint model. A nested minLength: 5 accepts "x" and is absent from the generated schema. Deeper constraint guarantees are therefore not established by accepting the enclosing component.
  • items.type: int escapes declaration rejection and binds to string; a numeric array item then fails invalid_item_type. Explicit nested object fields using type: int do reject at declaration time.
  • items.type: reference with numeric item 7 passes this validator. The item model is not equivalent to a complete reference-field declaration.
  • A bare type: repeater produces an object schema in the checked generator, while the supplied array value is accepted. The complete example’s repeater has an object: definition and produces an array schema. Schema shape must be checked with the actual declaration.

These differences are recorded defects or coverage limits, not permission to replace nested constraints with documentation hints.

10.6 Presence, null, defaults, and field constraints

Omission and explicit null are distinct inputs. A default applies when the field is omitted on create. A partial update omitting a field leaves its value unchanged; it does not ask to clear the value or rerun a create default.

KeyInherited contract/defaultVerification boundary
requiredPresent and non-null on create; false by defaultMissing/null rejected by direct validator when no default exists
notBlankNot null, "" or whitespace-only; false by default (#1537)Refused with 422, detail code blank on the field; checked after trim, lowercase and uppercase
nullableExplicit null allowed; true unless requiredDirect helper misses an explicit false flag; actual update rejects null
defaultSupplies an omitted create valueBound scalar defaults recorded; not every default shape is implemented
uniqueNo other record shares the value; false by defaultRequires stored-data checks; not proved by scalar validation
immutableChanging the value after create is rejected with 422; false by defaultGeneral immutable-field write combinations not exercised here
primaryKeyRecord identityUUID/autoincrement create behavior checked separately in §10.7

The direct helper accepts null for nullable: false when the field is not required. It also accepts null for a required field with default ready. Neither observation establishes that the full write succeeds. In the generated action sequence, an explicit null update to a non-nullable field returns 422 REQUIRED_FIELD, and the following get retains the old value. A label-only update also succeeds without resupplying the other fields.

Current model binding stores scalar defaults as text: booleans become 1/0, numbers are converted to text, and strings retain their contents. Null and structured defaults are not carried by this path. An array default ["x"] becomes an empty default field in the model. An empty-string default is also indistinguishable there from no default, and does not satisfy the direct helper’s required-field check. Authors and schema reviewers must not infer a working default solely from its presence in the source document.

required is presence only: it accepts "" and " ". notBlank: true is the stricter check most human-entered names, titles and bodies want, matching Rails presence: true and Django blank=False (#1537). A create that omits the field, or sends null, "" or only whitespace, is refused with 422 VALIDATION_ERROR whose detail names the field with code blank; a default that fills an omitted field satisfies it. A partial update that omits the field leaves it alone, and one that sends a blank value is refused. Because it runs after the string transforms (§10.4), trim: true makes no difference to which values it refuses. A custom message goes under messages: {notBlank: ...}.

enum and enumRef constrain the values of an existing field type. The inherited summary omitted enumRef; it is included here by reference to ADL 11. Domain enum values: uses the mapping form under Draft 05 §18 item 25. This chapter does not reproduce or amend all enum binding forms, nor does it introduce type: enum.

10.7 Identity and server-assigned values

Generation is a field behavior layered on a type. An ordinary UUID field is not automatically a primary key, and a UUID’s lexical validity does not prove that a referenced row exists. ADL 7 §7.5 owns UUIDs inside reference literals.

DeclarationInherited assignmentChecked behavior or limit
UUID with primaryKey: trueGenerated identity unless allowUserProvided: trueOmitted ID generated; supplied ID rejected with 400 PK_REJECTED
autoincrement primary keyNext server integer; read-only, never reusedSupplied 900 ignored; fresh temporary table returns 1
autoNow: createCurrent time on create, retained thereafterSupplied year-2000 value overwritten; label update retains generated time
autoNow: alwaysCurrent time on create and updateSource-supported mechanism; not exercised in this sequence
slug with from:Derived slug; inherited regeneration and collision suffix rulesSource accepts an explicit nonempty slug on create; regeneration/collision guarantees not rechecked
tokenRandom value on create, read-only afterwardGeneration and immutability not exercised

The legacy sentence saying every submitted generated value is “ignored, not rejected” cannot describe the observed UUID behavior. Its own error record already marked it unverified. This draft preserves the discrepancy for amendment review and reports operation-specific outcomes. It does not invent a universal policy for all generated fields.

Likewise, successful creation in a fresh autoincrement table proves neither non-reuse after deletion nor behavior after import, rollback, or migration. The parser’s additional autoNow: update handling is implementation evidence; it is not added to the inherited generation table as an edition amendment.

10.8 Reference fields

The v0.5.1 declaration pairs type: reference with a resource address in references:. This is a fragment from the complete reference example:

customer:
  type: reference
  references: "adl.core.party.Person"

The corresponding non-null value has the form adl.core.party.Person:11111111-1111-4111-8111-111111111111. references: identifies a declaration; the value identifies a row. Neither uses a physical table name, and a UUID field is not a substitute for a reference field carrying the complete address string.

Draft 05 §10.2 requires the same logical and wire representation for co-located and remote targets. A host may use UUID storage plus binding metadata locally, but clients still send and receive address:uuid. Binding selection must be recorded in the resolved artifact. A change of physical binding is a migration that preserves the logical value and rejects untranslatable values before applying. ADL 12 owns integrity, binding, and authority; ADL 8 owns reuse and dependency loading.

The strict parser rejects a missing references:, a non-resource address adl.core.party, and references: attached to type: uuid. Its field validator accepts a syntactically shaped reference whose address names a different target from the field declaration. That scalar check proves neither target agreement, existence, import authorization, version-pin selection, nor remote access. This chapter performs no reference write or remote dereference.

10.9 Visibility, passwords, and content boundaries

The inherited visibility declarations may appear on the field or inside security:. internal prevents client serialization under every projection; hidden omits the field by default; requestable permits explicitly requesting a hidden field and defaults to false. mask is an advisory display hint: it does not itself remove the value from storage or responses. Endpoint access and field authorization remain ADL 21 concerns.

password has the stronger type contract: it must never appear in a response, including an explicit fields request, and must be hashed on write. The checked create, get, requested-fields get, update, and subsequent get all omit the password. The generated read schema also excludes it.

Storage finding: the same disposable sequence stores the synthetic value chapter-only-password verbatim. Response omission therefore works at the tested surfaces while the inherited hashing-on-write guarantee fails on that generated-action path. No authentication plugin or separate account-management path was tested. No runtime hashing fix is included in this documentation.

For token, the field schema carries writeOnly, but the generic response filter returns the synthetic stored token. Its schema flag is not evidence of runtime omission. This is separate from the inherited token contract, which permits a string response and requires generation and write restrictions.

Content semantics need their owning checks. ADL 30 owns content types; ADL 41 owns file references; ADL 42 owns spatial declarations; and ADL 45 owns privacy declarations. Acceptance of sample SVG, blocks, media, or geometry is not proof of sanitization, file access controls, valid spatial operations, or rendering.

10.10 Complete example and observable outputs

This complete inventory.yaml uses baseline constructs and declares adl: "0.5.0". The edition’s newer constructs use the separate adl: "0.5.1" reference fixture. Language version is distinct from the domain’s version, as specified in ADL 6.

adl: "0.5.0"
domain:
  name: inventory
  version: "1.0.0"
  resources:
    Item:
      object:
        id: { type: uuid, primaryKey: true }
        code: { type: string, required: true, maxLength: 24 }
        available: { type: boolean, default: true }
        quantity: { type: integer, min: 0 }
        unitPrice: { type: decimal, precision: 19, scale: 4, default: "0.0000" }
        insuredValue: { type: money, precision: 19, scale: 4 }
        labels:
          type: set
          items: { type: string }
          maxItems: 8
        dimensions:
          type: component
          object:
            description: { type: string, required: true }
            length: { type: decimal }
        lines:
          type: repeater
          minItems: 1
          object:
            sku: { type: string, required: true }
            quantity: { type: integer, required: true }

The strict production adapter, production CLI, and adl-ref accept this document; the CLI and modeller report no warnings. That demonstrates declaration coverage, not complete enforcement of the numeric or nested constraints.

wire.yaml supplies the separate, disposable generated-action fixture. It installs a Record resource with explicit admin permissions. The adapter supplies a synthetic admin identity and invokes generated actions through the core request dispatcher; it does not send HTTP requests or test authentication. It records create/read/update responses and raw stored rows. The actual response values are in §10.4 and the JSON verification record.

The generated schema has its own evidence boundary. Decimal is described as a number/double, money as a string, timestamp as a date-time string, bytes as an integer, and media as a string. Those outputs conflict with parts of the inherited contract and, for timestamp/bytes, with actual response value shapes. A schema generator and a row serializer agreeing on one type does not establish agreement for the remaining inventory.

10.11 Diagnostics and migration

Replace these spellings before submitting an explicit field declaration. The table includes the twelve retired aliases and the three names that the delta classifies as never having been types. Where a replacement requires a modeling choice, do not perform an unqualified text substitution.

Rejected spellingCanonical replacement or decision
intinteger
bigintinteger; already signed 64-bit on every store
boolboolean
numberChoose integer, float, or decimal for the value contract
idChoose uuid or autoincrement and declare identity explicitly
objectChoose untyped json or a typed object through composition
doublefloat
mdmarkdown
auto_incrementautoincrement
percentpercentage
colourcolor
langlanguage
tztimezone
filesizebytes; review the documented base64/byte-count contract conflict
geojsongeometry

All fifteen explicit mapping forms reject in the strict adapter with a did-you-mean diagnostic. vector, enum, and misspelled decmial also reject. The checked non-strict path accepts bool, warns, and binds it to string. That degradation is not alias resolution to boolean and does not prove that an authoring interface enforces strict admission.

The complete reject-alias.yaml exposes an entry-point disagreement: the strict adapter rejects int, while the production CLI exits 0 with warning W001. adl-ref exits 1 with UNKNOWN_TYPE. The reference example is accepted by the production paths but adl-ref reports UNKNOWN_TYPE and an unknown references key. That latter result is a modeller coverage limit, not evidence that v0.5.1 forbids reference fields.

Field-validator errors such as required, invalid_type, too_long, and duplicate_items are per-field results at a helper boundary. They are distinct from generated-action response codes such as PK_REJECTED and REQUIRED_FIELD. ADL 31 owns the client error envelope; this chapter does not assign HTTP status to every parser/helper diagnostic.

10.12 Verification and remaining review

The evidence record preserves 109 adapter cases, including all 39 canonical declarations, all fifteen retired/never-type spellings, boundary inputs, and three SQLite action sequences; six CLI/modeller commands; and 64 passing existing Release tests. The example instructions explain reproduction.

Reviewed source and archived adapter headers use 2cae30f6. Existing compiled libraries, test executables, and CLI are identified by separate hashes; a fresh production build of that revision is not claimed. The source register records the 21 reviewed files while the shared checkout continues to change.

Publication review must resolve the stale count, inherited wire-contract conflicts, exact-value enforcement, nested/default handling, password hashing, and server-assigned-value policy. Schema and implementation defects need their own fixes and verification. General immutable/unique enforcement, slug collision handling, token generation, SVG sanitization, all reference-binding modes, PostgreSQL execution, and live HTTP remain outside this chapter’s executed evidence. Draft 1 is a reviewed account of the requirements and these limits, not a certification of the whole host.