Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Ajv

Index

Properties

Methods

  • Add schema that will be used to validate other schemas options in META_IGNORE_OPTIONS are alway set to false

    Parameters

    • schema: object

      schema object

    • Optional key: string

      optional schema key

    Returns "/home/runner/work/forge/forge/node_modules/ajv/lib/ajv".Ajv

    this for method chaining

  • Adds schema to the instance.

    Parameters

    • schema: object | object[]

      schema or array of schemas. If array is passed, key and other parameters will be ignored.

    • Optional key: string

      Optional schema key. Can be passed to validate method instead of schema object or id/ref. One schema per instance can have empty id and key.

    Returns "/home/runner/work/forge/forge/node_modules/ajv/lib/ajv".Ajv

    this for method chaining

  • getKeyword(keyword: string): boolean | object
  • Get keyword definition

    Parameters

    • keyword: string

      pre-defined or custom keyword.

    Returns boolean | object

    custom keyword definition, true if it is a predefined keyword, false otherwise.

  • Get compiled schema from the instance by key or ref.

    Parameters

    • keyRef: string

      key that was passed to addSchema or full schema reference (schema.id or resolved id).

    Returns undefined | "/home/runner/work/forge/forge/node_modules/ajv/lib/ajv".ValidateFunction

    schema validating function (with property schema). Returns undefined if keyRef can't be resolved to an existing schema.

  • Remove cached schema(s). If no parameter is passed all schemas but meta-schemas are removed. If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. Even if schema is referenced by other schemas it still can be removed as other schemas have local references.

    Parameters

    • Optional schemaKeyRef: string | boolean | object | RegExp

      key, ref, pattern to match key/ref or schema object

    Returns "/home/runner/work/forge/forge/node_modules/ajv/lib/ajv".Ajv

    this for method chaining

  • validate(schemaKeyRef: string | boolean | object, data: any): boolean | PromiseLike<any>
  • Validate data using schema Schema will be compiled and cached (using serialized JSON as key, fast-json-stable-stringify is used to serialize by default).

    Parameters

    • schemaKeyRef: string | boolean | object

      key, ref or schema object

    • data: any

      to be validated

    Returns boolean | PromiseLike<any>

    validation result. Errors from the last validation will be available in ajv.errors (and also in compiled schema: schema.errors).

  • validateSchema(schema: boolean | object): boolean
  • Validate schema

    Parameters

    • schema: boolean | object

      schema to validate

    Returns boolean

    true if schema is valid