@classmethod
def _prune(cls, schema: dict):
    """Remove unused definitions on a jsonschema (not a CN schema).
        May iterate more than once, because
        some references may be used in other definitions."""
    occurring_references = cls._get_dict_references(schema)
    eliminated_references = False
    while True:
        for k in list(schema['definitions'].keys()):
            if k not in occurring_references:
                del schema['definitions'][k]
                eliminated_references = True
        if eliminated_references:
            occurring_references = cls._get_dict_references(schema)
            eliminated_references = False
        else:
            return
