Skip to main content

Interface: StandardDataSchema<Value>

Defined in: packages/core/src/standardDataSchema.types.ts:15

A schema core writes itself, such as the one richText() returns. It satisfies both StandardSchemaV1 and StandardJSONSchemaV1, so a block, a catalog entry or an adapter takes it wherever either is accepted — while guaranteeing two things the interfaces leave open.

Type Parameters

Value

Value

What a successful validate yields, and so what a component receives for the field.

Properties

~standard

readonly ~standard: object

Defined in: packages/core/src/standardDataSchema.types.ts:17

The Standard Schema entry point. Everything a consumer reads about the schema is here.

jsonSchema

readonly jsonSchema: Converter

The JSON Schema projection, present rather than optional — what zodAdapter.describe walks to reach the field tree an editing surface renders.

validate

readonly validate: (value) => Result<Value>

Checks a value, synchronously — never a promise, which is what compile requires of any schema it runs. A refusal comes back as issues on the result rather than as a throw.

Parameters
value

unknown

Returns

Result<Value>

vendor

readonly vendor: string

Who wrote the schema, for a tool reporting where a field's rules came from.

version

readonly version: 1

The Standard Schema version this shape speaks.