Skip to content

Commit

Permalink
fix json and custom validation errors to include setting in json
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyNikipelau authored and lane-formio committed Apr 5, 2024
1 parent 6782035 commit 6efa66b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/process/validation/rules/validateCustom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ export const validateCustomSync: RuleFnSync = (context: ValidationContext) => {
return null;
}

return new FieldError(typeof isValid === 'string' ? isValid : 'custom', {...context, hasLabel: false });
return new FieldError(typeof isValid === 'string' ? isValid : 'custom', {
...context,
hasLabel: false,
setting: customValidation,
});
};


Expand Down
5 changes: 4 additions & 1 deletion src/process/validation/rules/validateJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ export const validateJsonSync: RuleFnSync = (context: ValidationContext) => {
}
return valid === true
? null
: new FieldError(valid || 'jsonLogic', context);
: new FieldError(valid || 'jsonLogic', {
...context,
setting: func,
});
};

export const validateJsonInfo: ProcessorInfo<ValidationContext, FieldError | null> = {
Expand Down

0 comments on commit 6efa66b

Please sign in to comment.