Literal Schema
The variant for a literal — a schema that accepts exactly one value, with a description of what that value means.
Fetching schema…

Literal — a schema that accepts exactly one value, written as the value itself ("Change", 1, true, null) or as {value, description} when the value deserves an explanation. Only a string, integer, boolean, or null can be a literal. (the schema language)

A literal schema accepts exactly one value. Most of the time it is written as the value itself — "draft", 1, true, null — and needs no variant at all: a bare string, integer, boolean, or null is a schema. This variant is the long form, {value, description}, for a literal that deserves an explanation, such as one choice among several in a union.

A fixed set of choices is a union of literals: {"anyOf": ["draft", {"value": "published", "description": "Visible to everyone"}, "archived"]}. The editors show such a union as a dropdown, with each description beside its option. A field pinned to one value — the type tag of every signed blob, the key of every RPC method — is simply that literal: "type": {"value": "Change", "required": true}.

A literal can only be a value: a string, an integer, a boolean, or null. A map literal would be indistinguishable from a schema, and a float compares badly.

Shape

A closed struct with these fields:

    value (required) — value — The one value this schema accepts: a string, integer, boolean, or null.

    description — string — What this value means, for people and for the editors that offer it.

Depends on

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

Unsubscribe anytime

Connections0
Linked document · Outgoing linkLinked documentLinked document · Outgoing linkLinked documentLiteral SchemaLiteral Schema
Citations 0Children & links 2

Loading child documents…

Connections show where other documents or comments link to this document.

Related documents

Loading connections…