Types
The schema type system defines what values are valid for a property. A type is specified via the type field on a Property item, as a URL that identifies the type.
When to reach for it
Set type on a property when the property's value must conform to a specific format — a valid integer, a parseable date, a URL with a scheme. When type is omitted, no type validation runs and any string value is accepted.
Primitive types
Primitive types are hosted at https://schema.host/ and provide built-in format validation at write time.
| Type URL | Short name | Validation rule |
|---|---|---|
https://schema.host/Text |
Text | Any string. No validation. |
https://schema.host/String |
String | Alias for Text. |
https://schema.host/URL |
URL | Must be a valid URL with a scheme (RFC 3986). |
https://schema.host/Number |
Number | Must parse as a floating-point number (f64). |
https://schema.host/Integer |
Integer | Must parse as a 64-bit signed integer (i64). Floats like "3.14" are rejected. |
https://schema.host/FloatingPoint |
FloatingPoint | Same as Number. |
https://schema.host/Boolean |
Boolean | Must be exactly "true" or "false" (lowercase). |
https://schema.host/DateTime |
DateTime | Must be a valid RFC 3339 datetime (e.g. "2024-01-15T10:30:00Z"). Date-only strings are rejected. |
https://schema.host/Date |
Date | Must be YYYY-MM-DD. Full datetimes are rejected. Calendar correctness is enforced (Feb 29 in non-leap years is rejected). |
https://schema.host/Cardinal |
Cardinal | A cardinality string: 0..1, 1..1, 0..n, or 1..n. Used internally by schema definitions. |
Syntax
<meta itemprop="type" content="https://schema.host/Integer">
Validation examples
| Type | Valid | Invalid |
|---|---|---|
| Text | "", "hello", "<b>bold</b>" |
(always passes) |
| URL | "https://example.com", "mailto:a@b.com" |
"not-a-url", "" |
| Number | "42", "3.14", "-7.5" |
"hello", "" |
| Integer | "100", "-42", "0" |
"3.14", "abc", "" |
| Boolean | "true", "false" |
"True", "1", "" |
| DateTime | "2024-01-15T10:30:00Z" |
"2024-01-15", "not-a-date" |
| Date | "2024-01-15", "2024-02-29" (leap year) |
"2023-02-29", "15/01/2024" |
Enum types
An enum is a named type whose valid values are listed explicitly. Declare it as a https://schema.host/Enum item in any schema document, then reference its URL from a property's type:
<div itemscope itemtype="https://schema.host/Enum">
<meta itemprop="name" content="https://example.com/Status">
<meta itemprop="value" content="active">
<meta itemprop="value" content="retired">
</div>
<div itemprop="property" itemscope itemtype="https://pagelove.org/Property">
<meta itemprop="name" content="status">
<meta itemprop="type" content="https://example.com/Status">
</div>
The enum's identifying URL may be declared with itemprop="name" or itemprop="type" — both forms are accepted.
A write whose property value is not in the enum's value list is rejected with a 422 whose message names the offending value and the permitted list:
[https://example.com/Gadget].status: Value "sideways" is not a valid
https://example.com/Status (expected one of: "active", "retired")
Enums declared in your host's own schema documents override a platform enum with the same URL, the same way host-local schemas override system schemas.
Nested schema types
When type is a URL that matches another schema's governed type, the property value must be a nested [itemscope] element with that itemtype. The nested item is validated recursively against its own schema — cardinality, type, @validate, and group constraints all apply.
<div itemprop="property" itemscope itemtype="https://pagelove.org/Property">
<meta itemprop="name" content="address">
<meta itemprop="type" content="https://example.com/Address">
<meta itemprop="cardinality" content="0..1">
</div>
A data item using this property:
<div itemscope itemtype="https://example.com/Person">
<span itemprop="name">Alice</span>
<div itemprop="address" itemscope itemtype="https://example.com/Address">
<span itemprop="street">123 Main St</span>
<span itemprop="city">Springfield</span>
</div>
</div>
The nested Address item is validated against the https://example.com/Address schema. The self binding for a nested schema-level @validate is the nested [itemscope] element, not the parent.
Unknown types
A type URL that matches neither a primitive, a declared enum, nor a known schema is silently ignored — no type validation runs and any value is accepted. This allows forward-compatible use of type URLs before their schemas are defined.
How type validation runs
Type validation runs alongside cardinality checks, before property-level @validate expressions. The check operates on the text value extracted from each [itemprop] element — for elements with a content attribute (e.g. <meta>), the content value is checked; for other elements, the text content is checked.
Type violations are collected together with cardinality violations and reported in a single 422 response, so the reader can fix all shape errors in one pass.
Error cases
| Condition | Result |
|---|---|
| Value fails primitive type validation | 422 with check: "type", message describes the failure. |
| Value is not in a declared enum's value list | 422 with check: "enum", message lists the permitted values. |
Nested item has wrong itemtype |
Treated as a type mismatch. |
| Unknown type URL | No validation (passes). |
type omitted |
No validation (passes). |
See also
- Property — where types are declared
- Schema — the parent schema item
- Schema definitions in HTML — how
pagelove.mjsmaps types to element shapes