Skip to content

Commit

Permalink
Support type "nested" with empty property list (#3360)
Browse files Browse the repository at this point in the history
  • Loading branch information
breml authored and monicasarbu committed Jan 16, 2017
1 parent e2aaa38 commit 3298bb7
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions libbeat/scripts/generate_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,11 @@ def fill_section_properties(args, section, defaults, path):
properties = {}
dynamic_templates = []

for field in section["fields"]:
prop, dynamic = fill_field_properties(args, field, defaults, path)
properties.update(prop)
dynamic_templates.extend(dynamic)
if "fields" in section:
for field in section["fields"]:
prop, dynamic = fill_field_properties(args, field, defaults, path)
properties.update(prop)
dynamic_templates.extend(dynamic)

return properties, dynamic_templates

Expand Down Expand Up @@ -298,12 +299,12 @@ def fill_field_properties(args, field, defaults, path):
path = field["name"]
prop, dynamic = fill_section_properties(args, field, defaults, path)

properties[field.get("name")] = {
"type": "nested",
"properties": {}
}
# Only add properties if they have a content
if len(prop) is not 0:
properties[field.get("name")] = {
"type": "nested",
"properties": {}
}
properties[field.get("name")]["properties"] = prop

dynamic_templates.extend(dynamic)
Expand Down

0 comments on commit 3298bb7

Please sign in to comment.