-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIO-8347: Added ability to skip mask validation #109
Conversation
const { component, value } = context; | ||
if (!isValidatableComponent(component) || !value) { | ||
const { component, value, instance } = context; | ||
if (!isValidatableComponent(component) || !value || shouldSkipMaskValidation(context)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something of a nit, but wouldn't the check for skipMaskValidation just be better inside of the isValidatableComponent fn?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.g. the component is not validatable if it has skipMaskValidation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored the isValidatableComponent
function to improve readability. The previous implementation with two additional conditions made the function difficult to understand at first look. Is it fine?
Link to Jira Ticket
https://formio.atlassian.net/browse/FIO-8347
Description
In Formio.js 4.x, we have the ability to skip mask validation by checking the
skipMaskValidation
property in the instance. To maintain backward compatibility, we have retained this instance check. This PR introduces the ability to skip mask validation by adding theskipMaskValidation
flag to thevalidate
object in the JSON configuration.How has this PR been tested?
Unit testing
Checklist: