Home > @websublime/schema > BaseSchemaType

BaseSchemaType class

Base type model validation

Signature:

export declare class BaseSchemaType<T = any> 

Constructors

ConstructorModifiersDescription
(constructor)(st)Create mixed type instance

Properties

PropertyModifiersTypeDescription
items?unknown(Optional) schema for ArraySchemaType items
properties?unknown(Optional) Object with the schema for ObjectSchemaType
requiredbooleanRequired property
requiredErrorMessagestringRequired error message property
rulesRule[]Validation rules
schemaTypeschemaTypeType name
trimbooleanTrims string
typestring

Methods

MethodModifiersDescription
addRule({ errorMessage, params, validationFn })Add validation rule.
check(value, parent, context)Test value types
isEmpty(value)Validate if value is empty
isRequired(errorMessage, trim)Sign as require property