PreparedDocumentApi

The Document transport of one PreparedModel, speaking A12's canonical Document JSON on both sides. readDocument validates the complete text — parseability, resource limits, model paths, and node types — and only then constructs the snapshot, so a failing input mutates nothing. seedDocument creates the deterministic, complete model-shaped candidate also exposed by dmtool model seed. encodeDocument is the owner-checked read-back: every row, empty cell, and unconverted raw value survives it, and one encode reaches the canonical fixed point.

Functions

Link copied to clipboard
fun encodeDocument(snapshot: DocumentSnapshot): String

Write a snapshot from this prepared owner back as canonical A12 Document JSON.

Link copied to clipboard
@JvmOverloads
fun readDocument(json: String, limits: DocumentDecodeLimits = DocumentDecodeLimits.defaults()): DocumentSnapshot

Read A12 Document JSON into an immutable, owner-bound snapshot. Resource-limit failures are fail-fast; model-aware input diagnostics aggregate so a caller sees every defect at once.

Link copied to clipboard

Create a deterministic, best-effort model-derived candidate Document. It carries every declared group and field, including fieldless groups, and instantiates one row of every repeatable group. Editable source fields receive generated values that respect local formats and bounds where possible; computation-owned targets remain present-empty for the engine to fill. Whole-model rule acceptance is not guaranteed.