releases.shpreview
Apollo GraphQL/Apollo Kotlin

Apollo Kotlin

$npx -y @buildinternet/releases show apollo-kotlin
Mon
Wed
Fri
AprMayJunJulAugSepOctNovDecJanFebMarApr
Less
More
Releases8Avg2/moVersionsv4.4.0 → v5.0.0-alpha.7
Jun 2, 2021

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

  • Implement Query Batching for apollo-runtime (#3117)
  • Add Reactor support (#3138)

👷‍ Fixes

  • [Gradle Plugin] pass 'operationName' in the introspection query (#3126)
May 20, 2021

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

  • [Codegen] Codegen compilation error for Float scalars with default values in Input objects (#3108)
  • [MPP] Subscriptions seem to be dropping items (#3095)
Apr 12, 2021

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.

Mar 22, 2021

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

  • added a very basic MPP subscription sample (#3008)
  • Fix code example (#2982)

❤️ External contributors

Many thanks to @Romadro, @eduardb and @BRoy98 for their contributions!

Feb 24, 2021

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!

Feb 1, 2021

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!

Jan 8, 2021

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)
Nov 30, 2020

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)

Nov 18, 2020

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)

Nov 11, 2020

Version 2.4.4 is a hotfix release to disable using Kotlin parameters default values to represent GraphQL variables default values (#2741). This is not needed as the server can infer the variable default value from the query document and created a bunch of other issues (#2744 and #2742) in addition to sending uneeded variables alongside the query.

query GetHero($myBool: Boolean = true) { ... }

will now correctly generate

// no variable will be sent alongside the query by default
// and the server will read the default value from the GraphQL query document
data class GetHero(val myBool: Input<Boolean> = Input.absent())

This bug was introduced in version 2.4.2. If you're using GraphQL queries with variables default values, please upgrade to 2.4.4.

#2741 also fixes a crash in the handling of @include directives using variables default values in a much less invasive way. Many thanks to @DSteve595 for investigating this and pointing to the correct solution.

Changes:

  • [Codegen] Revert default values as Kotlin default parameters and made skipField more robust (#2741)
Nov 9, 2020

Version 2.4.3 is a minor version to fix a regression in ./gradlew downloadApolloSchema introduced in 2.4.2. The task would fail asking for a service even if schema and endpoint were correctly passed (See #2728 for more details). Many thanks to @nicusorflorin for spotting this!

Other included fixes:

[SDL] better handling of string escapes (#2729) [KMP] added a 'timeoutMillis' parameter to ApolloHttpNetworkTransport (#2680)

Nov 2, 2020

Version 2.4.2 is a maintenance release with language improvements and fixes, better SQL cache debug, Websocket management and more.

SDL type extensions

Type extensions are now supported in SDL schemas. SDL schema can now include extension like below:

extend type Starship {
  shieldLevel: Float!
}

Variable default values

Apollo Android now supports default values for variables (#2704)

query GetHero(
  $myBool: Boolean = true,
  $unit: LengthUnit! = FOOT,
  $listOfInts: [Int] = [1, 2, 3]
) {
  ...
}

will generate:

data class GetHero(
  val myBool: Input<Boolean> = Input.optional(true),
  val unit: LengthUnit = LengthUnit.safeValueOf("FOOT"),
  val listOfInts: Input<List<Int?>> = Input.optional(listOf(1, 2, 3))
) 

This only works for scalar types and their list/nonnull declinations. Full support for input object will be added later. Follow #2572 for updates

Better subscription Websocket management

SubscriptionManger.reconnect is now exposed as public API. It can be called to reconnect a WebSocket if credentials/token needs to be refreshed.

Full Changelog

✨ New

[Subscriptions] expose SubscriptionManager.reconnect() (#2706) [Compiler] Add support for default variable values (#2704) [SQL cache] implement SqlNormalizedCache.dump (#2709) [SDL] add support for type extensions (#2666) [Multi-modules] Add packageName option to override fragments package name (#2669)

👷‍ Fixes

[Compiler] fix @deprecated(reason:"") directive (#2720) [Compiler] fix @deprecated directive without any deprecation reason (#2692) [Gradle plugin] fix downloadApolloSchema variants detection (#2712) [Compiler] support multiple arguments in directives (#2711) [Compiler] Fix merging fields would forget inline fragments in some cases (#2689) [Multiplatform] set the correct Content-Type on iOS (#2691) [SDL] allow to have schemas without mutations/subscriptions (#2684) [Gradle Plugin] Make CheckDuplicate task cacheable (#2688) [Java codegen] Do not try to annotate primitive types in List type parameters (#2663) [Compiler] Fix Missing Referenced Fragments in Root query type (#2647) [Publishing] fix the license url and a few other dangling urls after the master -> (#2639)

📖 Documentation

[Documentation] use the correct "image/jpeg" mimetype. (#2699)

❤️ External contributors

Many thanks to:

  • @tylerbwong for diving deep into root query types fragments and inline fragments
  • @olivierg13 for making the Gradle build cache always better
  • @Laimiux for making multi-module package names more sensible
  • @renclav, @MadJonTurck, @DSteve595, @benoitletondor and @NitroG42 for all the detailed feedback and investigations, this helps a ton !
Oct 5, 2020

Version 2.4.1 brings a bunch of bug fixes, support for Gradle configuration cache and better Apollo Studio integration.

Gradle configuration cache

Apollo Android now supports Gradle configuration cache. Configuration cache is still an incubating Gradle feature. If you notice any warning in your builds, please file an issue

Studio integration

Users of Apollo Studio can now use the built-in ApolloClientAwarenessInterceptor to get more insights about their Android clients. Check the related documentation for more details how to do this.

Also, the Gradle plugin can now download schemas from the registry in addition to using introspection. To download a schema from the registry, use the --graph argument:

./gradlew downloadApolloSchema --graph $APOLLO_GRAPH --key $APOLLO_KEY --schema schema.[json | sdl]

Full Changelog

✨ New

[Gradle Plugin] add registry download (#2617) [Runtime] add a client awareness OkHttp interceptor (#2603) [Gradle Plugin] configuration cache compatibility (#2608)

👷‍ Fixes

[Compiler] fix line wrapping on long lines with forEach lambda. (#2621) [Compiler] fix cache key for arguments that contain lists (#2592) [Gradle Plugin] fix absolute paths in windows (#2615)

⚙️ Internal

[Runtime] Fix some operation log calls (#2599)

❤️ External contributors

Many thanks to @SamuelFrankSmith, @BenSchwab, @moshkit, @annieechen for their awesome work on codegen, runtime, documentation and help keep the project in good shape in general!

Sep 22, 2020

Version 2.4.0 brings multiple new features and bugfixes. Read below for the most important changes and full changelog

Experimental Multi-Modules support

Version 2.4.0 brings Multi-Modules support. With Multi-Modules, you can reuse GraphQL fragments from different Gradle modules for better separation of concerns and improved build speed.

Configure your parent module to generate Apollo metadata:

// parent/build.gradle.kts
apollo {
    generateApolloMetadata.set(true)
}

And declare your parent module as a dependency of your feature module:

// feature/build.gradle.kts
dependencies {
    implementation("com.apollographql.apollo:apollo-runtime:xyz")
    // more regular dependencies

    // Apollo dependencies
    apolloMetadata(project(":parent"))
    // You still need to declare the parent module as a regular dependency
    implementation(project(":parent"))
}

For more information, read the official documentation

⚠️ Multi-Modules is currently experimental and we'd love to hear how it worked (or not worked) for you. We welcome issues/feedback through the Github Issues

SDL schemas improvements

Version 2.4.0 brings even more fixes and tools to work with SDL schemas. SDL schemas are a more concise and readable way to work with GraphQL schemas. To use them, replace schema.json with your SDL schema schema.sdl. You can get a SDL schema from your GraphQL Playground if your endpoint has an associated Playground instance. If you don't have a playground instance or another way to download a SDL file, version 2.4.0 can make an introspection query and save it in SDL format. The schema will be saves as Json or SDL depending on the filename extension:

./gradlew downloadApolloSchema --endpoint https://your.graphql/endpoint --schema src/main/graphql/com/example/schema.sdl

Coroutines

If you're using apollo-coroutines-support, version 2.4.0 brings apolloCall.await() (#2574). It is more concise than the previous apolloCall.toDeferred().await() and also respects structured concurrency. We strongely encourage to move to .await(). Many thanks to @R4md4c for adding this!

Kotlin 1.4.10

The Kotlin 1.4.10 ecosystem is moving forward and we bumped a few dependencies (sqldeligh, okio, kotlin-compile-testing, coroutines and obviously kotlin).

The Gradle plugin is also compiled against Kotlin 1.4.10 despite Gradle forcing Kotlin 1.3.72 at runtime. We compile with apiVersion = "1.3" and our tests do not show any issue but please let us know if you see any weird Gradle behaviour.

FileUpload

Version 2.4.0 fixes how files were written in variables (#2566) and allows to subclass FileUpload to make it work without a File. With Android 11 and scoped storage out of the door, this will allow to upload from a content uri or any other data source. The API was inspired by OkHttp RequestBody. If you ever used OkHttp before, you shouldn't be disoriented:

  object upload : FileUpload(mimetype) {
    override fun contentLength(): Long {
      TODO("return contentLength here")
    }
    override fun fileName(): String? {
      TODO("return fileName to use in the multipart request here")
    }
    override fun writeTo(sink: BufferedSink) {
      TODO("write the data here")
    }
  }

Full Changelog

✨ New

  • Multi-module support (#2514)
  • [Plugin] Allow to download SDL schemas (#2586)
  • [Plugin] Add an option to fail on deprecated usages (#2575)
  • [FileUpload] allow to sub class FileUpload (#2569)
  • [FileUpload] Allow to encode custom scalar types as null and use it for file uploads (#2566)
  • [Coroutines] Add ApolloCall.await with better structured concurrency support. (#2574)

👷‍♂️ Fixes

  • [RxJava] fix retry() (#2587) Note that this is a behaviour change and this will clone the operation under the hood. If you were calling refetch() directly, you might need to update your calling code.
  • [SDL] Fix a scalar definition after a union defintion (#2559)
  • [Compiler] fix optional Int properties with an uppercase name (#2543)
  • [SQLNormalizedCache] fix watcher not called on initial cache write (#2538)

⚙️ Internal

  • Update CI to use main instead of master (#2594)
  • Update LICENSE with new organization name (#2584)
  • Add Kotlin as language for the codeblock (#2580)
  • Bump Kotlin to 1.4.10 (#2578)
  • Bump sql delight version to 1.4.3 (#2564)
  • Compile Kotlin against stdlib 1.3 (#2555)
  • Put the location of the .xcodeproj file for Kotlin Multiplatform Mobile integration in Android Studio (#2554)
  • [Plugin] allow running the plugin on Gradle 5.6 (#2539)
  • Bump kotlin compile testing (#2547)

❤️ External contributors

Many thanks to @R4md4c, @dush1729, @jaggs6 for their awesome work on coroutines, documentation and keeping the project in good shape in general!

Aug 24, 2020

Kotlin 1.4 release

This is the Kotlin 1.4 release. It contains native binaries compiled for 1.4 and bumps some dependencies.

It also fixes ApolloCall.Builder.useHttpGetMethodForQueries, thanks a lot to @ubuntudroid for diving into this!

✨ New

  • Kotlin 1.4 support (#2510)

👷‍♂️ Fixes

  • Fix RealApolloCall.toBuilder() not respecting useHttpGetMethodForQueries (#2530)
Aug 13, 2020

⚠️ Auto Persisted Queries changes

Enabling Auto Persisted Queries with ApolloClient.Builder.enableAutoPersistedQueries(true) will now enable mutations as well (#2509). This should cause no problem in the vast majority of cases. Server supporting auto persisted queries usually support auto persisted mutations as well. As a precautionary measure, we nonetheles recommend testing the integration with your server after upgrading.

JS support for generated models

The generated models and parsers can now target Javascript thanks to @andersio and @omainegra 💛. Check out the documentation for adding it to your multiplatform project. For runtime support, follow this issue.

OperationOutputGenerator

In addition to OperationIdGenerator, you can now generate operation IDs in batch. This is useful if your backend requires a list of operations to whitelist that should be sent all at once.

Exemple usage:

// build.gradle.kts
apollo {
    // ...
    operationOutputGenerator.set(object : com.apollographql.apollo.compiler.OperationOutputGenerator {
        // don't forget to bump the version if you change the implementation
        override val version = "v1"

        override fun generate(operationDescriptorList: Collection<OperationDescriptor>): OperationOutput {
            return operationDescriptorList.associate {
                it.source.md5() to it
            }
        }
    })
}

Full Changelog

✨ New

  • [Gradle Plugin] add a way to generate operation ids as batch (#2476)
  • [Multiplatform] JS support in apollo-api (#2467)
  • [SDL] add a basic validation test (#2493)

👷‍♂️ Fixes

  • [Runtime] AutoPersistedQueries supported for mutations
  • [Runtime] add missing @Deprecated and toBuilder for ApolloMutationCall (#2501)
  • [Kotlin Runtime] do not use Java8 forEach which is not available on some older android versions (#2517)
  • [SqlLite Cache] bump SqlDelight version, fixes compatibility with SqlDelight 1.4.0 (#2508)
  • [Plugin] better error message for multiple schemas (#2488)
  • [Compiler] allow defaultValue="null" for non-string scalar types (#2490)
  • [RxJava2] Add is disposed checking to single (#2480)
  • [SQL Cache] Fix writeToCacheAsynchronously boolean always false when prepareInterceptorChain() is called (#2484)

⚡ Performance

⚙️ Internal

  • [apollo-api] prefix Boolean Kotlin properties with is for better java interop (#2474)

❤️ External contributors

Many thanks to @JakeSteam, @nymerias, @s1ee, @andersio, @omainegra and @olivierg13 for their awesome contributions!

Jul 24, 2020

Highlights

Normalized cache performance improvements:

Continuing from version 2.2.2, this version adds even more cache performance improvements. For SqlNormalizedCache, reads are now wrapped in a transaction, which will make things faster, especially on large objects (#2422). You also have the option to opt-in asynchonous cache writes (#2416):

apolloClient.normalizedCache(cacheFactory, cacheKeyResolver, true)

Passing true for writeToCacheAsynchronously will make your UI display faster since it will get the network response without waiting for the cache write to happen.

SDL schema support:

Apollo Android now supports SDL (Schema Definition Language) for schemas (#2417). SDL is more concise and easier to read than the introspection json. To use it, place your SDL file in src/main/graphql/$some/$subdirectory/schema.sdl

✨ New

  • [Codegen] Enable SDL schema Apollo Plugin support (#2417)
  • [Performance] Batch normalized sql cache reads (#2422)
  • [Performance] Run ApolloCacheInterceptor store write on dispatcher thread (#2416)
  • [Runtime] add ApolloClient.autoPersistedOperationsInterceptorFactory (#2420)
  • [apollo-normalized-cache] multiplatform support (#2457)

👷‍♂️ Fixes

  • [Publication] Fix packaging of apollo-normalized-cache (#2465)
  • [Compiler] Fix issue with using inline fragment inside another inline fragment (#2462)
  • [LruNormalizedCache] Fix a most likely Java -> Kotlin conversion error in the weighteer implementation (#2428)
  • [Kotlin Runtime] calling cancel() on the connection closes it too early, keep the (#2426)
  • [Build] unbreak the generation of com.apollo.compiler.VERSION (#2424)
  • [Subscriptions] Allow calls to WebSocketSubscriptionTransport#send when not connected. (#2419)
  • [Compiler] Support empty graphql files (#2418)
  • [Coroutines-support] expose runtime/coroutines dependencies (#2415)

⚙️ Internal

  • [Runtime] deprecate the "builder" methods on ApolloCall and add them on the Builder instead (#2434)
  • [Build scripts] make the project compile with jdk13 (#2449)
  • [Tooling] 🛠️ Add tasks to check if the API is backward compatible (#2408)
  • [Compiler] Refactor package structure for GraphQL and SDL parsers (#2411)

❤️ External contributors

Many thanks to @BenSchwab, @jeffnyauke, @DSteve595, @Shevatro and @baconz for their awesome contributions!

Jul 2, 2020

Important

This release fixes an important performance issue with the multiplatform sql-normalized-cache-sqlite introduced in version 2.0.0. If you are using it, updating is strongly recommended. See #2412 for more details.

✨New

  • [Kotlin Runtime] subscriptions (#2356 and #2388)
  • [Plugin] ./gradlew downloadApolloSchema now resolves the schema path automatically if not specified (#2380)

👷‍♂️Fixes

  • [Normalized Cache] Run SqlNormalizedCache merge in transaction (#2412)
  • [Kotlin Runtime] make coroutines and OkHttp API dependencies (#2384)
  • [Compiler] fix marshaller is nullable (#2404)
  • [Plugin] check versions lazily (#2400)

⚙️ Internal

  • [Publishing] add ./gradlew publishToOssStagingIfNeeded (#2385)
  • [Compiler] work in progress on SDL support (#2398 and #2406)
Jun 22, 2020

Summary

This version is a maintainance release to add the STORE_PARTIAL_RESPONSES cache header. Version 2.1.0 changed the caching behaviour to not store partial response if there are errors. This is the expected behaviour in the large majority of cases but some use cases might rely on this old behaviour. If you are in this case, you can now opt-in the previous behaviour with STORE_PARTIAL_RESPONSES. See #2363 for more details.

New

  • [Cache] Add opt-in to cache responses with errors (#2363)

Bugfixes

  • [Multiplatform] do not escape the variables json (#2377)
  • [Compiler] Don't merge inline fragment with directives (conditions) (#2352)
  • [Subscriptions] make the error message if subscriptions are not configured more actionable (#2373)

Misc

  • The documentation now contains a tutorial and different "getting started" pages for Jav/Kotlin/Multiplatform
  • The artifacts hosted on JCenter are now signed with an apollographql GPG key (key ID 5A446C80C27E095353CF3969F165A96372E61948) instead of the default Bintray key before.
Jun 11, 2020

Summary

This version, amongst other things, contains RxJava3 support, a new way to register ApolloInterceptor with factories and makes it easier to download your schema.json from the command line. Starting with this version, releases are published on Maven Central in addition to Jcenter.

RxJava3 support (#2304)

Version 2.2.0 includes support for RxJava3. To use it, add the dependency to your Gradle file:

// RxJava3 support
implementation("com.apollographql.apollo:apollo-rx3-support:x.y.z")

The dependency contains static and extension methods to convert ApolloCall, ApolloSubscriptionCall, etc... to their RxJava3 counterparts.

For an exemple, to convert an ApolloCall to an Observable:

Java:

// Create a query object
EpisodeHeroName query = EpisodeHeroName.builder().episode(Episode.EMPIRE).build();

// Create an ApolloCall object
ApolloCall<EpisodeHeroName.Data> apolloCall = apolloClient.query(query);

// RxJava3 Observable
Observable<Response<EpisodeHeroName.Data>> observable3 = Rx3Apollo.from(apolloCall);

Kotlin:

// Create a query object
val query = EpisodeHeroNameQuery(episode = Episode.EMPIRE.toInput())

// Directly create Observable with Kotlin extension
val observable = apolloClient.rxQuery(query)

You can read more in the dedicated section of the documentation.

ApolloClient.applicationInterceptorFactories() (#2302)

ApolloInterceptors added with ApolloClient.applicationInterceptor() were only created once for the lifetime of the ApolloClient so the same interceptor was always disposed. If you need your interceptor to start with a new state for each call, you can use ApolloInterceptorFactory that will create a new interceptor for each new call.

Simplified downloadApolloSchema task usage from the command line (#2321)

Using the downloadApolloSchema task from the command line is now easier:

# Instead of using properties:
./gradlew downloadApolloSchema -Pcom.apollographql.apollo.endpoint=https://your.graphql.endpoint \
-Pcom.apollographql.apollo.schema=src/main/graphql/com/example/schema.json

# You can now use `--endpoint` and `--schema`:
./gradlew downloadApolloSchema --endpoint=https://your.graphql.endpoint --schema=app/src/main/graphql/com/example/schema.json

Fixes

  • Change constructor visibility for WebSocketSubscribtionTransport (#2348)
  • [Runtime] fix AbstractMethodError due to @JvmSynthetic (#2349)
  • Fix issue with query root level fragment support. (#2344)
  • Add check for missing selection set for object types. (#2344)
  • [Subscriptions] make a copy of the list to avoid ConcurrentModificationException (#2332)
  • [Gradle Plugin] Use relative strings for the rootFolder input property so as not to break cacheability (#2294)
  • [Build] release artifacts on maven central (#1130)

Internal changes

  • Provide base websocket abstraction (#2311)
  • [Kotlin Runtime] Add BearerTokenInterceptor (#2298)
  • [Tooling] enable checkstyle again (#2296)
  • Fix a small issue in sample (#2308)
Latest
v5.0.0-alpha.7
Tracking Since
Jun 11, 2020
Last checked Apr 20, 2026
Apollo Kotlin — Apollo GraphQL — releases.sh