Inherit 'required' correctly
This commit is contained in:
parent
e5e249dce1
commit
fbd2b22c71
1 changed files with 7 additions and 1 deletions
|
@ -143,10 +143,16 @@ def inherit_parents(obj):
|
|||
# iterate through the parents first, and then overwrite with the settings
|
||||
# from the child.
|
||||
for p in map(inherit_parents, parents) + [obj]:
|
||||
for key in ('type', 'title', 'required', 'description'):
|
||||
# child blats out type, title and description
|
||||
for key in ('type', 'title', 'description'):
|
||||
if p.get(key):
|
||||
result[key] = p[key]
|
||||
|
||||
# other fields get merged
|
||||
for key in ('required', ):
|
||||
if p.get(key):
|
||||
result.setdefault(key, []).extend(p[key])
|
||||
|
||||
for key in ('properties', 'additionalProperties', 'patternProperties'):
|
||||
if p.get(key):
|
||||
result.setdefault(key, OrderedDict()).update(p[key])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue