in scripts/schema/finalizer.py [0:0]
def field_group_at_path(dotted_path, fields):
"""Returns the ['fields'] hash at the dotted_path."""
path = dotted_path.split('.')
nesting = fields
for next_field in path:
field = nesting.get(next_field, None)
if not field:
raise ValueError("Field {} not found, failed to find {}".format(dotted_path, next_field))
nesting = field.get('fields', None)
if not nesting:
field_type = field['field_details']['type']
if field_type in ['object', 'group', 'nested']:
nesting = field['fields'] = {}
else:
raise ValueError("Field {} (type {}) already exists and cannot have nested fields".format(
dotted_path, field_type))
return nesting