Class: CoreType
Param
of field in schema
Param
name of type
Param
Param
flag to define if the field is mandatory
Param
that will be applied to the field, allowed function, object or string with the name of the custom validator
Param
that will define the initial value of the field, this option allows a value or a function
Param
that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict
Hierarchy
↳
CoreType
↳↳
EmbedType
↳↳
StringType
↳↳
ArrayType
↳↳
BooleanType
↳↳
NumberType
↳↳
DateType
↳↳
MixedType
Constructors
constructor
• Protected
new CoreType(name
, typeName
, options?
)
Parameters
Name | Type |
---|---|
name | string |
typeName | string |
options? | CoreTypeOptions |
Overrides
Defined in
Properties
name
• name: string
Inherited from
Defined in
schema/interfaces/schema.types.ts:51
options
• Optional
options: CoreTypeOptions
Defined in
typeName
• typeName: string
Inherited from
Defined in
schema/interfaces/schema.types.ts:51
sName
▪ Static
sName: any
Defined in
Accessors
default
• get
default(): unknown
Returns
unknown
Defined in
required
• get
required(): boolean
| RequiredOption
| RequiredFunction
Returns
boolean
| RequiredOption
| RequiredFunction
Defined in
validator
• get
validator(): undefined
| string
| ValidatorFunction
| ValidatorOption
Returns
undefined
| string
| ValidatorFunction
| ValidatorOption
Defined in
Methods
buildDefault
▸ buildDefault(): unknown
Returns
unknown
Defined in
cast
▸ Abstract
cast(value
, strategy?
): unknown
Parameters
Name | Type |
---|---|
value | unknown |
strategy? | CAST_STRATEGY |
Returns
unknown
Inherited from
Defined in
schema/interfaces/schema.types.ts:52
checkRequired
▸ checkRequired(): string
| void
Returns
string
| void
Defined in
checkValidator
▸ checkValidator(value
): void
Parameters
Name | Type |
---|---|
value | unknown |
Returns
void
Defined in
isEmpty
▸ isEmpty(value
): boolean
Parameters
Name | Type |
---|---|
value | unknown |
Returns
boolean
Defined in
isStrictStrategy
▸ isStrictStrategy(strategy
): boolean
Parameters
Name | Type |
---|---|
strategy | VALIDATION_STRATEGY |
Returns
boolean
Defined in
validate
▸ validate(value
, strict?
): unknown
Parameters
Name | Type | Default value |
---|---|---|
value | unknown | undefined |
strict | boolean | true |
Returns
unknown