Function: validate()
validate<
T>(schema,value,mode):ValidationResult<StaticType<[],"Encode", { }, { },T>>
Defined in: packages/contracts/src/validation.ts:273
Validates a value against a TypeBox schema with Ajv.
Type Parameters
T
T extends TSchema
Parameters
schema
T
A TypeBox schema. Compiled once per schema object and mode.
value
unknown
The untrusted value.
mode
strict for anything you are about to send, lenient for anything
you received. Lenient still enforces every type and every required.
Returns
ValidationResult<StaticType<[], "Encode", { }, { }, T>>
The value, typed, or the issues. Never throws on a bad value.