Skip to main content

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

Constructors

constructor

Protected new CoreType(name, typeName, options?)

Parameters

NameType
namestring
typeNamestring
options?CoreTypeOptions

Overrides

IOttomanType.constructor

Defined in

schema/types/core-type.ts:23

Properties

name

name: string

Inherited from

IOttomanType.name

Defined in

schema/interfaces/schema.types.ts:51


options

Optional options: CoreTypeOptions

Defined in

schema/types/core-type.ts:23


typeName

typeName: string

Inherited from

IOttomanType.typeName

Defined in

schema/interfaces/schema.types.ts:51


sName

Static sName: any

Defined in

schema/types/core-type.ts:29

Accessors

default

get default(): unknown

Returns

unknown

Defined in

schema/types/core-type.ts:39


required

get required(): boolean | RequiredOption | RequiredFunction

Returns

boolean | RequiredOption | RequiredFunction

Defined in

schema/types/core-type.ts:31


validator

get validator(): undefined | string | ValidatorFunction | ValidatorOption

Returns

undefined | string | ValidatorFunction | ValidatorOption

Defined in

schema/types/core-type.ts:35

Methods

buildDefault

buildDefault(): unknown

Returns

unknown

Defined in

schema/types/core-type.ts:43


cast

Abstract cast(value, strategy?): unknown

Parameters

NameType
valueunknown
strategy?CAST_STRATEGY

Returns

unknown

Inherited from

IOttomanType.cast

Defined in

schema/interfaces/schema.types.ts:52


checkRequired

checkRequired(): string | void

Returns

string | void

Defined in

schema/types/core-type.ts:62


checkValidator

checkValidator(value): void

Parameters

NameType
valueunknown

Returns

void

Defined in

schema/types/core-type.ts:71


isEmpty

isEmpty(value): boolean

Parameters

NameType
valueunknown

Returns

boolean

Defined in

schema/types/core-type.ts:75


isStrictStrategy

isStrictStrategy(strategy): boolean

Parameters

NameType
strategyVALIDATION_STRATEGY

Returns

boolean

Defined in

schema/types/core-type.ts:79


validate

validate(value, strict?): unknown

Parameters

NameTypeDefault value
valueunknownundefined
strictbooleantrue

Returns

unknown

Overrides

IOttomanType.validate

Defined in

schema/types/core-type.ts:52