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 number discriminator keys when using Schema.prototype.discriminator() #13858

Merged
merged 2 commits into from
Sep 15, 2023

Conversation

vkarpov15
Copy link
Collaborator

Fix #13788

Summary

#13788 pointed out that we have an issue where Schema.prototype.discriminator() doesn't handle number discriminator keys correctly. Mostly because that function uses a POJO to store the future discriminator keys, which means numeric keys get converted to strings. This PR makes Schema.prototype._applyDiscriminators use a map instead to retain numbers.

Examples

@vkarpov15 vkarpov15 added this to the 7.5.2 milestone Sep 14, 2023
@vkarpov15 vkarpov15 merged commit f9bfae0 into master Sep 15, 2023
@vkarpov15 vkarpov15 deleted the vkarpov15/gh-13788 branch September 15, 2023 14:37
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.

Schema level discriminator does not allow number values
2 participants