Skip to content

Commit

Permalink
Skip arrays with no subproperty keys
Browse files Browse the repository at this point in the history
  • Loading branch information
homebysix committed May 24, 2024
1 parent d3406ee commit 861bd7b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,16 @@ def process_subkeys(subkeys):
if "items" in properties[name]:
# If the parent type was array, we're only expecting a single dict
# here, since an array should only contain a single object type.
# TODO: Validate this assumption. Some warnings seen in the wild.
subprop_keys = list(subprop.keys())
if len(subprop_keys) > 1:
print(
"WARNING: Array type should only have one subproperty "
"key. Multiple found: %s" % subprop_keys
"key. Skipping all but the first: %s" % subprop_keys
)
elif len(subprop_keys) == 0:
print("WARNING: No subproperty keys found in %s key." % name)
continue
array_props = subprop[subprop_keys[0]]
properties[name]["items"] = array_props
else:
Expand Down

0 comments on commit 861bd7b

Please sign in to comment.