Scalar schema
The variant for a null, boolean, integer, float, string or bytes value, optionally narrowed by value constraints.

Extends · closed

A variant of the — one of the shapes a schema is allowed to take.
type
The scalar kind the value must be: `null`, `boolean`, `integer`, `float`, `string` or `bytes`.
one of null | boolean | integer | float | string | bytes
minLength
Minimum length of a string value, counted in code points.
optional
maxLength
Maximum length of a string value, counted in code points.
optional
pattern
An unanchored ECMAScript regular expression a string value must match; an uncompilable pattern is ignored.
optional
format
A semantic hint for editors/renderers — the value is still a plain string. Known: `hm-url` (a Hypermedia document reference), `hm-profile` (an account reference), `ipfs-url` (an ipfs://<cid> reference to a file or DAG-CBOR object), `url` (a URL of any scheme), `date` (an ISO 8601 `YYYY-MM-DD` calendar date), `date-time` (an RFC 3339 instant).
optional
target
For a reference-valued string (`format: hm-url` or `format: ipfs-url`): the schema the referenced document or object is expected to conform to — an `hm://` schema-document URL or `ipfs://<cid>`. Advisory: an editor pre-seeds and validates the target against it; a validator does not dereference the reference.
optional
minimum
The smallest number an integer or float value may be (inclusive).
optional
maximum
The largest number an integer or float value may be (inclusive).
optional
description
What the value is for, when it is written inline; a published schema is described by its page.
optional
params
Type parameters that make this schema generic, each with its default schema.
⟨ * : ⟩optional
name
Legacy: a name some published schemas still carry. New schemas are named by their page.
optional

A scalar schema types one of the six scalar kinds. Value constraints such as minLength, pattern and minimum can narrow it. To pin a scalar to one value, use a literal.

This document describes the schema/scalar-schema type, one variant of the meta-schema. Its formal schema is attached as the schemaDefinition in this document's metadata, so the app can show it and create values of this type. Typed documents explains how that works.

See also

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime