Modeling data
Reference for Pagelove's schema system — declaring governed types, enforcing shape, validating business rules, transforming values on the way in and out, and expressing required combinations across properties.
Pages in this group
- Schema — declare a governed type and its properties
- Property — declare a single field with cardinality, type, default, and validator
- Methods — declare a named operation on a type (name, parameters, return, Sessel or JavaScript implementation)
- Types — the primitive types a property can use and how each is stored
- Required combinations — enforce "at least one of these" or "exactly one of these" across several properties of the same item
- Resolvers —
@writeand@readexpressions that transform values at write and read time - Shape Constraint — enforce document structure via CSS selectors
Schema slots (default, @read, @write, @validate) and methods can be written in Sessel or JavaScript. The Sessel forms live here (Resolvers, Methods, defaults). For the JavaScript forms — and the DOM API they use — see the JavaScript → Server pages JavaScript in schemas and the JavaScript DOM API.
What modeling unlocks in pages
Composing a page needs no schema — templates, resource bindings, includes, and expression bindings work on plain HTML and the site graph (see Composing pages). Modeling a type adds capabilities a page can then use:
- Method Elements — invoke a Method you declared on a schema by name (
<prefix:method-name>), replacing the element with its result. - Typed instances — a schema turns documents into governed instances, so a Resource Binding or Templating query selects and renders them as modeled data, and Resolvers transform their values on read.
See also
- Schema definitions in HTML — the
pagelove.mjsclient-side view of schema declarations - Permissions — the authorization rules that sit alongside schema validation