Skip to content

AjvService

@tsed/ajv

Usage

typescript
import { AjvService } from "@tsed/ajv";

See /packages/specs/ajv/src/types/services/AjvService.ts.

Overview

ts
class AjvService {
    readonly name = "ajv";
    protected errorFormatter: ErrorFormatter;
    protected returnsCoercedValues: boolean | undefined;
    protected ajv: Ajv;
    validate(value: any, options: AjvValidateOptions | JsonSchema): Promise<any>;
    protected mapOptions(options: AjvValidateOptions | JsonSchema): AjvValidateOptions;
    protected mapErrors(errors: ErrorObject[], options: any): AjvValidationError;
    protected mapClassError(error: AjvErrorObject, targetType: Type<any>): string | undefined;
}

readonly name

ts
readonly name = "ajv";

protected errorFormatter

ts
protected errorFormatter: ErrorFormatter;

protected returnsCoercedValues

ts
protected returnsCoercedValues: boolean | undefined;

protected ajv

ts
protected ajv: Ajv;

validate

ts
validate(value: any, options: AjvValidateOptions | JsonSchema): Promise<any>;

protected mapOptions

ts
protected mapOptions(options: AjvValidateOptions | JsonSchema): AjvValidateOptions;

protected mapErrors

ts
protected mapErrors(errors: ErrorObject[], options: any): AjvValidationError;

protected mapClassError

ts
protected mapClassError(error: AjvErrorObject, targetType: Type<any>): string | undefined;

Released under the MIT License.