Skip to content

Commit 88c7f7c

Browse files
authored
Fix import of object type from ECS (#1492)
1 parent 52165c8 commit 88c7f7c

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

internal/fields/dependency_manager.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ func transformImportedField(fd FieldDefinition, options InjectFieldsOptions) com
311311
"type": fd.Type,
312312
}
313313

314+
if fd.ObjectType != "" {
315+
m["object_type"] = fd.ObjectType
316+
}
317+
314318
// Multi-fields don't have descriptions.
315319
if fd.Description != "" {
316320
m["description"] = fd.Description

internal/fields/dependency_manager_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,27 @@ func TestDependencyManagerWithECS(t *testing.T) {
704704
assert.False(t, ok)
705705
},
706706
},
707+
{
708+
title: "object type is imported",
709+
defs: []common.MapStr{
710+
{
711+
"name": "container.labels",
712+
"external": "ecs",
713+
},
714+
},
715+
options: InjectFieldsOptions{
716+
IncludeValidationSettings: true,
717+
},
718+
valid: true,
719+
result: []common.MapStr{
720+
{
721+
"name": "container.labels",
722+
"description": "Image labels.",
723+
"type": "object",
724+
"object_type": "keyword",
725+
},
726+
},
727+
},
707728
}
708729

709730
for _, c := range cases {

0 commit comments

Comments
 (0)