Skip to content

Schemas

Packages may include JSON Schema documents for custom Dataset kinds. A kind is identified by its id and integer version. Schema bytes are immutable for that version, so any schema change requires a new version. For now even compatible schema changes use a new version rather than a silent in-place update. The Host registers standard kinds, App-provided custom kinds, and extensions in its kind registry during App install or update, not through ad hoc runtime registration.

JSON Schema is the canonical format for durable records, with draft 2020-12 preferred. The Host validates records in Rust on write paths. A schema may include an optional open bag for unconstrained JSON within a version, while important standard fields remain strict. At the Wasm boundary, WIT types may provide typed representations of strict fields; those types must agree with the JSON Schema and do not replace document validation.

Apps may declare projection maps for CardDAV and CalDAV. The Host still applies Views at the Grant boundary, so a projection cannot expand access beyond the granted View.

Schema tooling decision

The project uses JSON Schema without running TypeScript on the Host. Zod may be used for App-author ergonomics only when it emits JSON Schema.

Tool or format Role
JSON Schema documents in the App package Canonical interchange format for stored records
jsonschema for Rust Host validation on write paths
schemars Generate JSON Schema from Rust types for Host-authored standard kinds
typify Optional generation of Rust types from JSON Schema for typed adapters
WIT / wit-bindgen Typed Wasm component boundary; pairs with JSON Schema for strict fields
Zod (TypeScript) Optional App-author tooling that emits JSON Schema; never a Host dependency

See the kind schema tooling research.