@canard/schema-form-ajv8-plugin
Version:
AJV 8.x validator plugin for @canard/schema-form providing JSON Schema validation with latest Draft 2020-12 and Draft 2019-09 support
14 lines (13 loc) • 573 B
TypeScript
import type { JsonSchemaError } from '@canard/schema-form';
import type { ErrorObject } from 'ajv';
/**
* Transforms AJV8 error objects to schema-form error format.
*
* AJV8 already uses JSONPointer format for instancePath, 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 AJV8 error objects
* @returns Array of transformed JsonSchemaError objects
*/
export declare const transformErrors: (errors: ErrorObject[]) => JsonSchemaError[];