Skip to content

Commit

Permalink
Fix #136009
Browse files Browse the repository at this point in the history
  • Loading branch information
rzhao271 committed Oct 28, 2021
1 parent bc4e05c commit ff1e16e
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -596,14 +596,18 @@ function isObjectSetting({
return false;
}

// object additional properties allow it to have any shape
if (objectAdditionalProperties === true || objectAdditionalProperties === undefined) {
// objectAdditionalProperties allow the setting to have any shape,
// but if there's a pattern property that handles everything, then every
// property will match that patternProperty, so we don't need to look at
// the value of objectAdditionalProperties in that case.
if ((objectAdditionalProperties === true || objectAdditionalProperties === undefined)
&& !Object.keys(objectPatternProperties ?? {}).includes('.*')) {
return false;
}

const schemas = [...Object.values(objectProperties ?? {}), ...Object.values(objectPatternProperties ?? {})];

if (typeof objectAdditionalProperties === 'object') {
if (objectAdditionalProperties && typeof objectAdditionalProperties === 'object') {
schemas.push(objectAdditionalProperties);
}

Expand Down

0 comments on commit ff1e16e

Please sign in to comment.