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

decode_json_field: do not process arrays when flag not set #11318

Merged
merged 8 commits into from
Mar 25, 2019

Conversation

michalpristas
Copy link
Contributor

When using arrays with decode_json_processor array is decoded even though ProcessArray configuration is set to false

With input and ProcessArray set to false:

	"msg": `{
		"arrayOfMap": "[{\"a\":\"b\"}]"
	}`

Current behavior

	"msg": common.MapStr{
		"arrayOfMap": []common.MapStr{common.MapStr{"a": "b"}},
	},

Expected behavior:

	"msg": common.MapStr{
		"arrayOfMap": "[{\"a\":\"b\"}]",
	},

Fixes #11314

@michalpristas michalpristas requested a review from a team as a code owner March 19, 2019 16:45
@@ -199,6 +199,53 @@ func TestTargetRootOption(t *testing.T) {
assert.Equal(t, expected.String(), actual.String())
}

func TestArrayWithArraysDisabled(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind adding test cases for decoding array when process_array is set to true? Also, it would be nice to see tests for max_depth. The coverage of decode_json_fields is pretty thin. :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CHANGELOG.next.asciidoc Outdated Show resolved Hide resolved
Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just the changelog needs a newline like @kvch suggests.

@michalpristas michalpristas merged commit be1a9d7 into elastic:master Mar 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants