-
Notifications
You must be signed in to change notification settings - Fork 67
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
Support validation ECS style dataset format #520
Support validation ECS style dataset format #520
Conversation
Thank you for your contribution. I think I managed to simplify your code. Indeed, the issue is around flattening data. Please take a look and share your thoughts on this: #521 |
Resolving in favor of #521 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't figure out a solution that's really shorter than this. Feel free to merge this change if the CI goes green.
It would be good to add an entry to the CHANGELOG ;)
To test your changes, I assume you could update one of the testdata packages with the new format and if it still works, all should be good: https://github.com/elastic/package-registry/blob/master/testdata/package/default_pipeline/0.0.2/dataset/foo/fields/base-fields.yml |
Oh sorry just saw this after I merged haha. I'll open up another PR to update the tests. |
Once the dataset fields are included in ecs the yaml file will look like this:
This results in the following
fields.yml
:This will fail validation because we're searching for
dataset.*
.This PR adds support for splitting the
dataset.*
string and looking inside the map. It findsname: dataset
first and then pulls out the arrayfields
and looks for the last part of the string (e.g.namespace
ortype
).This implementation is suupeeeer slow. So if you have better ideas that'd be great.
Basically I'd like to define the
dataset.*
fields in ecs style schema instead of using:It doesn't look like this line: https://github.com/elastic/package-registry/blob/master/util/dataset.go#L282
Is flattening it like the way I hoped. It still results in: