Rxova
Skip to content

StandardSchemaV1

The Standard Schema v1 interface, inlined.

Inlined rather than depended on, which is the whole point of the spec: it is a shape, not a package. Zod, Valibot and ArkType all expose ~standard, so accepting this type means accepting any of them — and any hand-written validator — without this library taking a dependency on, or a position about, which one you use.

Only the parts that are read here are declared. The full spec has more.

Type ParameterDefault type
Inputunknown
OutputInput
readonly ~standard: object;
readonly optional types?: object;
readonly input: Input;
readonly output: Output;
readonly validate: (value) =>
| StandardSchemaResult<Output>
| Promise<StandardSchemaResult<Output>>;
ParameterType
valueunknown

| StandardSchemaResult<Output> | Promise<StandardSchemaResult<Output>>

readonly vendor: string;
readonly version: 1;