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

fix(parsers.json_v2): Properly handle optional fields #14008

Merged
merged 7 commits into from
Oct 2, 2023

Conversation

caallinson
Copy link
Contributor

@caallinson caallinson commented Sep 27, 2023

Required for all PRs

resolves #13990

Correct checkResult() to return error when result does not exist, even if it is optional (other return value already denotes optional for calling logic).

@telegraf-tiger telegraf-tiger bot added area/json json and json_v2 parser/serialiser related fix pr to fix corresponding bug plugin/parser 1. Request for new parser plugins 2. Issues/PRs that are related to parser plugins labels Sep 27, 2023
Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

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

Thanks for the issue, debug, and PR! It is great to get fixes directly from users.

I will say I am always slightly concerned to make changes to the parsers, given their wide usage, and how users can end up depending on incorrect behavior. However, in this case I do think this new behavior is more correct. I await to see if there is any further fallout.

@powersj powersj added waiting for response waiting for response from contributor ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. and removed waiting for response waiting for response from contributor labels Sep 27, 2023
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

@caallinson just one request to add a comment... Otherwise the code looks good.

@caallinson
Copy link
Contributor Author

@powersj @srebhan Updated PR from discussion in comments

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

@caallinson thanks for improving this code! Suggestion for extending the code to prevent others to change the error back to nil for optional entries... What do you think?

@caallinson
Copy link
Contributor Author

@srebhan for review

Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

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

Thanks for working through this!

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks for the amazing work @caallinson!

@srebhan srebhan merged commit 69612a8 into influxdata:master Oct 2, 2023
@github-actions github-actions bot added this to the v1.28.2 milestone Oct 2, 2023
powersj pushed a commit that referenced this pull request Oct 2, 2023
Co-authored-by: Christian Allinson <christian.allinson@rebuildmanufacturing.com>
(cherry picked from commit 69612a8)
@caallinson caallinson deleted the 13990_json_v2_nested branch October 9, 2023 18:03
sumo-drosiek pushed a commit to SumoLogic/telegraf that referenced this pull request Aug 22, 2024
Co-authored-by: Christian Allinson <christian.allinson@rebuildmanufacturing.com>
(cherry picked from commit 69612a8)
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 plugin/parser 1. Request for new parser plugins 2. Issues/PRs that are related to parser plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate lines emitted from json_v2 when mixing Object and Tag/Field configurations
3 participants