in mozilla_schema_generator/schema.py [0:0]
def delete_group_from_schema(self, key: Iterable[str], *, propagate=True):
"""
@param key: The key to remove
@param propagate: If True, then removes any parents of the deleted key
if they are now empty, i.e. there are no other
`properties`.
"""
self._delete_key(key)
# Now check, moving backwards, if that was the only available property
# If it was, and there are no additionalProperties, delete the parent
if propagate:
for subkey in reversed([key[:i] for i in range(len(key))]):
if not subkey or subkey[-1] == "properties":
# we only want to check the actual entry
continue
try:
elem = _get(self.schema, subkey)
if not elem.get("properties") and not elem.get(
"additionalProperties", False
):
self._delete_key(subkey)
except KeyError:
break