[Feature/extensions] Return consumed params and content from extensions#4705
Conversation
Signed-off-by: Daniel Widdis <widdis@gmail.com>
Signed-off-by: Daniel Widdis <widdis@gmail.com>
Signed-off-by: Daniel Widdis <widdis@gmail.com>
Gradle Check (Jenkins) Run Completed with:
|
|
Gradle check failure associated with #4661, need to catch up feature/extension branch to main |
server/src/main/java/org/opensearch/extensions/rest/RestExecuteOnExtensionResponse.java
Show resolved
Hide resolved
| * | ||
| * @return the list of consumed params. | ||
| */ | ||
| public List<String> getConsumedParams() { |
There was a problem hiding this comment.
Trying to learn, how do regular HTTP servers respond?
Is returning back consumed params a standard?
There was a problem hiding this comment.
I'm not sure how it is outside of OpenSearch. All I know is that OpenSearch spits out an error if you include parameters which aren't included.
There was a problem hiding this comment.
Which is pretty interesting, Is there a code pointer in OpenSearch. I would love to see why we put it in place.
There was a problem hiding this comment.
Well, it's part of the RestRequest class that we have to use to forward the relevant bits to the extension (and track the consuming).
Here's where it throws an exception on unconsumed params:
OpenSearch/server/src/main/java/org/opensearch/rest/BaseRestHandler.java
Lines 105 to 118 in 60d7a09
There was a problem hiding this comment.
Here's the PR from 6 years ago with more info:
9a83ded
Looks like the intent is to provide a "you typed blah, did you mean bleh?" functionality
saratvemulapalli
left a comment
There was a problem hiding this comment.
The changes look good to me.
Just a couple of questions for my learning. Thanks @dbwiddis !
|
Started gradle check again |
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
…enSearch into response
Gradle Check (Jenkins) Run Completed with:
|
Codecov Report
@@ Coverage Diff @@
## feature/extensions #4705 +/- ##
========================================================
+ Coverage 70.52% 70.68% +0.16%
- Complexity 57898 57900 +2
========================================================
Files 4708 4708
Lines 278528 277873 -655
Branches 40661 40395 -266
========================================================
+ Hits 196420 196421 +1
+ Misses 65740 65215 -525
+ Partials 16368 16237 -131
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Companion PR: opensearch-project/opensearch-sdk-java#169
Note: merging this PR will break SDK main due to changes in transport parameters. Merge the two together.
Description
Moves the
ExtensionRestResponseclass from the SDK too.o.extensions.rest.RestExecuteOnExtensionResponseto copy over the content fromExtensionRestResponseand use it for transportExtensionRestRequestbecause they extend different superclasses (RestResponseandTransportResponse)RestResponseis an interface and we could extend it but we'd lose all the goodness of theBytesRestResponseimplementation that we extend, so we'd have to copy all that. Having two very similar classes here is better.RestSendToExtensionActionenabled by the above two stepsIssues Resolved
Fixes SDK #165
Check List
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.