v5.0.0-alpha.3
@stream support
You may now use @stream to stream list responses from a compatible server.
To do this, opt in support for the incremental:v0.2 protocol:
val apolloClient = ApolloClient.Builder()
.networkTransport(
HttpNetworkTransport.Builder()
.serverUrl("http://example.com/graphql")
.incrementalDeliveryProtocol(IncrementalDeliveryProtocol.V0_2)
.build()
)
.build()
Using @defer and @stream will stay opt-in until the RFC is merged.
Experimental WebSockets are stable
The experimental WebSockets are promoted to stable. In particular, the request url may now be changed in interceptors. This can be used together with RetryStrategy to change the authentication parameters when retrying a subscription. The previous implementation (using the com.apollographql.apollo.ws package name) is now deprecated.
Read more in the migration guide.
Leveraging OkHttp cache
You can now use OkHttp cacheUrlOverride() to cache POST requests.
To do so, configure a cache on your OkHttpClient and use enablePostCaching:
val apolloClient = ApolloClient.Builder()
.networkTransport(
HttpNetworkTransport.Builder()
// Enable POST caching
.httpRequestComposer(DefaultHttpRequestComposer(serverUrl = mockServer.url(), enablePostCaching = true))
.httpEngine(
DefaultHttpEngine {
OkHttpClient.Builder()
.cache(directory = File(application.cacheDir, "http_cache"), maxSize = 10_000_000)
.build()
}
)
.build()
)
.build()
The existing apollo-http-cache artifacts have been deprecated. Moving forward, leveraging the cache of existing clients (OkHttp, Ktor, etc...) is the recommended way to do caching at the HTTP layer.
Read more in the migration guide.
AGP9 support
The Gradle plugin now works with AGP 9 and the com.android.kotlin.multiplatform.library plugin.
Service.issueSeverity()
You may now control the severity of issues found by the compiler in your Gradle scripts:
service("service") {
packageName.set("com.example")
// Do not fail the build on unused fragments
// Valid values are the names of the subclasses of `com.apollographql.apollo.ast.Issue`
issueSeverity("UnusedFragment", "warn")
}
👷♂️ All changes
- NEW: Promote experimental websockets to stable by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6774
- NEW: Add
@catchsupport for responseBased codegen by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6697 - NEW: Support descriptions on variable definitions by @BoD in https://github.com/apollographql/apollo-kotlin/pull/6699
- NEW: Support Android Gradle Plugin 9 (AGP9) by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6703
- NEW: Add
Service.issueSeverity()by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6731 - NEW: Add HTTP caching using OkHttp cacheUrlOverride by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6739
- NEW: Implement
@deferand@streamas ofincremental/v0.2by @BoD in https://github.com/apollographql/apollo-kotlin/pull/6331 - NEW: Add
ApolloRequest.Builder.url(String)by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6758 - NEW: Add a specific issue type for fragment cycles by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6759
- NEW: Add
ApolloInterceptor.InsertionPointto control where the interceptors are added by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6761 - NEW: Introduce
RetryStrategyby @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6764 - FIX: Make
Optional.Absentadata objectby @JakeWharton in https://github.com/apollographql/apollo-kotlin/pull/6686 - FIX: Use regular
if/elseto avoidIntboxing by @JakeWharton in https://github.com/apollographql/apollo-kotlin/pull/6688 - FIX: Remove kotlin-node dependency by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6708
- FIX: Do not check already checked fragments in checkCapitalizedFields by @BoD in https://github.com/apollographql/apollo-kotlin/pull/6718
- FIX: Pretty-print operation manifest by @BoD in https://github.com/apollographql/apollo-kotlin/pull/6720
- FIX: Allow empty deprecationReasons by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6729
- FIX: Fix IndexOutOfBoundsException in keyFields validation by @BoD in https://github.com/apollographql/apollo-kotlin/pull/6748
- FIX: Allow multiple success responses in ApolloCall.execute() by @BoD in https://github.com/apollographql/apollo-kotlin/pull/6772
- FIX: Restore JsonReader state if a field throws in-flight by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6775