Skip to content

Add skipExternalValidations flag#29

Merged
vitorcoxta merged 1 commit intomasterfrom
support/add-skip-external-validations-flag
Feb 16, 2026
Merged

Add skipExternalValidations flag#29
vitorcoxta merged 1 commit intomasterfrom
support/add-skip-external-validations-flag

Conversation

@Megamind51
Copy link
Contributor

@Megamind51 Megamind51 commented Feb 16, 2026

This PR adds a skipExternalValidations flag to allow users to skip external API calls and use only internal regex-based validation for EU TINs. This reverts the changes from commit 3de621c (PR #28) which forced all EU countries to use internal validation. The new approach restores external API validation as the default for most countries while giving users the option to skip it when needed (e.g., for performance, offline scenarios, or testing).

Copilot AI review requested due to automatic review settings February 16, 2026 10:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a skipExternalValidations flag to allow users to skip external API calls and use only internal regex-based validation for EU TINs. This reverts the changes from commit 3de621c (PR #28) which forced all EU countries to use internal validation. The new approach restores external API validation as the default for most countries while giving users the option to skip it when needed (e.g., for performance, offline scenarios, or testing).

Changes:

  • Added skipExternalValidations parameter to mask() function with default value of false
  • Modified EU TIN validation logic to check both config.validateInternally and skipExternalValidations flags
  • Removed validateInternally: true flags from most natural-person country configs (reverting PR #28), while keeping them for countries that must always use internal validation (BG, GB, IS, LI, NO)
  • Unskipped tests that verify external API validation behavior for countries without validateInternally flag
  • Added tests for the new skipExternalValidations flag behavior

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/index.js Added skipExternalValidations parameter to mask() function signature and forwards it to euTinValidator.mask()
src/validators/eu-tin-validator.js Added skipExternalValidations parameter to isValid() method and updated validation logic to check both flags with OR condition
src/validators/validators-by-country.js Removed validateInternally: true flags from most natural-person country configs, restoring external API validation as default
test/src/validators/eu-tin-validator.test.js Added test for skipExternalValidations flag, unskipped tests for external API validation, and added test verifying flag is passed to isValid() from mask()
test/src/index.test.js Updated existing test expectation to include default skipExternalValidations: false value and added test for passing flag to euTinValidator.mask()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Megamind51 Megamind51 force-pushed the support/add-skip-external-validations-flag branch from de5c408 to be29121 Compare February 16, 2026 11:09
Copy link
Contributor

@vitorcoxta vitorcoxta left a comment

Choose a reason for hiding this comment

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

LGTM!

@vitorcoxta vitorcoxta merged commit 945b5cd into master Feb 16, 2026
4 checks passed
@vitorcoxta vitorcoxta deleted the support/add-skip-external-validations-flag branch February 16, 2026 11:26
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.

3 participants