-
Notifications
You must be signed in to change notification settings - Fork 59
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
Psr interfaces #233
base: main
Are you sure you want to change the base?
Psr interfaces #233
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this change, thank you! Let's iterate till we get this to green. I think it's a lot simpler than #228, what do you think @shyim?
- Sign DCO,
git commit -s --amend
for existing commits, force push. - Add to CHANGELOG.
- Let's add an UPGRADING.md like https://github.com/opensearch-project/opensearch-py/blob/main/UPGRADING.md with details on migrating to this version.
- Should we keep a
OpenSearch\ClientBuilder
even with different parameters for easier migration?
82721bd
to
2f4661d
Compare
I noticed you tried to fix DCO?
Something is not adding up between your settings and the commit signature. |
16b664e
to
f14e9a2
Compare
I think I fixed that now? Let me know if it's still not rigt. I've updated the ClientBuilder and refactored the endpoints callable into it's own factory class. I think this makes it easier to understand, and also allows clients to swap out an implementation or use a dependency injection container if they want. I updated the client and namespace templates also. I regenerated afterwards and it looks like there are a lot of new API methods added. Should I use something other than https://github.com/opensearch-project/opensearch-api-specification/releases/download/main-latest/opensearch-openapi.yaml ? |
I think setHandler are not working anymore right? So aws sig v4 needs to be adjusted? |
Yes, I think we'd need to rewrite the guzzle middleware/handler without the ring dependency to make it easier for people who use AWS OpenSearch service to use signed requests. |
Yep looks good.
👍
Let's work on merging #223 separately from this not to mix in the PSR changes. It needs some attention to tests. If nobody picks it up here I can do it soon. |
be04c45
to
df01728
Compare
Thinking about this more, returning HTTP Response might not be the best DX. We should introduce a The Promise would also return this too. Thoughts? |
@kimpepper In other clients we return a strongly typed object that derives from a base class that also gives access to the underlying raw HTTP response from the network library "as is" along with some helper methods like status code or raw body. Note that OpenSearch returns more than JSON, too. |
I fixed what was broken in #223 and merged, rebase. |
I think the strongly typed object would require a lot of work on the generator side and might be out of scope for this issue? Not sure whether it's worth a simple wrapper around the PSR Response and HTTP Promise that gets returned? |
From my understanding the response content types can be one of:
but I couldn't find the docs to back that up. |
100%
I would if we think it makes it easier to extend it later in a common way across multiple transports (it feels like it would). |
We cover the range in https://github.com/opensearch-project/opensearch-api-specification, see https://github.com/opensearch-project/opensearch-api-specification/blob/07e329e8d01fd0576de6a0a3c35412fd5a9163db/tools/src/tester/MimeTypes.ts#L10. OpenSearch returns plain text, JSON, nd-json, CBOR, SMILE, and YAML, most from cat APIs. Did you see XML somewhere? That may be a miss in API specs :) |
df01728
to
ec11701
Compare
I created a separate PR #236 to deal with the bulk change to |
Split out #237 for the endpoint factory changes here. |
Thanks @kimpepper! Let's work through those. |
Signed-off-by: Kim Pepper <[email protected]>
Signed-off-by: Kim Pepper <[email protected]>
Signed-off-by: Kim Pepper <[email protected]>
Signed-off-by: Kim Pepper <[email protected]>
96dc8c8
to
33f0169
Compare
Signed-off-by: Kim Pepper <[email protected]>
Rebased on |
Signed-off-by: Kim Pepper <[email protected]>
@kimpepper WDYT about adding something like https://github.com/opensearch-project/opensearch-py/blob/main/UPGRADING.md? |
Yep, I think that's a great idea. |
Added UPGRADING.md |
a67354b
to
ebc598c
Compare
Signed-off-by: Kim Pepper <[email protected]>
ebc598c
to
552cce0
Compare
Co-authored-by: Christophe Coevoet <[email protected]> Signed-off-by: Kim Pepper <[email protected]>
Signed-off-by: Kim Pepper <[email protected]>
The UPGRADING seems to imply that we do have some backwards incompatible changes in returns and configuration? I that case I do think this should bump us to 3.0, right? The deprecations would say 4.0. |
I added a lot of BC and deprecation triggers so this would go in 2.4.x and the BC layer removed in 3.0.x |
The only thing not mentioned is dropping async which wasn't working anyway. |
Add a line. Better safe than sorry. |
Signed-off-by: Kim Pepper <[email protected]>
Added more details to the |
Signed-off-by: Kim Pepper <[email protected]>
I've been doing some manual testing of the new API with the |
I needed to create my own factories for Guzzle and Symfony as we allow Drupal config to manage a few of the settings such as base URI and basic auth. |
Here's the issue https://www.drupal.org/project/search_api_opensearch/issues/3495196 |
Fixes #199
Description
This PR removes the dependency on a specific HTTP client implementation and introduces PSR-7, PSR-17 and PSR-18 interfaces.
Issues Resolved
It greatly simplifies the volume and complexity of the library codebase and removes the need to manage:
Users of this library can choose from a number of synchronous and asynchronous HTTP clients including:
It greatly simplifies the volume and complexity of the library codebase. Specifically, it:
ezimuel/ringphp
which is not longer getting updatesBreaking changes
\Psr\Http\Message\StreamInterface
to decode the response in a memory efficient wayTasks:
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.