Releases: apollographql/apollo-kotlin
v2.5.9
v2.5.8
Version 2.5.8 adds support for Query Batching thanks to the awesome work of @joaquim-verges (#3117) 🙌 as well as reactor bindings made with 💙 by @aoudiamoncef (#3138). Thanks a lot for making Apollo Android better️!
Query Batching
Query batching collects multiple GraphQL queries happening in a short timeframe and sends them in a single HTTP call to a compatible server. This minimizes the number of HTTP calls, for an exemple when a new screen is displayed and multiple queries are sent at the same time.
To enable batching in your ApolloClient
:
val apolloClient = ApolloClient.builder()
.serverUrl("https://")
.batchingConfiguration(
BatchConfig(
// enable batching
batchingEnabled = true,
// check queries every 20ms
batchIntervalMs = 20,
// or send as soon as there are 10 queries queued
maxBatchSize = 10
)
)
.build()
apolloClient.startBatchPoller()
Execute your queries:
val response = apolloClient.query(MyQuery())
.toBuilder()
.canBeBatched(true)
.build()
.await()
Stop batching:
apolloClient.stopBatchPoller()
Note: Enabling query batching reduces the number of HTTP calls but increases latency. Since the Batcher is run from a timer, an otherwise fast query will have to wait for both the timer to happen, and the backend to process all the events in the batch.
Reactor bindings
Project reactor is a reactive streams implementation for building non-blocking applications on the JVM. It's often used with Spring Boot for an example.
To add to your project:
// Reactor support
implementation("com.apollographql.apollo:apollo-reactor-support:x.y.z")
The usage is very similar to the RxJava2/RxJava3 bindings:
// Create Mono from a query
val mono = apolloClient.reactorQuery(query)
// Create Flux from a subscription
val flux = apolloClient.reactorSubscribe(subscription)
For more information, refer to the documentation.
Full Changelog
✨ New
👷 Fixes
- [Gradle Plugin] pass 'operationName' in the introspection query (#3126)
v2.5.7
Version 2.5.7 is built with Kotlin 1.5.0
and compatible with coroutines 1.5.0
. It also fixes a regression while parsing defaultValues with Int
values that should be coerced to Float
and allows to change the buffering of MPP subscription messages thanks to the awesome work of @joaquim-verges (#3109) and @nealsanche (#3096)
Full Changelog
✨ New
- Coroutines
1.5.0
support
👷 Fixes
v2.5.6
Gradle plugin as a fat jar.
Version 2.5.6 exposes the Gradle plugin as a fat jar to workaround a long standing issue where older versions of okio
and/or antlr
would be loaded first in the classpath and override the versions required by the plugin (See #2287, #2359, #2886, #2939, #3022).
It does so by relocating and packaging the following dependencies inside apollo-gradle-plugin.jar
:
- com.benasher44.uuid
- com.squareup.kotlinpoet
- com.squareup.javapoet
- com.squareup.moshi
- okhttp3
- okio
- org.antlr
The only functional change in this version is #3039 to include better exception messages, courtesy of @semaphore3000.
If you notice anything classloading-weird or if this doesn't work in your setup, please open an issue.
v2.5.5
Version 2.5.5 is a maintenance release with support for ".graphqls"
files and fixes in the Json parser and HTTP cache.
Full Changelog
✨ New
.graphqls
files are now recognized as schema files (#2977)
👷 Fixes
- [Runtime] Strip the priorResponse before returning it to the upstream interceptor (#3010)
- [Runtime] Fix reading feed sequence (
'\f'
) in json (#3006) - [Cache] Return consistently non-nullable String sets in NormalizedCache#merge() (#2972)
📖 Documentation
❤️ External contributors
Many thanks to @Romadro, @eduardb and @BRoy98 for their contributions!
v2.5.4
Version 2.5.4 is a maintenance release. This version dropped Jcenter publishing and is the first one to be only available on Maven Central.
It also contains some improvements around the Gradle plugin and codegen.
Full Changelog
📦 Publishing
- [Build scripts] Remove Jcenter publishing (#2955)
👷 Fixes
- [Gradle Plugin] Made
checkApolloVersions
more lazy (#2935) - [Codegen] Fix inline fragments inside inline fragments (#2928)
- [Codegen] Correctly decode defaultValue in schema.json (#2917)
- [Runtime] Fix looking up the
ResponseFieldMapper
when using delegates (#2945)
📖 Documentation
- [Docs] Fix the location of generated files (#2934)
❤️ External contributors
Many thanks to @ansman and @lorensr for their contributions!
v2.5.3
Version 2.5.3 is a maintenance release with improvements around codegen, runtime and cache.
Interfaces on interfaces
Version 2.5.3 adds support for GraphQL RFC 373 (interfaces implementing interfaces). This makes sure the codegen understands interfaces implementing other interfaces and can compute the fragments possible types appropriately. It doesn't change the generated code.
Json Content-Type
Version 2.5.3 changes the Content-Type
for apollo-runtime-kotlin
from "aplication/json; charset=utf-8"
to "application/json"
. This has been confusing spring servers and is the default json content type moving forward. If everything goes well, apollo-runtime
will also switch to "application/json"
in a future release. Read more in #2883. Many thanks to @vikrama for diving into this and fixing it.
Full Changelog
✨ New
- [Runtime] Added toString methods to api.Error and api.Error.Location (#2905)
- [Codegen] Support interface on interface (#2887)
👷 Fixes
- [Normalized Cache] Be more robust to publish errors (#2900)
- [Multiplatform] Removing deprecated charset=utf-8 from Content-Type header for multiplatform (#2883)
- [Build scripts] configure the Kotlin compiler option for multiplatform projects (#2877)
- [Tests] Fix potential case where the tests would wait forever (#2875)
- [Runtime] Use Okio's base64 implementation (#2870)
- [Runtime] Allow to store Json custom scalars in cache records (#2859)
📖 Documentation
- [Docs] Add redirect for /tutorial to the first page of the tutorial in docs (#2898)
- [Docs] Fix callback blocks (#2873)
❤️ External contributors
Many thanks to @vikrama for fixing the content-type, to @AOrobator for making the Error
and Location
classes easier to debug, to @ansman for fixing Base64 on old Android versions, to @emmano for improving the documentation and @lwasyl for all the cache investigations!
v2.5.2
Version 2.5.2 fixes a bunch of bugs and adds ApolloAndroidLogger
and AppSyncOperationMessageSerializer
. Huge thanks to @AdamMc331 and @ansman for their respective work on the logger and serializer 🙌 !
Note: version 2.5.2 is released from Github actions and that took a few iterations to get right. As a result, version 2.5.0 and 2.5.1 were not published and will never be.
ApolloAndroidLogger
ApolloAndroidLogger
is a logger that will send its output to Logcat. Use it to display debug information on Android devices:
ApolloClient.builder()
.logger(ApolloAndroidLogger())
[...]
.build
AppSyncOperationMessageSerializer
AppSyncOperationMessageSerializer
is a serializer that can understand the AWS AppSync message format. Pass it to your WebSocketSubscriptionTransport.Factory
:
// This example uses an API key. See the AppSync documentation for information on what to pass
val authorization = mapOf(
"host" to "example1234567890000.appsync-api.us-east-1.amazonaws.com",
"x-api-key" to "da2-12345678901234567890123456"
)
val webSocketUrl = AppSyncOperationMessageSerializer.buildWebSocketUrl(
baseWebSocketUrl = "wss://example1234567890000.appsync-realtime-api.us-east-1.amazonaws.com/graphql",
authorization = authorization
)
val subscriptionTransportFactory = WebSocketSubscriptionTransport.Factory(
webSocketUrl = webSocketUrl,
webSocketConnectionFactory = okHttpClient,
serializer = AppSyncOperationMessageSerializer(authorization)
)
apolloClient.builder()
.subscriptionTransportFactory(subscriptionTransportFactory)
.build()
Full Changelog
- [Android Support] Adding ApolloAndroidLogger to apollo-android-support. (#2824)
- [Build scripts] Better UP-TO-DATE checks (#2817)
- [Build scripts] Ignore Android modules during Gradle sync. (#2811)
- [Runtime] fix binary compatibility (#2812)
- [Runtime] Implement support for AWS AppSync in WebSocketSubscriptionTransport (#2809)
- [Gradle plugin] For recent versions of Gradle, use .convention to provide the default (#2803)
- [Runtime] Fix watcher clone (#2795)
- [Runtime] support null arguments (#2805)
- [Compiler] do not choke on "repeated" directive. (#2785)
v2.4.6
Version 2.4.6 is a minor release with fixes around multiplatform, normalized cache and others. Many thanks to @tylerbwong and @lwasyl for their work on the metalava integration and enum serialization respectively.
Full Changelog
[Normalized cache] Add interface for classes generated for enum types and fix sealed classes json representation (#2776)
[Multiplatform] fix NSURLSession configuration (#2777)
[Test] adding test coverage (#2770)
[Runtime] revert to okhttp 3 to support older versions of Android (#2769)
[Gradle Plugin] make convertApolloSchema never up-to-date (#2761)
[Multiplatform] Do not use Java8 Duration (#2767)
[Build scripts] Fix error.NonExistentClass in Metalava Signature Files (#2755)
[codegen] Honor packageName for schema types as well (#2759)
v2.4.5
Version 2.4.5 is a minor release with Gradle plugin improvements for manipulating schemas as well as a few other bugfixes.
convertApolloSchema
You can now convert your schema from Json to SDL and vice-versa:
./gradlew convertApolloSchema --from schema.json --to schema.sdl
pushApolloSchema
You can now push a schema to your Apollo Studio registry:
./gradlew uploadApolloSchema --key $key --graph $graph --schema schema.sdl
Full Changelog
✨ New
[Gradle Plugin] add ./gradlew convertApolloSchema --from schema.json --to schema.sdl
(#2757)
[Gradle plugin] Add pushApolloSchema (#2737)
[Publishing] add version and a few other attributes to the jar Manifest (#2736)
[Runtime] Introduce custom error class for better error handling (#2751)
👷 Fixes
[Codegen] Fix capitalized field names in input objects (#2746)