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

[Maintenance-2930] Review use of JSON Flattener #3674

Conversation

prabhask5
Copy link
Contributor

@prabhask5 prabhask5 commented Nov 9, 2023

Description

Implement JsonFlattener helper class as written in #2926 to deprecate the use of the unnecessary JsonFlattener third party module.

  • Category (Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation)

Maintenance

  • Why these changes are required?

The JsonFlattener module was being utilized in only one place for one specific purpose, so these functions can be implemented as part of the OpenSearch codebase instead of importing an unnecessary third party module.

  • What is the old behavior before changes and new behavior after changes?

Hopefully nothing.

Issues Resolved

Is this a backport? If so, please add backport PR # and/or commits #

No

Testing

Tests checked to make sure functions are not broken.

Check List

  • New functionality includes testing
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link
Collaborator

@willyborankin willyborankin left a comment

Choose a reason for hiding this comment

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

Hi @prabhask5, thank you for the fix.
Could you please:

  • add a Unit test for the JsonFlattener class
  • the library and all it dependencies needs to be excluded as well form build.gradle
  • fix all java compiler warnings, this is the reason why build did not pass

@prabhask5
Copy link
Contributor Author

@willyborankin I'm getting a type safety warning that's causing the java builds to fail. I could not find a way to fix it while still using a generic cast, so I'm manually suppressing it as a temp fix. Please let me know if you know any better fix. Thanks!

Signed-off-by: Prabhas Kurapati <[email protected]>
Copy link

codecov bot commented Nov 14, 2023

Codecov Report

Merging #3674 (d648937) into main (905c97d) will increase coverage by 64.91%.
Report is 16 commits behind head on main.
The diff coverage is 88.46%.

❗ Current head d648937 differs from pull request most recent head 87c56e3. Consider uploading reports for the commit 87c56e3 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           main    #3674       +/-   ##
=========================================
+ Coverage      0   64.91%   +64.91%     
=========================================
  Files         0      293      +293     
  Lines         0    20796    +20796     
  Branches      0     3411     +3411     
=========================================
+ Hits          0    13500    +13500     
- Misses        0     5606     +5606     
- Partials      0     1690     +1690     
Files Coverage Δ
...nsearch/security/compliance/FieldReadCallback.java 55.55% <ø> (ø)
...org/opensearch/security/support/JsonFlattener.java 88.46% <88.46%> (ø)

... and 291 files with indirect coverage changes

Signed-off-by: Prabhas Kurapati <[email protected]>
Signed-off-by: Prabhas Kurapati <[email protected]>
@prabhask5
Copy link
Contributor Author

@willyborankin @DarshitChanpura I added more complex tests- lmk if I should write some for the helper functions. Ty!

Signed-off-by: Prabhas Kurapati <[email protected]>
@willyborankin willyborankin added the backport 2.x backport to 2.x branch label Dec 2, 2023
@willyborankin willyborankin merged commit 87de7e2 into opensearch-project:main Dec 2, 2023
76 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Dec 2, 2023
### Description

Implement JsonFlattener helper class as written in #2926 to deprecate
the use of the unnecessary JsonFlattener third party module.

* Category (Enhancement, New feature, Bug fix, Test fix, Refactoring,
Maintenance, Documentation)

Maintenance

* Why these changes are required?

The JsonFlattener module was being utilized in only one place for one
specific purpose, so these functions can be implemented as part of the
OpenSearch codebase instead of importing an unnecessary third party
module.

* What is the old behavior before changes and new behavior after
changes?

Hopefully nothing.

### Issues Resolved
- #2930

Is this a backport? If so, please add backport PR # and/or commits #

No

### Testing
Tests checked to make sure functions are not broken.

### Check List
- [x] New functionality includes testing
- [x] New functionality has been documented
- [x] Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and
signing off your commits, please check
[here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).

---------

Signed-off-by: Prabhas Kurapati <[email protected]>
(cherry picked from commit 87de7e2)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
cwperks pushed a commit that referenced this pull request Dec 6, 2023
Backport 87de7e2 from #3674.

---------

Signed-off-by: Prabhas Kurapati <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Signed-off-by: Darshit Chanpura <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Darshit Chanpura <[email protected]>
prabhask5 added a commit to prabhask5/opensearch-security that referenced this pull request Jan 11, 2024
)

### Description

Implement JsonFlattener helper class as written in opensearch-project#2926 to deprecate
the use of the unnecessary JsonFlattener third party module.

* Category (Enhancement, New feature, Bug fix, Test fix, Refactoring,
Maintenance, Documentation)

Maintenance

* Why these changes are required?

The JsonFlattener module was being utilized in only one place for one
specific purpose, so these functions can be implemented as part of the
OpenSearch codebase instead of importing an unnecessary third party
module.

* What is the old behavior before changes and new behavior after
changes?

Hopefully nothing.

### Issues Resolved
- opensearch-project#2930

Is this a backport? If so, please add backport PR # and/or commits #

No

### Testing
Tests checked to make sure functions are not broken.

### Check List
- [x] New functionality includes testing
- [x] New functionality has been documented
- [x] Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and
signing off your commits, please check
[here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).

---------

Signed-off-by: Prabhas Kurapati <[email protected]>
@prabhask5 prabhask5 deleted the pk-deprecate-json-flattener-module branch July 10, 2024 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x backport to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants