ValidationResult

Result generated by a schema validation.

Description

The ValidationResult class provides a representation of the result generated by a schema validation.

Constructors

Creates a new instance of a validation ressult and sets its values. See ValidationResultType

public constructor(path: string = null, type: ValidationResultType = null, code: string = null, message: string = null, expected: any = null, actual: any = null)

  • path: string - dot notation path of the validated element.
  • type: ValidationResultType = null - type of the validation result: Information, Warning, or Error.
  • code: string - error code.
  • message: string - human readable message.
  • expected: any - value expected by a schema validation.
  • actual: any - actual value found by a schema validation.

Instance methods

getActual

Gets the actual value found by a schema validation.

public getActual(): any

  • returns: any - actual value.

getCode

Gets the error code.

public getCode(): string

  • returns: string - error code

getExpected

Gets the value expected by a schema validation.

public getExpected(): any

  • returns: any - expected value.

getMessage

Gets the human readable message.

public getMessage(): string

  • returns: string - result message.

getPath

Gets the dot notation path of the validated element.

public getPath(): string

  • returns: string - path of the validated element.

getType

Gets the dot notation path of the validated element.

public getType(): ValidationResultType

toJSON

Returns the validation result in JSON format.

public toJSON(): object