@snups/rjsf-utils
Version:
Utility functions for @snups/rjsf-core
12 lines (11 loc) • 893 B
TypeScript
import { ErrorSchema, ValidationData } from './types.js';
/** Merges the errors in `additionalErrorSchema` into the existing `validationData` by combining the hierarchies in the
* two `ErrorSchema`s and then appending the error list from the `additionalErrorSchema` obtained by calling
* `toErrorList()` on the `errors` in the `validationData`. If no `additionalErrorSchema` is passed, then
* `validationData` is returned.
*
* @param validationData - The current `ValidationData` into which to merge the additional errors
* @param [additionalErrorSchema] - The optional additional set of errors in an `ErrorSchema`
* @returns - The `validationData` with the additional errors from `additionalErrorSchema` merged into it, if provided.
*/
export default function validationDataMerge<T = any>(validationData: ValidationData<T>, additionalErrorSchema?: ErrorSchema<T>): ValidationData<T>;