diff --git a/src/process/validation/__tests__/util.test.ts b/src/process/validation/__tests__/util.test.ts index 446975e0..41c3abab 100644 --- a/src/process/validation/__tests__/util.test.ts +++ b/src/process/validation/__tests__/util.test.ts @@ -89,6 +89,9 @@ describe('interpolateErrors', function () { processor: ProcessorType.Validate, rules, }); + if (scope.errors[0]) { + expect(scope.errors[0]?.context?.path).to.equal(path); + } result.set(path, interpolateErrors(scope.errors)); }, ); diff --git a/src/process/validation/index.ts b/src/process/validation/index.ts index daacee41..468ac6de 100644 --- a/src/process/validation/index.ts +++ b/src/process/validation/index.ts @@ -173,6 +173,9 @@ function handleError(error: FieldError | null, context: ValidationContext) { const absolutePath = getComponentAbsolutePath(component); if (error) { const cleanedError = cleanupValidationError(error); + if (component.parent) { + cleanedError.context.path = absolutePath; + } cleanedError.context.path = absolutePath; if ( !find(scope.errors, {