Stop traversing oneOf and anyOf combiners when filling/removing defaults #811
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.
This PR completely disables filling/remove defaults from subschemas within
oneOf
oranyOf
combiners. #809 demonstrates a serious bug in the defaults code that prevents use ofoneOf
in most realistic cases. Given that there isn't a clear correct answer when choosing a default from among multipleoneOf
subschemas, I'm inclined to ignore them when processing defaults.I also propose that we do away with defaults for
anyOf
. The wayanyOf
currently behaves is to always add a default from the first subschema. If the object actually matches one of the subsequent subschemas, then we'll be adding a default from the wrong type!With these changes, the remaining default rules are as follows, for a given missing property:
allOf
combiner, use the first default value available for that property among the combiner's subschemas. The first listed subschema in theallOf
array has highest precedence.Milestoning this as 2.7.0, since it doesn't seem possible that anyone could be successfully using defaults with these combiners given the bugs.
Resolves #809