Interface: ObjectValidator<T, I>
Defined in: projects/shapeshift/src/validators/ObjectValidator.ts:15
Extends
Type Parameters
| Type Parameter | Default type | 
|---|---|
| Textendsobject | - | 
| I | UndefinedToOptional<T> | 
Properties
constraints
protectedconstraints: readonlyIConstraint<I,I>[] =[]
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:19
Inherited from
description?
optionaldescription:string
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:16
Inherited from
isValidationEnabled
protectedisValidationEnabled:null|boolean| () =>boolean=null
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:20
Inherited from
BaseValidator.isValidationEnabled
parent?
protectedoptionalparent:object
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:18
Inherited from
shape
readonlyshape:MappedObjectValidator<T>
Defined in: projects/shapeshift/src/validators/ObjectValidator.ts:16
strategy
readonlystrategy:ObjectValidatorStrategy
Defined in: projects/shapeshift/src/validators/ObjectValidator.ts:17
validatorOptions
protectedvalidatorOptions:ValidatorOptions
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:17
Inherited from
BaseValidator.validatorOptions
Accessors
shouldRunConstraints
Get Signature
get
protectedshouldRunConstraints():boolean
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:143
Returns
boolean
Inherited from
BaseValidator.shouldRunConstraints
Methods
addConstraint()
protectedaddConstraint(constraint:IConstraint<I>,validatorOptions:ValidatorOptions):this
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:155
Parameters
| Parameter | Type | 
|---|---|
| constraint | IConstraint<I> | 
| validatorOptions | ValidatorOptions | 
Returns
this
Inherited from
array()
array(
options:ValidatorOptions):ArrayValidator<I[]>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:44
Parameters
| Parameter | Type | 
|---|---|
| options | ValidatorOptions | 
Returns
ArrayValidator<I[]>
Inherited from
clone()
protectedclone():this
Defined in: projects/shapeshift/src/validators/ObjectValidator.ts:172
Returns
this
Overrides
default()
default(
value:Exclude<I,undefined> | () =>Exclude<I,undefined>,options:ValidatorOptions):DefaultValidator<Exclude<I,undefined>>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:81
Parameters
| Parameter | Type | 
|---|---|
| value | Exclude<I,undefined> | () =>Exclude<I,undefined> | 
| options | ValidatorOptions | 
Returns
DefaultValidator<Exclude<I, undefined>>
Inherited from
describe()
describe(
description:string):this
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:96
Parameters
| Parameter | Type | 
|---|---|
| description | string | 
Returns
this
Inherited from
extend()
extend<
ET>(schema:ObjectValidator<ET,UndefinedToOptional<ET>> |MappedObjectValidator<ET>,options:ValidatorOptions):ObjectValidator<T&ET>
Defined in: projects/shapeshift/src/validators/ObjectValidator.ts:113
Type Parameters
| Type Parameter | 
|---|
| ETextendsobject | 
Parameters
| Parameter | Type | 
|---|---|
| schema | ObjectValidator<ET,UndefinedToOptional<ET>> |MappedObjectValidator<ET> | 
| options | ValidatorOptions | 
Returns
ObjectValidator<T & ET>
getValidationEnabled()
getValidationEnabled():
null|boolean
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:139
Returns
null | boolean
Inherited from
BaseValidator.getValidationEnabled
handle()
protectedhandle(value:unknown):Result<I,ValidationError|CombinedPropertyError>
Defined in: projects/shapeshift/src/validators/ObjectValidator.ts:141
Parameters
| Parameter | Type | 
|---|---|
| value | unknown | 
Returns
Result<I, ValidationError | CombinedPropertyError>
Overrides
ignore()
ignore(
options:ValidatorOptions):this
Defined in: projects/shapeshift/src/validators/ObjectValidator.ts:89
Parameters
| Parameter | Type | 
|---|---|
| options | ValidatorOptions | 
Returns
this
is()
is<
R>(value:unknown):value is R
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:124
Type Parameters
| Type Parameter | Default type | 
|---|---|
| R | I | 
Parameters
| Parameter | Type | 
|---|---|
| value | unknown | 
Returns
value is R
Inherited from
nullable()
nullable(
options:ValidatorOptions):UnionValidator<null|I>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:36
Parameters
| Parameter | Type | 
|---|---|
| options | ValidatorOptions | 
Returns
UnionValidator<null | I>
Inherited from
nullish()
nullish(
options:ValidatorOptions):UnionValidator<undefined|null|I>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:40
Parameters
| Parameter | Type | 
|---|---|
| options | ValidatorOptions | 
Returns
UnionValidator<undefined | null | I>
Inherited from
omit()
omit<
K>(keys: readonlyK[],options:ValidatorOptions):ObjectValidator<{ [Key in string | number | symbol]: I[Key] }>
Defined in: projects/shapeshift/src/validators/ObjectValidator.ts:131
Type Parameters
| Type Parameter | 
|---|
| Kextendsstring|number|symbol | 
Parameters
| Parameter | Type | 
|---|---|
| keys | readonly K[] | 
| options | ValidatorOptions | 
Returns
ObjectValidator<{ [Key in string | number | symbol]: I[Key] }>
optional()
optional(
options:ValidatorOptions):UnionValidator<undefined|I>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:32
Parameters
| Parameter | Type | 
|---|---|
| options | ValidatorOptions | 
Returns
UnionValidator<undefined | I>
Inherited from
or()
or<
O>(...predicates: readonlyBaseValidator<O>[]):UnionValidator<I|O>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:52
Type Parameters
| Type Parameter | 
|---|
| O | 
Parameters
| Parameter | Type | 
|---|---|
| ... predicates | readonly BaseValidator<O>[] | 
Returns
UnionValidator<I | O>
Inherited from
parse()
parse<
R>(value:unknown):R
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:114
Type Parameters
| Type Parameter | Default type | 
|---|---|
| R | I | 
Parameters
| Parameter | Type | 
|---|---|
| value | unknown | 
Returns
R
Inherited from
partial()
partial(
options:ValidatorOptions):ObjectValidator<{ [Key in string | number | symbol]?: I[Key] }>
Defined in: projects/shapeshift/src/validators/ObjectValidator.ts:97
Parameters
| Parameter | Type | 
|---|---|
| options | ValidatorOptions | 
Returns
ObjectValidator<{ [Key in string | number | symbol]?: I[Key] }>
passthrough()
passthrough(
options:ValidatorOptions):this
Defined in: projects/shapeshift/src/validators/ObjectValidator.ts:93
Parameters
| Parameter | Type | 
|---|---|
| options | ValidatorOptions | 
Returns
this
pick()
pick<
K>(keys: readonlyK[],options:ValidatorOptions):ObjectValidator<{ [Key in string | number | symbol]: I[Key] }>
Defined in: projects/shapeshift/src/validators/ObjectValidator.ts:121
Type Parameters
| Type Parameter | 
|---|
| Kextendsstring|number|symbol | 
Parameters
| Parameter | Type | 
|---|---|
| keys | readonly K[] | 
| options | ValidatorOptions | 
Returns
ObjectValidator<{ [Key in string | number | symbol]: I[Key] }>
required()
required(
options:ValidatorOptions):ObjectValidator<{ [Key in string | number | symbol]-?: I[Key] }>
Defined in: projects/shapeshift/src/validators/ObjectValidator.ts:102
Parameters
| Parameter | Type | 
|---|---|
| options | ValidatorOptions | 
Returns
ObjectValidator<{ [Key in string | number | symbol]-?: I[Key] }>
reshape()
Call Signature
reshape(
cb: (input:I) =>Result<I>,options?:ValidatorOptions):this
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:67
Parameters
| Parameter | Type | 
|---|---|
| cb | ( input:I) =>Result<I> | 
| options? | ValidatorOptions | 
Returns
this
Inherited from
Call Signature
reshape<
R,O>(cb: (input:I) =>R,options?:ValidatorOptions):BaseValidator<O>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:68
Type Parameters
| Type Parameter | Default type | 
|---|---|
| RextendsResult<unknown,Error> | - | 
| O | InferResultType<R> | 
Parameters
| Parameter | Type | 
|---|---|
| cb | ( input:I) =>R | 
| options? | ValidatorOptions | 
Returns
Inherited from
run()
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:102
Parameters
| Parameter | Type | 
|---|---|
| value | unknown | 
Returns
Inherited from
set()
set(
options:ValidatorOptions):SetValidator<I>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:48
Parameters
| Parameter | Type | 
|---|---|
| options | ValidatorOptions | 
Returns
SetValidator<I>
Inherited from
setParent()
setParent(
parent:object):this
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:27
Parameters
| Parameter | Type | 
|---|---|
| parent | object | 
Returns
this
Inherited from
setValidationEnabled()
setValidationEnabled(
isValidationEnabled:null|boolean| () =>boolean):this
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:133
Sets if the validator should also run constraints or just do basic checks.
Parameters
| Parameter | Type | Description | 
|---|---|---|
| isValidationEnabled | null|boolean| () =>boolean | Whether this validator should be enabled or disabled. You can pass boolean or a function returning boolean which will be called just before parsing. Set to nullto go off of the global configuration. | 
Returns
this
Inherited from
BaseValidator.setValidationEnabled
strict()
strict(
options:ValidatorOptions):this
Defined in: projects/shapeshift/src/validators/ObjectValidator.ts:85
Parameters
| Parameter | Type | 
|---|---|
| options | ValidatorOptions | 
Returns
this
transform()
Call Signature
transform(
cb: (value:I) =>I,options?:ValidatorOptions):this
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:56
Parameters
| Parameter | Type | 
|---|---|
| cb | ( value:I) =>I | 
| options? | ValidatorOptions | 
Returns
this
Inherited from
Call Signature
transform<
O>(cb: (value:I) =>O,options?:ValidatorOptions):BaseValidator<O>
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:57
Type Parameters
| Type Parameter | 
|---|
| O | 
Parameters
| Parameter | Type | 
|---|---|
| cb | ( value:I) =>O | 
| options? | ValidatorOptions | 
Returns
Inherited from
when()
when<
Key,This>(key:Key,options:WhenOptions<This,Key>,validatorOptions?:ValidatorOptions):this
Defined in: projects/shapeshift/src/validators/BaseValidator.ts:88
Type Parameters
| Type Parameter | Default type | 
|---|---|
| KeyextendsWhenKey | - | 
| ThisextendsBaseValidator<any> | ObjectValidator<T,I> | 
Parameters
| Parameter | Type | 
|---|---|
| key | Key | 
| options | WhenOptions<This,Key> | 
| validatorOptions? | ValidatorOptions | 
Returns
this