Skip to content

Ensure update validators only call validators underneath single nested paths once#15446

Merged
vkarpov15 merged 2 commits intomasterfrom
vkarpov15/gh-15436
May 30, 2025
Merged

Ensure update validators only call validators underneath single nested paths once#15446
vkarpov15 merged 2 commits intomasterfrom
vkarpov15/gh-15436

Conversation

@vkarpov15
Copy link
Collaborator

Fix #15436

Summary

Examples

@vkarpov15 vkarpov15 added this to the 8.15.2 milestone May 28, 2025
Copy link
Contributor

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 pull request addresses issue #15436 by ensuring that update validators for single nested paths are only called once.

  • Added tests to verify the behavior for both type casting and update validation in nested documents.
  • Updated the update validators helper to mark single nested paths as already validated.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
test/types/models.test.ts Added a test function (gh15437) to validate schema hydration.
test/model.updateOne.test.js Introduced a new test ensuring validators under single nested docs are called only once.
lib/helpers/updateValidators.js Updated logic to flag single nested paths as already validated.

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, though it also seems to include the changes from #15443.

@vkarpov15 vkarpov15 merged commit da2c5dd into master May 30, 2025
74 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-15436 branch May 30, 2025 20:50
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.

Validation in sub documents are triggerred multiple times on update

4 participants