elastic / elastic/ecs-typescript

Not all nested fields are objects

Open
#38 1 comment 0 reactions 1 assignee Claimed by @lgestc View on GitHub
bug
Dominant language
JavaScript
Stars
4
Forks
4
PR merge metrics
No merged PRs in 30d

Description

e.g:

[`elf.header.abiversion`](https://www.elastic.co/guide/en/ecs/master/ecs-elf.html#field-elf-header-abi-version) is not a field under a header object.

```json
{
"elf": {
"header" : {
"abiversion" : ""
}
}
}
```

But a field with dots under the `elf` object.

```json
{
"elf": {
"header.abiversion" : ""
}
}
```

https://github.com/elastic/ecs-typescript/blob/main/generated/process.ts#L106-L110

See e.g how `beats` maps this:

https://github.com/elastic/beats/blob/66755e6b58338fd138374314c71d5d0119d1506f/libbeat/ecs/elf.go#L54-L55

And your neighbor `ecs-dotnet` :wave:

https://github.com/elastic/ecs-dotnet/blob/main/src/Elastic.CommonSchema/FieldSets.Generated.cs#L948-L954

Only cases where the immediate root of the field is mapped as `object` or `nested` should the typemappings create an intermediate inline object type see e.g (`dns.answers`](https://www.elastic.co/guide/en/ecs/master/ecs-dns.html#field-dns-answers) or [`elf.sections`](https://www.elastic.co/guide/en/ecs/master/ecs-elf.html#field-elf-sections)

And again how beats maps it:
https://github.com/elastic/beats/blob/66755e6b58338fd138374314c71d5d0119d1506f/libbeat/ecs/elf.go#L66

and `ecs-dotnet`:
https://github.com/elastic/ecs-dotnet/blob/main/src/Elastic.CommonSchema/FieldSets.Generated.cs#L1036-L1043

Currently `ecs-typescript` does not discover this type yet and reverts to `Record`

https://github.com/elastic/ecs-typescript/blob/main/generated/elf.ts#L87

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.