Class: ArraySchema<T, C, TIn, TOut>
yup.ArraySchema
Type parameters​
Name | Type |
---|---|
T | extends AnySchema | Lazy <any , any > |
C | extends AnyObject = AnyObject |
TIn | extends Maybe <TypeOf <T >[]> = TypeOf <T >[] | undefined |
TOut | extends Maybe <Asserts <T >[]> = Asserts <T >[] | Optionals <TIn > |
Hierarchy​
BaseSchema
<TIn
,C
,TOut
>↳
ArraySchema
Constructors​
constructor​
• new ArraySchema<T
, C
, TIn
, TOut
>(type?
)
Type parameters​
Name | Type |
---|---|
T | extends AnySchema <any , any , any > | Lazy <any , any > |
C | extends AnyObject = AnyObject |
TIn | extends Maybe <TypeOf <T >[]> = undefined | TypeOf <T >[] |
TOut | extends Maybe <Asserts <T >[]> = Asserts <T >[] | Extract <TIn , undefined | null > |
Parameters​
Name | Type |
---|---|
type? | T |
Overrides​
Properties​
__inputType​
• Readonly
__inputType: TIn
Inherited from​
__isYupSchema__​
• Readonly
__isYupSchema__: boolean
Inherited from​
__outputType​
• Readonly
__outputType: TOut
Inherited from​
_blacklist​
• Protected
_blacklist: default
Inherited from​
_whitelist​
• Protected
_whitelist: default
Inherited from​
deps​
• Readonly
deps: readonly string
[]
Inherited from​
equals​
• equals: <U>(enums
: (default
<unknown
> | Maybe
<U
>)[], message?
: Message
<{ values
: any
}>) => BaseSchema
<any
, AnyObject
, any
>
Type declaration​
â–¸ <U
>(enums
, message?
): BaseSchema
<any
, AnyObject
, any
>
Type parameters​
Name | Type |
---|---|
U | extends any |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
BaseSchema
<any
, AnyObject
, any
>
Inherited from​
exclusiveTests​
• Protected
exclusiveTests: Record
<string
, boolean
>
Inherited from​
innerType​
• Optional
innerType: T
is​
• is: <U>(enums
: (default
<unknown
> | Maybe
<U
>)[], message?
: Message
<{ values
: any
}>) => BaseSchema
<any
, AnyObject
, any
>
Type declaration​
â–¸ <U
>(enums
, message?
): BaseSchema
<any
, AnyObject
, any
>
Type parameters​
Name | Type |
---|---|
U | extends any |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
BaseSchema
<any
, AnyObject
, any
>
Inherited from​
nope​
• nope: <U>(enums
: (default
<unknown
> | Maybe
<U
>)[], message?
: Message
<{ values
: any
}>) => BaseSchema
<any
, AnyObject
, any
>
Type declaration​
â–¸ <U
>(enums
, message?
): BaseSchema
<any
, AnyObject
, any
>
Type parameters​
Name | Type |
---|---|
U | extends any |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
BaseSchema
<any
, AnyObject
, any
>
Inherited from​
not​
• not: <U>(enums
: (default
<unknown
> | Maybe
<U
>)[], message?
: Message
<{ values
: any
}>) => BaseSchema
<any
, AnyObject
, any
>
Type declaration​
â–¸ <U
>(enums
, message?
): BaseSchema
<any
, AnyObject
, any
>
Type parameters​
Name | Type |
---|---|
U | extends any |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
BaseSchema
<any
, AnyObject
, any
>
Inherited from​
spec​
• spec: SchemaSpec
<any
>
Inherited from​
tests​
• tests: Test
[]
Inherited from​
transforms​
• transforms: TransformFunction
<AnySchema
<any
, any
, any
>>[]
Inherited from​
type​
• Readonly
type: string
Inherited from​
Accessors​
_subType​
• Private
get
_subType(): any
Returns​
any
_type​
• get
_type(): string
Returns​
string
Inherited from​
BaseSchema._type
Methods​
_cast​
â–¸ Protected
_cast(_value
, _opts
): any
Parameters​
Name | Type |
---|---|
_value | any |
_opts | InternalOptions <C > |
Returns​
any
Overrides​
_getDefault​
â–¸ Protected
_getDefault(): any
Returns​
any
Inherited from​
_isPresent​
â–¸ Protected
_isPresent(value
): boolean
Parameters​
Name | Type |
---|---|
value | unknown |
Returns​
boolean
Inherited from​
_typeCheck​
â–¸ Protected
_typeCheck(v
): v is NonNullable<TIn>
Parameters​
Name | Type |
---|---|
v | any |
Returns​
v is NonNullable<TIn>
Overrides​
_validate​
â–¸ Protected
_validate(_value
, options
, callback
): void
Parameters​
Name | Type |
---|---|
_value | any |
options | undefined | InternalOptions <C > |
callback | Callback <any > |
Returns​
void
Overrides​
cast​
â–¸ cast(value
, options?
): TIn
Parameters​
Name | Type |
---|---|
value | any |
options? | CastOptions <C > |
Returns​
TIn
Inherited from​
clone​
â–¸ clone(spec?
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
spec? | SchemaSpec <any > |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
Overrides​
compact​
â–¸ compact(rejector?
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
rejector? | RejectorFn |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
concat​
â–¸ concat<TOther
>(schema
): TOther
Type parameters​
Name | Type |
---|---|
TOther | extends ArraySchema <any , any , any , any , TOther > |
Parameters​
Name | Type |
---|---|
schema | TOther |
Returns​
TOther
Overrides​
â–¸ concat(schema
): any
Parameters​
Name | Type |
---|---|
schema | any |
Returns​
any
Overrides​
default​
â–¸ default(def
): any
Parameters​
Name | Type |
---|---|
def | any |
Returns​
any
Inherited from​
defined​
â–¸ defined(): DefinedArraySchema
<T
, C
, TIn
>
Returns​
DefinedArraySchema
<T
, C
, TIn
>
Overrides​
describe​
â–¸ describe(): SchemaInnerTypeDescription
Returns​
SchemaInnerTypeDescription
Overrides​
ensure​
â–¸ ensure(): RequiredArraySchema
<T
, C
, TIn
>
Returns​
RequiredArraySchema
<T
, C
, TIn
>
getDefault​
â–¸ getDefault(options?
): TIn
Parameters​
Name | Type |
---|---|
options? | ResolveOptions <any > |
Returns​
TIn
Inherited from​
isType​
â–¸ isType(v
): boolean
Parameters​
Name | Type |
---|---|
v | any |
Returns​
boolean
Inherited from​
isValid​
â–¸ isValid(value
, options?
): Promise
<boolean
>
Parameters​
Name | Type |
---|---|
value | any |
options? | ValidateOptions <C > |
Returns​
Promise
<boolean
>
Inherited from​
isValidSync​
â–¸ isValidSync(value
, options?
): value is TOut
Parameters​
Name | Type |
---|---|
value | any |
options? | ValidateOptions <C > |
Returns​
value is TOut
Inherited from​
label​
â–¸ label(label
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
label | string |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
Inherited from​
length​
â–¸ length(length
, message?
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
length | number | default <number > |
message? | Message <{ length : number }> |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
max​
â–¸ max(max
, message?
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
max | number | default <number > |
message? | Message <{ max : number }> |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
meta​
â–¸ meta(): undefined
| Record
<string
, unknown
>
Returns​
undefined
| Record
<string
, unknown
>
Inherited from​
â–¸ meta(obj
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
obj | Record <string , unknown > |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
Inherited from​
min​
â–¸ min(min
, message?
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
min | number | default <number > |
message? | Message <{ min : number }> |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
notOneOf​
â–¸ notOneOf<U
>(enums
, message?
): ArraySchema
<T
, C
, TIn
, TOut
>
Type parameters​
Name | Type |
---|---|
U | extends Maybe <TypeOf <T >[]> |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
Inherited from​
notRequired​
â–¸ notRequired(): any
Returns​
any
Inherited from​
nullable​
â–¸ nullable(isNullable?
): ArraySchema
<T
, C
, null
| TIn
, null
| Asserts
<T
>[] | Extract
<TIn
, undefined
| null
>>
Parameters​
Name | Type |
---|---|
isNullable? | true |
Returns​
ArraySchema
<T
, C
, null
| TIn
, null
| Asserts
<T
>[] | Extract
<TIn
, undefined
| null
>>
Overrides​
â–¸ nullable(isNullable
): ArraySchema
<T
, C
, Exclude
<TIn
, null
>, Asserts
<T
>[] | Extract
<Exclude
<TIn
, null
>, undefined
| null
>>
Parameters​
Name | Type |
---|---|
isNullable | false |
Returns​
ArraySchema
<T
, C
, Exclude
<TIn
, null
>, Asserts
<T
>[] | Extract
<Exclude
<TIn
, null
>, undefined
| null
>>
Overrides​
of​
â–¸ of<TInner
>(schema
): ArraySchema
<TInner
, AnyObject
, undefined
| TypeOf
<TInner
>[], undefined
| Asserts
<TInner
>[]>
Type parameters​
Name | Type |
---|---|
TInner | extends BaseSchema <any , any , any , TInner > |
Parameters​
Name | Type |
---|---|
schema | TInner |
Returns​
ArraySchema
<TInner
, AnyObject
, undefined
| TypeOf
<TInner
>[], undefined
| Asserts
<TInner
>[]>
oneOf​
â–¸ oneOf<U
>(enums
, message?
): ArraySchema
<T
, C
, TIn
, TOut
>
Type parameters​
Name | Type |
---|---|
U | extends Maybe <TypeOf <T >[]> |
Parameters​
Name | Type |
---|---|
enums | (default <unknown > | Maybe <U >)[] |
message? | Message <{ values : any }> |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
Inherited from​
optional​
â–¸ optional(): any
Returns​
any
Inherited from​
required​
â–¸ required(msg?
): RequiredArraySchema
<T
, C
, TIn
>
Parameters​
Name | Type |
---|---|
msg? | Message <{}> |
Returns​
RequiredArraySchema
<T
, C
, TIn
>
Overrides​
resolve​
â–¸ resolve(options
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
options | ResolveOptions <any > |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
Inherited from​
strict​
â–¸ strict(isStrict?
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
isStrict? | boolean |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
Inherited from​
strip​
â–¸ strip(strip?
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
strip? | boolean |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
Inherited from​
test​
â–¸ test(options
): ArraySchema
<T
, C
, TIn
, TOut
>
Adds a test function to the schema's queue of tests. tests can be exclusive or non-exclusive.
- exclusive tests, will replace any existing tests of the same name.
- non-exclusive: can be stacked
If a non-exclusive test is added to a schema with an exclusive test of the same name the exclusive test is removed and further tests of the same name will be stacked.
If an exclusive test is added to a schema with non-exclusive tests of the same name the previous tests are removed and further tests of the same name will replace each other.
Parameters​
Name | Type |
---|---|
options | TestConfig <TIn , C > |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
Inherited from​
â–¸ test(test
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
test | TestFunction <TIn , C > |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
Inherited from​
â–¸ test(name
, test
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
name | string |
test | TestFunction <TIn , C > |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
Inherited from​
â–¸ test(name
, message
, test
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
name | string |
message | Message <{}> |
test | TestFunction <TIn , C > |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
Inherited from​
transform​
â–¸ transform(fn
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
fn | TransformFunction <ArraySchema <T , C , TIn , TOut >> |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
Inherited from​
typeError​
â–¸ typeError(message
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
message | Message <{}> |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
Inherited from​
validate​
â–¸ validate(value
, options?
): Promise
<TOut
>
Parameters​
Name | Type |
---|---|
value | any |
options? | ValidateOptions <C > |
Returns​
Promise
<TOut
>
Inherited from​
validateAt​
â–¸ validateAt(path
, value
, options?
): Promise
<TOut
>
Parameters​
Name | Type |
---|---|
path | string |
value | any |
options? | ValidateOptions <C > |
Returns​
Promise
<TOut
>
Inherited from​
validateSync​
â–¸ validateSync(value
, options?
): TOut
Parameters​
Name | Type |
---|---|
value | any |
options? | ValidateOptions <C > |
Returns​
TOut
Inherited from​
validateSyncAt​
â–¸ validateSyncAt(path
, value
, options?
): TOut
Parameters​
Name | Type |
---|---|
path | string |
value | any |
options? | ValidateOptions <C > |
Returns​
TOut
Inherited from​
when​
â–¸ when(options
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
options | ConditionOptions <ArraySchema <T , C , TIn , TOut >> |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
Inherited from​
â–¸ when(keys
, options
): ArraySchema
<T
, C
, TIn
, TOut
>
Parameters​
Name | Type |
---|---|
keys | string | string [] |
options | ConditionOptions <ArraySchema <T , C , TIn , TOut >> |
Returns​
ArraySchema
<T
, C
, TIn
, TOut
>
Inherited from​
withMutation​
â–¸ withMutation<T
>(fn
): T
Type parameters​
Name |
---|
T |
Parameters​
Name | Type |
---|---|
fn | (schema : ArraySchema <T , C , TIn , TOut >) => T |
Returns​
T