pip-services3-commons-node
Version: 
Portable abstractions and patterns for Pip.Services in Node.js
73 lines (72 loc) • 2.01 kB
TypeScript
/** @module validate */
import { ValidationResultType } from './ValidationResultType';
/**
 * Result generated by schema validation
 */
export declare class ValidationResult {
    private _path;
    private _type;
    private _code;
    private _message;
    private _expected;
    private _actual;
    /**
     * Creates a new instance of validation ressult and sets its values.
     *
     * @param path      a dot notation path of the validated element.
     * @param type      a type of the validation result: Information, Warning, or Error.
     * @param code      an error code.
     * @param message   a human readable message.
     * @param expected  an value expected by schema validation.
     * @param actual    an actual value found by schema validation.
     *
     * @see [[ValidationResultType]]
     */
    constructor(path?: string, type?: ValidationResultType, code?: string, message?: string, expected?: any, actual?: any);
    /**
     * Gets dot notation path of the validated element.
     *
     * @returns the path of the validated element.
     */
    getPath(): string;
    /**
     * Gets the type of the validation result: Information, Warning, or Error.
     *
     * @returns the type of the validation result.
     *
     * @see [[ValidationResultType]]
     */
    getType(): ValidationResultType;
    /**
     * Gets the error code.
     *
     * @returns the error code
     */
    getCode(): string;
    /**
     * Gets the human readable message.
     *
     * @returns the result message.
     */
    getMessage(): string;
    /**
     * Gets the value expected by schema validation.
     *
     * @returns the expected value.
     */
    getExpected(): any;
    /**
     * Gets the actual value found by schema validation.
     *
     * @returns the actual value.
     */
    getActual(): any;
    toJSON(): {
        path: string;
        type: ValidationResultType;
        code: string;
        message: string;
        expected: any;
        actual: any;
    };
}