fix: Flag ZClient.request as deprecated#3931
Merged
Conversation
✅ Deploy Preview for zio-http ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
8e2dfb8 to
2ce6123
Compare
Fixes zio#3133 This PR marks the `request` methods in the `ZClient` class as deprecated to align with the companion object's deprecation and guide users toward using `batched` or `streaming` methods instead. Changes: - Added @deprecated annotation to both `request` method overloads in ZClient class - Added @nowarn annotations to internal usages to suppress deprecation warnings - Updated test files with @nowarn to maintain compilation with -Xfatal-warnings /claim zio#3133
2ce6123 to
4455ea6
Compare
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #3133 by properly marking the ZClient.request instance methods as deprecated, ensuring users receive deprecation warnings when calling these methods on a ZClient instance.
Changes:
- Added
@deprecatedannotations to bothrequestmethod overloads in theZClientclass - Suppressed deprecation warnings in internal code and tests that legitimately use the deprecated methods
- Imported
nowarnannotation where needed
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| zio-http/shared/src/main/scala/zio/http/ZClient.scala | Added deprecation annotations to instance request methods and suppressed warnings for internal usages |
| zio-http/shared/src/main/scala/zio/http/endpoint/internal/EndpointClient.scala | Suppressed deprecation warning for legitimate internal usage |
| zio-http/jvm/src/test/scala/zio/http/netty/client/NettyConnectionPoolSpec.scala | Suppressed deprecation warnings in test file |
| zio-http/jvm/src/test/scala/zio/http/netty/NettyStreamBodySpec.scala | Suppressed deprecation warnings in test file |
| zio-http/jvm/src/test/scala/zio/http/ZClientAspectSpec.scala | Suppressed deprecation warnings in test file |
| zio-http/jvm/src/test/scala/zio/http/RequestStreamingServerSpec.scala | Suppressed deprecation warnings in test file |
| zio-http/jvm/src/test/scala/zio/http/ClientStreamingSpec.scala | Suppressed deprecation warnings in test file |
| zio-http-example/src/main/scala/example/CurlLoggerExample.scala | Suppressed deprecation warnings in example code |
| zio-http-cli/src/main/scala/zio/http/endpoint/cli/Retriever.scala | Suppressed deprecation warning for internal usage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
987Nabil
approved these changes
Mar 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
requestmethod in theZClientcompanion object was marked as deprecated, but the instance methods were not. This caused confusion for users who had aZClientinstance and calledrequestdirectly without seeing any deprecation warning.As noted in #3133:
Fixes #3133
Solution
@deprecated("Use batched or streaming instead", since = "3.0.0")annotation to bothrequestmethod overloads in theZClientclass@nowarn("msg=deprecated")to internal usages that legitimately call the deprecated method@nowarnto maintain compilation with-Xfatal-warningsChanges
zio-http/shared/src/main/scala/zio/http/ZClient.scalazio-http/shared/src/main/scala/zio/http/endpoint/internal/EndpointClient.scalaTesting
All existing tests compile and pass with the deprecation warnings properly suppressed.
/claim #3133