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(schema): handle embedded discriminators defined using Schema.prototype.discriminator() #13958

Merged
merged 1 commit into from Oct 10, 2023

Conversation

vkarpov15
Copy link
Collaborator

Fix #13898

Summary

Using schema.path('docArr').discriminator(...) works fine, but not docArrSchema.discriminator(...); const schema = new Schema({ docArr: [docArrSchema] }). This PR makes it so that both syntaxes work.

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, if i understand correctly, this moves the checks / applies from schema.js to the respective schema types?

@vkarpov15
Copy link
Collaborator Author

@hasezoey that's correct

@vkarpov15 vkarpov15 merged commit 3042ac1 into master Oct 10, 2023
42 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-13898 branch October 10, 2023 18: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.

Discriminated schemas nested with discriminated schemas don't instantiate the correct types
2 participants