Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make all fields linkable directly via an HTML ID #1148

Merged
merged 5 commits into from
Nov 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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