@canard/schema-form-ajv7-plugin
Version:
AJV 7.x validator plugin for @canard/schema-form providing JSON Schema validation with Draft-07 and Draft 2019-09 support
14 lines (13 loc) • 572 B
TypeScript
import type { JsonSchemaError } from '@canard/schema-form';
import type { ErrorObject } from 'ajv';
/**
* Transforms AJV7 error objects to schema-form error format.
*
* AJV7 uses JSONPointer format for dataPath by default, so minimal
* transformation is needed. This function mainly handles the required
* keyword errors by appending the missing property to the dataPath.
*
* @param errors - Array of AJV7 error objects
* @returns Array of transformed JsonSchemaError objects
*/
export declare const transformErrors: (errors: ErrorObject[]) => JsonSchemaError[];