in src/rpdk/core/jsonutils/flattener.py [0:0]
def _flatten_combiners(self, sub_schema, path):
"""This method iterates through allOf, anyOf, and oneOf schemas and
merges them all into the surrounding sub_schema"""
for arr_key in COMBINERS:
try:
schema_array = sub_schema.pop(arr_key)
except KeyError:
pass
else:
for i, nested_schema in enumerate(schema_array):
ref_path = path + (arr_key, i)
ref_path_is_used = ref_path in self._schema_map
walked_schema = self._walk(nested_schema, ref_path)
# if no other schema is referencing the ref_path,
# we no longer need the refkey since the properties will be squashed
if ref_path_is_used:
resolved_schema = self._schema_map.get(ref_path)
else:
resolved_schema = self._schema_map.pop(ref_path, walked_schema)
schema_merge(sub_schema, resolved_schema, path)
if isinstance(sub_schema.get(TYPE), OrderedSet):
sub_schema[TYPE] = list(sub_schema[TYPE])
return sub_schema