Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/valibot/mod.ts>required

The modular and type safe schema library for validating structural data 🤖
Extremely Popular
Go to Latest
function required
import { required } from "https://deno.land/x/valibot@v0.28.1/mod.ts";

Creates an object schema consisting of all properties of an existing object schema set to none optional.

Type Parameters

TSchema extends ObjectSchema<any, any>

Parameters

schema: TSchema

The affected schema.

optional
pipe: Pipe<ObjectOutput<Required<TSchema["entries"]>, undefined>>

A validation and transformation pipe.

Returns

ObjectSchema<Required<TSchema["entries"]>>

An object schema.

Creates an object schema consisting of all properties of an existing object schema set to none optional.

Type Parameters

TSchema extends ObjectSchema<any, any>

Parameters

schema: TSchema

The affected schema.

optional
message: ErrorMessage

The error message.

optional
pipe: Pipe<ObjectOutput<Required<TSchema["entries"]>, undefined>>

A validation and transformation pipe.

Returns

ObjectSchema<Required<TSchema["entries"]>>

An object schema.

Creates an object schema consisting of all properties of an existing object schema set to none optional.

Type Parameters

TSchema extends ObjectSchema<any, any>
TRest extends BaseSchema | undefined

Parameters

schema: TSchema

The affected schema.

rest: TRest

The object rest.

optional
pipe: Pipe<ObjectOutput<Required<TSchema["entries"]>, TRest>>

A validation and transformation pipe.

Returns

ObjectSchema<Required<TSchema["entries"]>, TRest>

An object schema.

Creates an object schema consisting of all properties of an existing object schema set to none optional.

Type Parameters

TSchema extends ObjectSchema<any, any>
TRest extends BaseSchema | undefined

Parameters

schema: TSchema

The affected schema.

rest: TRest

The object rest.

optional
message: ErrorMessage

The error message.

optional
pipe: Pipe<ObjectOutput<Required<TSchema["entries"]>, TRest>>

A validation and transformation pipe.

Returns

ObjectSchema<Required<TSchema["entries"]>, TRest>

An object schema.