Skip to content

fix(SchemaType): add missing continue #15384

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

Merged
merged 1 commit into from
Apr 30, 2025
Merged

fix(SchemaType): add missing continue #15384

merged 1 commit into from
Apr 30, 2025

Conversation

vkarpov15
Copy link
Collaborator

Fix #15380

Summary

Missed a spot while refactoring doValidate(). Thanks for catching this @hasezoey 👍

Examples

@vkarpov15 vkarpov15 added this to the 9.0 milestone Apr 29, 2025
Copy link
Contributor

@Copilot 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 a missed control-flow jump in SchemaType#doValidate by adding a missing continue statement, ensuring that the validator loop skips to the next iteration as intended. It also adds a test case to verify that regex validators work correctly with validate().

  • Fix missing continue in the validator loop of SchemaType#doValidate.
  • Add a new test case for regex validator functionality.

Reviewed Changes

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

File Description
test/schema.string.test.js Introduces a test case to ensure regex validators work as expected.
lib/schemaType.js Adds a missing continue in the doValidate method to correctly skip further execution after a validator error.
Comments suppressed due to low confidence (1)

lib/schemaType.js:1351

  • The added 'continue;' immediately follows a throw statement in the error branch. Please verify that this 'continue;' is correctly placed and intended to control the iteration flow when the error is not thrown.
continue;

Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

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

LGTM, can confirm this fixes the typegoose test.

@vkarpov15 vkarpov15 merged commit 3ceae09 into 9.0 Apr 30, 2025
46 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-15380 branch April 30, 2025 15:31
@hasezoey hasezoey linked an issue Apr 30, 2025 that may be closed by this pull request
2 tasks
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.

[9.0] validator.call is not a function on regex validate
2 participants