Skip to content

Commit

Permalink
Add support field set aliases (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
lksnyder0 authored Dec 5, 2024
1 parent dfce3b0 commit 06937ec
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/schema/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,21 @@ def deep_nesting_representation(

# Schema-only details. Not present on other nested field groups.
schema_details: SchemaDetails = {}
for schema_key in ["root", "group", "reusable", "title", "settings"]:
for schema_key in ["root", "group", "reusable", "title", "settings", "aliases"]:
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] = {
ecs_struct = {
"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"],
}
deeply_nested[name] = ecs_struct
for alias in schema_details.get("aliases", []):
deeply_nested[alias] = ecs_struct
return deeply_nested


Expand Down

0 comments on commit 06937ec

Please sign in to comment.