From 861bd7bc94695322d8fac8394eac555f95f7f7df Mon Sep 17 00:00:00 2001 From: Elliot Jordan Date: Fri, 24 May 2024 02:49:25 +0100 Subject: [PATCH] Skip arrays with no subproperty keys --- build.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.py b/build.py index 9db065b..a5514a6 100755 --- a/build.py +++ b/build.py @@ -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: