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

Fix import of object type from ECS #1492

Merged
merged 2 commits into from
Oct 6, 2023
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
4 changes: 4 additions & 0 deletions internal/fields/dependency_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ func transformImportedField(fd FieldDefinition, options InjectFieldsOptions) com
"type": fd.Type,
}

if fd.ObjectType != "" {
m["object_type"] = fd.ObjectType
}

// Multi-fields don't have descriptions.
if fd.Description != "" {
m["description"] = fd.Description
Expand Down
21 changes: 21 additions & 0 deletions internal/fields/dependency_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,27 @@ func TestDependencyManagerWithECS(t *testing.T) {
assert.False(t, ok)
},
},
{
title: "object type is imported",
defs: []common.MapStr{
{
"name": "container.labels",
"external": "ecs",
},
},
options: InjectFieldsOptions{
IncludeValidationSettings: true,
},
valid: true,
result: []common.MapStr{
{
"name": "container.labels",
"description": "Image labels.",
"type": "object",
"object_type": "keyword",
},
},
},
}

for _, c := range cases {
Expand Down