Skip to content
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-8037: fixed an issue where number component can be sent text thro… #70

Merged

Conversation

KatrinKhilko
Copy link
Contributor

…ugh API

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-8037

Description

Added validation to throw an error in case if a text value attempts to be submitted for number component.

Breaking Changes / Backwards Compatibility

n/a

Dependencies

n/a

How has this PR been tested?

Tested locally, added test for valid and invalid number value.

Checklist:

  • I have completed the above PR template
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • My changes include tests that prove my fix is effective (or that my feature works as intended)
  • New and existing unit/integration tests pass locally with my changes
  • Any dependent changes have corresponding PRs that are listed above


// These are the validations that require a database connection.
export const databaseRules: ValidationRuleInfo[] = [
validateUniqueInfo,
validateCaptchaInfo
validateCaptchaInfo,
validateNumberInfo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validateNumberInfo should not be in databaseRules. databaseRules contain only rules, that interact with database and therefore should not be performed in vm. validateNumberInfo should be placed in clientRules

export const validateNumberSync: RuleFnSync = (context: ValidationContext) => {
const error = new FieldError('number', context);
const { value } = context;
if (!shouldValidate(context)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remove this shouldValidate call, as it's already done in validation processor validationRules function.

Copy link
Contributor

@AlexeyNikipelau AlexeyNikipelau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve the merge conflicts please

@AlexeyNikipelau AlexeyNikipelau merged commit d311d92 into master Apr 19, 2024
3 checks passed
lane-formio pushed a commit that referenced this pull request May 21, 2024
…ent-text-through-API

FIO-8037: fixed an issue where number component can be sent text thro…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants