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

[Refactor] From XContentType.JSON to MediaTypeRegistry.JSON #9156

Merged
merged 4 commits into from
Aug 9, 2023

Conversation

nknize
Copy link
Collaborator

@nknize nknize commented Aug 7, 2023

This PR rote refactors nearly all instances and usages of the XContentType.JSON singleton instance defined in the :libs:opensearch-x-content library to the MediaTypeRegistry.JSON singleton instance defined in :libs:opensearch-core. This decouples the server and test implementations from the x-content library such that foundation classes can be further refactored from the :server module to the :opensearch-core library without requiring a strict dependency on the x-content library. This keeps opensearch-core library loosely coupled with the remaining :libs:opensearch-* libraries such that serverless and cloud-native implementations can selective import only the libraries needed for implementation.

relates #5910
relates #8110

@github-actions
Copy link
Contributor

github-actions bot commented Aug 7, 2023

Gradle Check (Jenkins) Run Completed with:

@opensearch-trigger-bot
Copy link
Contributor

Compatibility status:

Checking compatibility for: https://github.com/opensearch-project/neural-search.git with ref: main
Checking compatibility for: https://github.com/opensearch-project/security-analytics.git with ref: main
Checking compatibility for: https://github.com/opensearch-project/opensearch-oci-object-storage.git with ref: main
Incompatible components: [https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/performance-analyzer.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/security-analytics.git]
Compatible components: [https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git]

BUILD SUCCESSFUL in 22m 53s

@opensearch-trigger-bot
Copy link
Contributor

Compatibility status:



> Task :checkCompatibility
Incompatible components: [https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/performance-analyzer.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/security-analytics.git]
Compatible components: [https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git]

BUILD SUCCESSFUL in 23m 41s

@github-actions
Copy link
Contributor

github-actions bot commented Aug 8, 2023

Gradle Check (Jenkins) Run Completed with:

This commit rote refactors nearly all instances and usages of the
XContentType.JSON singleton instance defined in the
:libs:opensearch-x-content library to the MediaTypeRegistry.JSON
singleton instance defined in :libs:opensearch-core. This decouples the
server and test implementations from the x-content library such that
foundation classes can be further refactored from the :server module to
the :opensearch-core library without requiring a strict dependency on
the x-content library. This keeps opensearch-core library loosely
coupled with the remaining :libs:opensearch-* libraries such that
serverless and cloud-native implementations can selective import only
the libraries needed for implementation.

Signed-off-by: Nicholas Walter Knize <[email protected]>
Signed-off-by: Nicholas Walter Knize <[email protected]>
Signed-off-by: Nicholas Walter Knize <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2023

Gradle Check (Jenkins) Run Completed with:

@opensearch-trigger-bot
Copy link
Contributor

Compatibility status:



> Task :checkCompatibility
Incompatible components: [https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/performance-analyzer.git]
Compatible components: [https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git]

BUILD SUCCESSFUL in 30m

@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2023

Gradle Check (Jenkins) Run Completed with:

@reta
Copy link
Collaborator

reta commented Aug 9, 2023

Test failures look legit

Signed-off-by: Nicholas Walter Knize <[email protected]>
@nknize
Copy link
Collaborator Author

nknize commented Aug 9, 2023

Test failures look legit

They were.. it was a bonehead typo on my part. :/

@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2023

Gradle Check (Jenkins) Run Completed with:

@codecov
Copy link

codecov bot commented Aug 9, 2023

Codecov Report

Merging #9156 (dfea643) into main (7560afb) will decrease coverage by 0.01%.
Report is 2 commits behind head on main.
The diff coverage is 46.37%.

@@             Coverage Diff              @@
##               main    #9156      +/-   ##
============================================
- Coverage     71.05%   71.05%   -0.01%     
+ Complexity    57367    57363       -4     
============================================
  Files          4768     4769       +1     
  Lines        270540   270546       +6     
  Branches      39559    39559              
============================================
+ Hits         192228   192232       +4     
- Misses        62164    62194      +30     
+ Partials      16148    16120      -28     
Files Changed Coverage Δ
...opensearch/client/slm/SnapshotLifecyclePolicy.java 0.00% <0.00%> (ø)
...ch/client/slm/SnapshotLifecyclePolicyMetadata.java 0.00% <0.00%> (ø)
.../opensearch/client/slm/SnapshotLifecycleStats.java 0.00% <0.00%> (ø)
...rch/client/slm/SnapshotRetentionConfiguration.java 0.00% <0.00%> (ø)
...a/org/opensearch/core/xcontent/XContentParser.java 100.00% <ø> (ø)
...h/script/mustache/MultiSearchTemplateResponse.java 59.01% <0.00%> (ø)
...script/mustache/TransportSearchTemplateAction.java 0.00% <0.00%> (ø)
...rg/opensearch/index/rankeval/RankEvalResponse.java 87.14% <0.00%> (-11.43%) ⬇️
...va/org/opensearch/index/rankeval/RankEvalSpec.java 93.85% <0.00%> (+0.87%) ⬆️
...a/org/opensearch/index/rankeval/RatedDocument.java 81.03% <0.00%> (ø)
... and 155 more

... and 449 files with indirect coverage changes

@nknize nknize merged commit 7278f43 into opensearch-project:main Aug 9, 2023
10 of 11 checks passed
@nknize nknize added the backport 2.x Backport to 2.x branch label Aug 9, 2023
neetikasinghal pushed a commit to neetikasinghal/OpenSearch that referenced this pull request Aug 9, 2023
…ch-project#9156)

This commit rote refactors nearly all instances and usages of the
XContentType.JSON singleton instance defined in the
:libs:opensearch-x-content library to the MediaTypeRegistry.JSON
singleton instance defined in :libs:opensearch-core. This decouples the
server and test implementations from the x-content library such that
foundation classes can be further refactored from the :server module to
the :opensearch-core library without requiring a strict dependency on
the x-content library. This keeps opensearch-core library loosely
coupled with the remaining :libs:opensearch-* libraries such that
serverless and cloud-native implementations can selective import only
the libraries needed for implementation.

Signed-off-by: Nicholas Walter Knize <[email protected]>
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-9156-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 7278f434cd83f095623e34c2105f1b79d247af18
# Push it to GitHub
git push --set-upstream origin backport/backport-9156-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-9156-to-2.x.

@opensearch-trigger-bot
Copy link
Contributor

Compatibility status:



> Task :checkCompatibility
Incompatible components: [https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/performance-analyzer.git]
Compatible components: [https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git]

BUILD SUCCESSFUL in 28m 5s

nknize added a commit to nknize/OpenSearch that referenced this pull request Aug 9, 2023
…ch-project#9156)

This commit rote refactors nearly all instances and usages of the
XContentType.JSON singleton instance defined in the
:libs:opensearch-x-content library to the MediaTypeRegistry.JSON
singleton instance defined in :libs:opensearch-core. This decouples the
server and test implementations from the x-content library such that
foundation classes can be further refactored from the :server module to
the :opensearch-core library without requiring a strict dependency on
the x-content library. This keeps opensearch-core library loosely
coupled with the remaining :libs:opensearch-* libraries such that
serverless and cloud-native implementations can selective import only
the libraries needed for implementation.

Signed-off-by: Nicholas Walter Knize <[email protected]>
(cherry picked from commit 7278f43)
nknize added a commit that referenced this pull request Aug 10, 2023
….JSON (#9156) (#9210)

This commit rote refactors nearly all instances and usages of the
XContentType.JSON singleton instance defined in the
:libs:opensearch-x-content library to the MediaTypeRegistry.JSON
singleton instance defined in :libs:opensearch-core. This decouples the
server and test implementations from the x-content library such that
foundation classes can be further refactored from the :server module to
the :opensearch-core library without requiring a strict dependency on
the x-content library. This keeps opensearch-core library loosely
coupled with the remaining :libs:opensearch-* libraries such that
serverless and cloud-native implementations can selective import only
the libraries needed for implementation.

Signed-off-by: Nicholas Walter Knize <[email protected]>
(cherry picked from commit 7278f43)

---------

Signed-off-by: Nicholas Walter Knize <[email protected]>
peternied pushed a commit to opensearch-project/security that referenced this pull request Aug 11, 2023
Reacts to changes in ActionListener and ActionResponse introduced in
opensearch-project/OpenSearch#9082

Also includes a fix for a call to XContentHelper.toXContent in response
to opensearch-project/OpenSearch#9156

Signed-off-by: Craig Perkins <[email protected]>
cwperks added a commit to cwperks/security that referenced this pull request Aug 15, 2023
…nsearch-project#3153)

Reacts to changes in ActionListener and ActionResponse introduced in
opensearch-project/OpenSearch#9082

Also includes a fix for a call to XContentHelper.toXContent in response
to opensearch-project/OpenSearch#9156

Signed-off-by: Craig Perkins <[email protected]>
(cherry picked from commit 31ec322)
cwperks pushed a commit to opensearch-project/security that referenced this pull request Aug 15, 2023
### Description
Manual backport for #3153 of React to changes in ActionListener in core
Also includes a fix for a call to XContentHelper.toXContent in response
to opensearch-project/OpenSearch#9156
### Issues Resolved
* Relate opensearch-project/OpenSearch#9352
* Relate #3153 

### Check List
- [ ] ~New functionality includes testing~
- [ ] ~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: Ryan Liang <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Co-authored-by: Peter Nied <[email protected]>
kaushalmahi12 pushed a commit to kaushalmahi12/OpenSearch that referenced this pull request Sep 12, 2023
…ch-project#9156)

This commit rote refactors nearly all instances and usages of the
XContentType.JSON singleton instance defined in the
:libs:opensearch-x-content library to the MediaTypeRegistry.JSON
singleton instance defined in :libs:opensearch-core. This decouples the
server and test implementations from the x-content library such that
foundation classes can be further refactored from the :server module to
the :opensearch-core library without requiring a strict dependency on
the x-content library. This keeps opensearch-core library loosely
coupled with the remaining :libs:opensearch-* libraries such that
serverless and cloud-native implementations can selective import only
the libraries needed for implementation.

Signed-off-by: Nicholas Walter Knize <[email protected]>
Signed-off-by: Kaushal Kumar <[email protected]>
brusic pushed a commit to brusic/OpenSearch that referenced this pull request Sep 25, 2023
…ch-project#9156)

This commit rote refactors nearly all instances and usages of the
XContentType.JSON singleton instance defined in the
:libs:opensearch-x-content library to the MediaTypeRegistry.JSON
singleton instance defined in :libs:opensearch-core. This decouples the
server and test implementations from the x-content library such that
foundation classes can be further refactored from the :server module to
the :opensearch-core library without requiring a strict dependency on
the x-content library. This keeps opensearch-core library loosely
coupled with the remaining :libs:opensearch-* libraries such that
serverless and cloud-native implementations can selective import only
the libraries needed for implementation.

Signed-off-by: Nicholas Walter Knize <[email protected]>
Signed-off-by: Ivan Brusic <[email protected]>
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
…ch-project#9156)

This commit rote refactors nearly all instances and usages of the
XContentType.JSON singleton instance defined in the
:libs:opensearch-x-content library to the MediaTypeRegistry.JSON
singleton instance defined in :libs:opensearch-core. This decouples the
server and test implementations from the x-content library such that
foundation classes can be further refactored from the :server module to
the :opensearch-core library without requiring a strict dependency on
the x-content library. This keeps opensearch-core library loosely
coupled with the remaining :libs:opensearch-* libraries such that
serverless and cloud-native implementations can selective import only
the libraries needed for implementation.

Signed-off-by: Nicholas Walter Knize <[email protected]>
Signed-off-by: Shivansh Arora <[email protected]>
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 enhancement Enhancement or improvement to existing feature or request skip-changelog v2.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants