in scripts/schema/loader.py [0:0]
def deep_nesting_representation(fields: Dict[str, FieldNestedEntry]) -> Dict[str, FieldEntry]:
deeply_nested: Dict[str, FieldEntry] = {}
for (name, flat_schema) in fields.items():
# We destructively select what goes into schema_details and child fields.
# The rest is 'field_details'.
flat_schema = flat_schema.copy()
flat_schema['node_name'] = flat_schema['name']
# Schema-only details. Not present on other nested field groups.
schema_details: SchemaDetails = {}
for schema_key in ['root', 'group', 'reusable', 'title']:
if schema_key in flat_schema:
schema_details[schema_key] = flat_schema.pop(schema_key)
nested_schema = nest_fields(flat_schema.pop('fields', []))
# Re-assemble new structure
deeply_nested[name] = {
'schema_details': schema_details,
# What's still in flat_schema is the field_details for the field set itself
'field_details': flat_schema,
'fields': nested_schema['fields']
}
return deeply_nested