Skip to content

fix: Create deep copy before checking each sub schema in oneOf #791

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 5 commits into from
Feb 26, 2025

Conversation

DannyvdSluijs
Copy link
Collaborator

This PR creates a deep copy of the value before passing it by reference for validating sub schemas of a oneOf with type coercion enabled.

Fixes #790

@erayd
Copy link
Contributor

erayd commented Feb 26, 2025

For performance reasons, I suggest only doing this if coercion is actually enabled. Schemas with many deep oneOf branches are all too common, and large deep copies can get expensive.

@DannyvdSluijs DannyvdSluijs merged commit 7eea9e4 into master Feb 26, 2025
19 checks passed
@DannyvdSluijs DannyvdSluijs deleted the Fix-790 branch February 26, 2025 11:11
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.

oneOf alters input value affecting validation on subsequent subschemas when type coercion is enabled
2 participants