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, that property has no declaration-specific type check. Cardinality, custom validators and other applicable constraints can still refuse a write.

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

A property's type may name another schema's governed URL, and HTML can represent that value as a nested item. The declaration alone is not a recursive-validation guarantee. Do not assume that the nested item must have that type or that its own cardinality, validators and groups automatically run.

<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>

This illustrates nested Microdata, not proof of validation. In application whole-document PUT tests, an Address-typed parent property accepted a different nested itemtype, an invalid or missing required child integer, and a plain-text value. A top-level Address with the invalid integer was rejected with 422, as was a parent missing its required address property. Parent cardinality and nested-child enforcement are separate questions. Add and test explicit checks if your application depends on nested content being valid; these observations do not establish every validator, operation or deployment.

Unknown types

A type URL that matches neither a primitive, a declared enum, nor a known schema is silently ignored — no check for that unknown type runs. Other applicable rules, including cardinality, can still reject the write. This allows forward-compatible use of type URLs before their schemas are defined.

How type validation runs

On a validation path, type checks run with cardinality checks before property-level @validate. Primitive checking uses the property value extracted from its element, which is not always its text content. In whole-document PUT tests, an Integer property accepted <meta content="42">, <data value="42">not an integer</data> and <meter value="42">not an integer</meter> when each had itemprop="value". It refused <data value="bad">42</data> and a span containing nonnumeric text. Use the element-specific Microdata value rules when choosing markup; these examples do not establish recursive validation of nested items or application checks on WebDAV writes.

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 A schema URL alone did not reject this in tested parent PUTs; do not assume a type mismatch is enforced.
Unknown type URL No check for this type declaration; other rules still apply.
type omitted No check for this type declaration; other rules still apply.

See also