Skip to content

Commit

Permalink
detect type dict and type definition
Browse files Browse the repository at this point in the history
  • Loading branch information
jobisoft committed Mar 2, 2021
1 parent 44bf04d commit f70ca54
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions update-docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ def merge_objects(a, b):
b.append(c)
continue
elif isinstance(a, dict):
for [e, f] in a.iteritems():
# allow new entries or overrides of descriptions
for [e, f] in a.iteritems():
# merge existing dicts and lists (former restrictions are a subset)
if e in b and (isinstance(f, list) or isinstance(f, dict)): # and e not in ["namespace", "name", "id", "$extend"]
merge_objects(f, b[e])
continue

# allow new entries or overrides of descriptions and types
if e not in b or e in ["description", "$ref", "type"]:
if (e in b and e in ["description"]):
print("Replacing Description")
Expand All @@ -51,8 +56,7 @@ def merge_objects(a, b):

b[e] = f
continue
if e not in ["namespace", "name", "id", "$extend"]:
merge_objects(f, b[e])

else:
print "Unexpected item:", a

Expand Down

0 comments on commit f70ca54

Please sign in to comment.