Home Reference Source
import {Validator} from 'datamatic/src/Pipeline/Validator.js'
public class | source

Validator

Static Method Summary

Static Public Methods
public static

deriveSchema(schemasOrConfig: *): Object | null

public static

validateSchemas(schemas: *): boolean

Constructor Summary

Public Constructor
public

constructor(schemaOrConfig: *, options: *)

Accepts one json-schema or tx-config per instance and an (optional) Ajv config

Member Summary

Public Members
public get

errors: *: *

Getter for validation errors incurred from model setter

public get

Getter for Object.isFrozen status of this node and it's ancestors

public set

model(data: *)

Setter for validator data value

public get

model: {}|[]: *

Getter for validator data value

Method Summary

Public Methods
public

Applies Object.freeze to model and triggers complete notification for pipeline

public

subscribe(handler: *): *

Registers notification handler to observable

public

toJSON(): {}|*[]

Provides model value as JSON

public

Overrides toString.

public

validate(value: *): *

Performs schema validation of value

public

valueOf(): {}|*[]

Overrides valueOf.

Static Public Methods

public static deriveSchema(schemasOrConfig: *): Object | null source

Params:

NameTypeAttributeDescription
schemasOrConfig *

Return:

Object | null

public static validateSchemas(schemas: *): boolean source

Params:

NameTypeAttributeDescription
schemas *

Return:

boolean

Public Constructors

public constructor(schemaOrConfig: *, options: *) source

Accepts one json-schema or tx-config per instance and an (optional) Ajv config

Params:

NameTypeAttributeDescription
schemaOrConfig *
options *

(optional)

Public Members

public get errors: *: * source

Getter for validation errors incurred from model setter

Return:

*

public get isFrozen: boolean: * source

Getter for Object.isFrozen status of this node and it's ancestors

Return:

boolean

public set model(data: *) source

Setter for validator data value

public get model: {}|[]: * source

Getter for validator data value

Return:

{}|[]

Public Methods

public freeze(): Validator source

Applies Object.freeze to model and triggers complete notification for pipeline

Return:

Validator

public subscribe(handler: *): * source

Registers notification handler to observable

Params:

NameTypeAttributeDescription
handler *

Return:

*

public toJSON(): {}|*[] source

Provides model value as JSON

Return:

{}|*[]

public toString(): string source

Overrides toString. Provides model value as String

Return:

string

public validate(value: *): * source

Performs schema validation of value

Params:

NameTypeAttributeDescription
value *

Return:

*

public valueOf(): {}|*[] source

Overrides valueOf. Provides model value as JSON

Return:

{}|*[]