Repository navigation
Fix quadratic discriminator cleanup after #1379 - #1381
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1379; the corresponding 2.x correction follows #1380.
Large arrays of discriminated items make the cleanup introduced for #1378 quadratic: each oneOf/anyOf alternative copies and scans discriminator state accumulated for earlier items. Replace those snapshots with a scoped insertion journal, retaining existing and same-location state while discarding new descendant state on normal and exceptional exits.
The named discriminator map journals all insertion methods. Validation/walk dispatch and enablement stay in each validator; non-validating walks avoid cleanup, and disabled isolation uses a shared no-op scope. Expand coverage to OpenAPI 3.0/3.1, validating and non-validating walks, redefinitions, map mutators, nested failures, and nested arrays. The growth regression counts actual backing-map operations after validation; test instrumentation does not modify final fields.
Validation:
Command:
mvn -q clean test.