Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DefaultSchemaValidator

The default implementation of a schema validator.

Hierarchy

  • DefaultSchemaValidator

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

Private _composer

_composer: Ajv = new Ajv({ useDefaults: true })

Private _validator

_validator: Ajv = new Ajv()

Methods

Private _addSchema

  • Add a schema to the validator.

    Parameters

    • plugin: string

      The plugin ID.

    • schema: ISchema

      The schema being added.

    Returns IError[] | null

    A list of errors if the schema fails to validate or null if there are no errors.

    Notes

    It is safe to call this function multiple times with the same plugin name.

validateData

  • validateData(plugin: IPlugin, populate?: boolean): IError[] | null
  • Validate a plugin's schema and user data; populate the composite data.

    Parameters

    • plugin: IPlugin

      The plugin being validated. Its composite data will be populated by reference.

    • Default value populate: boolean = true

      Whether plugin data should be populated, defaults to true.

    Returns IError[] | null

    A list of errors if either the schema or data fail to validate or null if there are no errors.

Generated using TypeDoc