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

fix(document): correctly set index when casting subdocs for validation re: #13626 #13682

Merged
merged 1 commit into from Aug 1, 2023

Conversation

vkarpov15
Copy link
Collaborator

Summary

Another related issue to #13626. The reason why #13626 was leading to an uncaught error was that the if (value && !(value instanceof Constructor)) {} check in schema/DocumentArrayElement.js was not getting the correct scope or index set, so the subdocument threw an uncaught validation error because the subdocument didn't know what array it was part of. scope was the top level document, not the document array. With this PR, we'll always pass options.index and also set scope to the document array.

Examples

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

Copy link
Collaborator

@IslandRhythms IslandRhythms left a comment

Choose a reason for hiding this comment

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

LGTM

@vkarpov15 vkarpov15 merged commit d5784d8 into 6.x Aug 1, 2023
34 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-13626-2 branch August 2, 2023 08:53
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.

None yet

3 participants