Skip to content

Commit

Permalink
[1.x] Make all fields linkable directly via an HTML ID (#1148) (#1154)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu Martin authored Nov 26, 2020
1 parent cf28a27 commit b7f63a7
Show file tree
Hide file tree
Showing 8 changed files with 1,647 additions and 417 deletions.
2,045 changes: 1,636 additions & 409 deletions docs/field-details.asciidoc

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion experimental/generated/ecs/ecs_flat.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'@timestamp':
dashed_name: -timestamp
dashed_name: timestamp
description: 'Date/time when the event originated.
This is the date/time extracted from the event, typically representing when the
Expand Down
2 changes: 1 addition & 1 deletion experimental/generated/ecs/ecs_nested.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ base:
events. These fields are common across all types of events.
fields:
'@timestamp':
dashed_name: -timestamp
dashed_name: timestamp
description: 'Date/time when the event originated.
This is the date/time extracted from the event, typically representing when
Expand Down
2 changes: 1 addition & 1 deletion generated/ecs/ecs_flat.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'@timestamp':
dashed_name: -timestamp
dashed_name: timestamp
description: 'Date/time when the event originated.
This is the date/time extracted from the event, typically representing when the
Expand Down
2 changes: 1 addition & 1 deletion generated/ecs/ecs_nested.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ base:
events. These fields are common across all types of events.
fields:
'@timestamp':
dashed_name: -timestamp
dashed_name: timestamp
description: 'Date/time when the event originated.
This is the date/time extracted from the event, typically representing when
Expand Down
2 changes: 1 addition & 1 deletion scripts/schema/finalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def field_finalizer(details, path):
name_array = path + [details['field_details']['node_name']]
flat_name = '.'.join(name_array)
details['field_details']['flat_name'] = flat_name
details['field_details']['dashed_name'] = re.sub('[@_\.]', '-', flat_name)
details['field_details']['dashed_name'] = re.sub('[_\.]', '-', flat_name).replace('@', '')
if 'multi_fields' in details['field_details']:
for mf in details['field_details']['multi_fields']:
mf['flat_name'] = flat_name + '.' + mf['name']
5 changes: 4 additions & 1 deletion scripts/templates/field_details.j2
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ beta::[ {{ fieldset['beta'] }}]
{% if 'original_fieldset' not in field -%}

{# `Field` column -#}
| {{ field['flat_name'] }}
|
[[field-{{field['dashed_name']}}]]
<<field-{{field['dashed_name']}}, {{ field['flat_name'] }}>>

{# `Description` column -#}
{#- Beta fields will add the `beta` label -#}
{% if field['beta'] -%}
Expand Down
4 changes: 2 additions & 2 deletions scripts/tests/unit/test_schema_finalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def test_calculate_final_values(self):
timestamp_details = base_fields['@timestamp']['field_details']
self.assertEqual(timestamp_details['flat_name'], '@timestamp',
"Field sets with root=true must not namespace field names with the field set's name")
self.assertEqual(timestamp_details['dashed_name'], '-timestamp')
self.assertEqual(timestamp_details['dashed_name'], 'timestamp')
# root=false
self.assertEqual(server_fields['ip']['field_details']['flat_name'], 'server.ip',
"Field sets with root=false must namespace field names with the field set's name")
Expand All @@ -288,7 +288,7 @@ def test_calculate_final_values(self):
def test_dashed_name_cleanup(self):
details = {'field_details': {'node_name': '@time.stamp_'}}
finalizer.field_finalizer(details, [])
self.assertEqual(details['field_details']['dashed_name'], '-time-stamp-')
self.assertEqual(details['field_details']['dashed_name'], 'time-stamp-')

# field_group_at_path

Expand Down

0 comments on commit b7f63a7

Please sign in to comment.