Skip to content

Function.Schema

github-actions[bot] edited this page Jun 9, 2026 · 19 revisions

umt / Schema

Function: Schema()

Schema<Output>(validator): (target, propertyKey) => void

Defined in: Decorator/Schema.ts:21

Property decorator factory that validates a field against any Standard Schema V1 validator, including every UMT validator (number(), arrayOf(), object(), ...). Only synchronous validators are supported; a validator that returns a Promise is treated as a failure.

Type Parameters

Output

Output

The validated output type.

Parameters

validator

StandardSchemaV1<unknown, Output>

A Standard Schema V1 compatible validator.

Returns

A property decorator.

(target, propertyKey) => void

Example

class Box {
  @Schema(arrayOf(number())) values = [];
}

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally