Make sure parser returns hash #4474
Merged
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.
Which issue(s) this PR fixes:
Hash#4100parser_msgpackand some refactoringWhat this PR does / why we need it:
parser_jsonandparser_msgpackreturn Hash.parser_jsonandparser_msgpackaccept onlyHashorArrayofHashIt is wrong for Parser to return a record that is not Hash.
Subsequent processing may result in errors.
parser_jsonandparser_msgpackcould return non-Hash objects, so they have been fixed in this PR.In addition,
in_httpwas designed based on this wrong behavior, so it has been fixed as well in this PR.However, we have a remaining problem with
filter_parser.filter_parsercould return Array based on this wrong behavior.This PR disables it, so it can not return multiple parsed results anymore.
Even though it was wrong to begin with, it's possible that this change in specifications would be unacceptable.
We need to consider this change carefully.
I explain some examples in detail below.
Docs Changes:
TODO
Release Note:
parser_jsonandparser_msgpackreturn Hash.parser_jsonandparser_msgpackaccept onlyHashorArrayofHashExample: parser_json
Case: No subsequent processing (without
convert_values)Config
Operation
Result BEFORE this fix
Result AFTER this fix
Case: No subsequent processing (with
convert_values)Config
Operation
Result BEFORE this fix
Result AFTER this fix
Case: With subsequent filter processing
Config
Operation
Result BEFORE this fix
Result AFTER this fix
Example: filter_parser
Case: No subsequent processing (without any option)
Config
Result BEFORE this fix
Result AFTER this fix
Case: No subsequent processing (with some options such as
reserve_data)parse failed no implicit conversion of Array into HashConfig
Result BEFORE this fix
Result AFTER this fix
Case: With subsequent filter processing
Config
Result BEFORE this fix
Result AFTER this fix