Struct schema
The variant for a struct, with known fields under properties and optionally extra keys of one type under values.

Extends · closed

A variant of the — one of the shapes a schema is allowed to take.
type
Always the struct core type.
struct
properties
The fields by name: each a property with its value schema, whether it is required, and a description.
⟨ * : ⟩optional
values
Opens the struct: keys other than the named fields are allowed and their values must match this schema.
optional
description
What the struct is for, when it is written inline; a published schema is described by its page.
optional
params
Type parameters of a generic struct, each with its default schema.
⟨ * : ⟩optional
name
Legacy: a name some published schemas still carry. New schemas are named by their page.
optional

This is the shape a schema takes when it describes a struct. type is struct. properties names the fields, with one property per field. Each property carries its value schema, whether a value must include it, and a description. An optional values opens the struct to further keys of one type. Like every variant, a struct schema is a closed struct itself, so a stray keyword is rejected.

See also

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

Unsubscribe anytime