-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
decode_json_field: process objects and arrays only #11312
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
eff9c5a
process objects and arrays only
michalpristas cf94c09
changelog
michalpristas 4d2bffa
Merge branch 'master' of https://github.com/elastic/beats into fix-3534
michalpristas acc9bbc
table tests for depth
michalpristas 58cf873
added array into testcase
michalpristas ca70995
moved to fixes
michalpristas b5d5534
Merge branch 'master' into fix-3534
michalpristas 2f9c61d
Merge branch 'master' into fix-3534
ruflin 0b517d5
conflicts with 11318
michalpristas 9b7785d
Merge branch 'fix-3534' of github.com:michalpristas/beats into fix-3534
michalpristas 502caba
added structure check & decoder error check
michalpristas 6dce24b
Merge branch 'master' into fix-3534
michalpristas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
You check here for
[
but couldn't find an example of it the tests?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.
there's a bug with arrays solved in PR #11318 which also includes tests
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 added it, the mentioned bug is about processing when it should not process, so it should be fine to test it with processing enabled
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.
It's a quite simple heuristic, but should be fine. It still can fail, though. But decodeJSON should have failed in the first place. For example given the string
"2016-20-10"
the lexer should find that-
is an invalid character. Thedec.More()
call only returns false (as there is no more valid data in the stream), butMore
also returnsfalse
if there was an error. We can improvedecodeJSON
by checking thedec.Token()
error code afterdec.More()
.For the heuristics (we can still guard decodeJSON using some heuristics), we should remove whitespace when testing as well: