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

Hook up json_strict option with default of true #6909

Merged
merged 2 commits into from
Jan 21, 2020
Merged

Conversation

danielnelson
Copy link
Contributor

closes: #6906

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

@danielnelson danielnelson added fix pr to fix corresponding bug area/json json and json_v2 parser/serialiser related labels Jan 16, 2020
@danielnelson danielnelson added this to the 1.13.2 milestone Jan 16, 2020
@danielnelson danielnelson requested a review from reimda January 16, 2020 00:06
@@ -20,7 +20,7 @@ ignored unless specified in the `tag_key` or `json_string_fields` options.

## When strict is true and a JSON array is being parsed, all objects within the
## array must be valid
strict = false
strict = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this need to be named json_strict?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, thanks.

@@ -1411,7 +1411,9 @@ func buildParser(name string, tbl *ast.Table) (parsers.Parser, error) {
}

func getParserConfig(name string, tbl *ast.Table) (*parsers.Config, error) {
c := &parsers.Config{}
c := &parsers.Config{
JSONStrict: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think @rawkode intended to have it default false to fix #6532, see #6532 (comment) Won't default true cause a regression there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The regression is in 1.13.0 because we changed the parse behavior, I disagree that this should parse be accepted by default because it has the non-obvious behavior of discarding the object.

@danielnelson danielnelson merged commit c6519c7 into master Jan 21, 2020
@danielnelson danielnelson deleted the fix-json-strict branch January 21, 2020 18:10
danielnelson added a commit that referenced this pull request Jan 21, 2020
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
idohalevi pushed a commit to idohalevi/telegraf that referenced this pull request Sep 29, 2020
arstercz pushed a commit to arstercz/telegraf that referenced this pull request Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/json json and json_v2 parser/serialiser related fix pr to fix corresponding bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error running agent: json_strict is not defined
2 participants