From ba23eb752463744b90d2f12c826d7dcefedb1347 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Mon, 23 Nov 2020 11:24:41 -0500 Subject: [PATCH] fix: path params incorrectly mutated fixes #1122 --- src/ValidationError.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ValidationError.js b/src/ValidationError.js index aee2c80e1..132b26c03 100644 --- a/src/ValidationError.js +++ b/src/ValidationError.js @@ -34,7 +34,8 @@ ValidationError.isError = function (err) { }; ValidationError.formatError = function (message, params) { - params.path = params.label || params.path || 'this'; + const path = params.label || params.path || 'this'; + if (path !== params.path) params = { ...params, path }; if (typeof message === 'string') return message.replace(strReg, (_, key) => printValue(params[key]));