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

Provide an adapted implementation of HttpResponseExpectation #317

Merged
merged 3 commits into from
Nov 6, 2024

Conversation

vietj
Copy link
Contributor

@vietj vietj commented Oct 27, 2024

Motivation:

HttpResponseExpectation as defined in vertx-core is specific to Vert.x Future API and cannot be reused by RxJava as is.

Changes:

Add an adaptor for HttpResponseExpectation that leverages the lift operator to bridge this feature.

@vietj vietj requested a review from tsegismont October 27, 2024 17:16
@vietj vietj added this to the 5.0.0 milestone Oct 27, 2024
Copy link
Contributor

@tsegismont tsegismont left a comment

Choose a reason for hiding this comment

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

I haven't read the full PR yet as I noticed the implementation consists in a custom operator.

As far as I know, it is recommended to favor composition (io.reactivex.Single#compose) instead of custom operators (io.reactivex.Single#lift).

As the Javadoc of lift suggests, there are some optimizations that a custom operator must implement itself, that built-in operators implement already.

Besides, if I remember correctly, this is what @jponge recommends for Mutiny extensions as well (start with composition and use custom operators as a last resort).

I would imagine the same feature (HttpResponse expectations) will be implemented with composition in Mutiny, it would be nice to be consistent.

I will send a PR to your branch to show the difference (and how small it is in user experience at the same time).

@tsegismont
Copy link
Contributor

I will send a PR to your branch to show the difference (and how small it is in user experience at the same time).

See #318

@vietj
Copy link
Contributor Author

vietj commented Oct 29, 2024

excellent @tsegismont I merged your PR to this PR

@tsegismont
Copy link
Contributor

@vietj I'll look into the build failure. Also, given transformers are safe to share, I think we can add some constants for expectations (I'll update the branch directly).

Then, before merging, we can wait for @jponge feedback (I believe he will be back next Monday)

@vietj
Copy link
Contributor Author

vietj commented Oct 30, 2024

@tsegismont constants is not possible because of the variance that needs to adapt to the actual single type

@vietj
Copy link
Contributor Author

vietj commented Oct 30, 2024

I'll let this PR in your hands @tsegismont

vietj and others added 3 commits November 4, 2024 17:41
Motivation:

HttpResponseExpectation as defined in vertx-core is specific to Vert.x Future API and cannot be reused by RxJava as is.

Changes:

Add an adaptor for HttpResponseExpectation that leverages the lift operator to bridge this feature.
As far as I know, it is recommended to favor composition (io.reactivex.Single#compose) instead of custom operators (io.reactivex.Single#lift).

As the Javadoc of lift suggests, there are some optimizations that a custom operator must implement itself, that built-in operators implement already.

Besides, if I remember correctly, this is what @jponge recommends for Mutiny extensions as well (start with composition and use custom operators as a last resort).

I would imagine the same feature (HttpResponse expectations) will be implemented with composition in Mutiny, it would be nice to be consistent.

Signed-off-by: Thomas Segismont <[email protected]>
@tsegismont
Copy link
Contributor

I've added documentation, and I'm now waiting for feedback from @jponge before merging.

@jponge
Copy link
Member

jponge commented Nov 5, 2024

Looking into it shortly

@jponge
Copy link
Member

jponge commented Nov 5, 2024

It's in line with what we had discussed for Mutiny, aka we'd need something that turns Vert.x expectations into Mutiny operators so they can be .plug-ed. The exact solution for Mutiny might differ compared to this PR because the APIs differ, but that's the idea indeed.

@tsegismont
Copy link
Contributor

Thanks @jponge

@tsegismont tsegismont merged commit 3a9bc5b into master Nov 6, 2024
4 checks passed
@tsegismont tsegismont deleted the http-response-expectation branch November 6, 2024 09:15
@tsegismont tsegismont removed the request for review from jponge November 6, 2024 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants