Skip to content

fix: handle undefined or empty rules in validator#1105

Merged
chantouchsek merged 3 commits into
mainfrom
fix/1104-pass-rule-undefined
Dec 17, 2025
Merged

fix: handle undefined or empty rules in validator#1105
chantouchsek merged 3 commits into
mainfrom
fix/1104-pass-rule-undefined

Conversation

@chantouchsek
Copy link
Copy Markdown
Owner

Linked Issue

Fixed #1104

@chantouchsek chantouchsek self-assigned this Dec 17, 2025
Copilot AI review requested due to automatic review settings December 17, 2025 10:08
Copy link
Copy Markdown

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 fixes issue #1104 by adding logic to handle undefined and empty string rules in the validator's _parseRulesDefault method.

  • Restructured the conditional logic to explicitly handle array, undefined/empty string, and other types separately
  • Added filter(Boolean) to remove empty strings from pipe-separated rules
  • Added a test case to verify undefined and empty rules don't cause errors

Reviewed changes

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

File Description
src/main.ts Modified _parseRulesDefault to handle undefined and empty string rules by converting them to empty arrays, and added filtering to remove empty values from pipe-separated rule strings
tests/validator.spec.ts Added test case to verify that undefined and empty string rules are handled without errors

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

Comment thread __tests__/validator.spec.ts Outdated
Comment thread src/main.ts Outdated
@chantouchsek chantouchsek merged commit c53802f into main Dec 17, 2025
3 checks passed
@chantouchsek chantouchsek deleted the fix/1104-pass-rule-undefined branch December 17, 2025 15:01
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.

Passing rule as undefined it will be failed

2 participants