Skip to content

Releases: apollographql/apollo-kotlin

v5.0.0-alpha.3

13 Nov 17:33
5ce88bc

Choose a tag to compare

@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

v5.0.0-alpha.2

21 Aug 15:31
@BoD BoD
08f33f4

Choose a tag to compare

In this new alpha of v5, here are the main highlights:

  • WasmJs target added to GraphQL subscriptions
  • Experimental generateApolloEnums option to generate enums as a sealed hierarchy distinguishing known and unknown values
  • and a handful of bug fixes and improvements.

Your feedback is greatly appreciated as you try the new version!

To migrate your project, please read the migration guide (work in progress).

👷‍♂️ All changes

  • [new] Add GraphQL subscriptions support for wasmJs target (#6637)
  • [new] Introduce Service.generateApolloEnums to generate enums with a __Known interface (#6611)
  • [new] Add generateApolloProjectIdeModel task (#6666)
  • [new] Introduce Service.pluginsArguments and relax the check for multiple plugins (#6622)
  • [fix] Added default Accept header to introspection query (#6616)
  • [fix] Fix error reporting on invalid documents (#6642)5
  • [fix] [Execution] Fix coercing variable values (#6644)
  • [fix] Normalize the order of arguments of checked definitions (#6650)
  • [fix] Make sure that the introspection endpoint property value is checked at execution time (#6657)
  • [fix] Use the more lenient dependencies API (#6667)
  • [fix] Do not silently discard network exceptions (#6669)
  • [upgrade] Use built-in Node fetch (#6674)

💜 Contributors

Many thanks to @pedromfmachado, @jvanderwee, @aryapreetam and @francescocervone for the contributions and help in this release 💜

v4.3.3

21 Aug 13:54
@BoD BoD
48175b9

Choose a tag to compare

This is maintenance release that includes a few fixes.

👷‍♂️ All changes

  • [fix] Normalize the order of arguments of checked definitions (#6651)
  • [fix] Make sure that the introspection endpoint property value is checked at execution time (#6658)
  • [fix] Do not silently discard network exceptions (#6671)

💜 Contributors

Many thanks to @francescocervone for the Gradle plugin fix 💜

v4.3.2

25 Jul 10:11
0c1b7dd

Choose a tag to compare

Maintainance release to fix the Accept: header during introspection. Many thanks @pedromfmachado for diving into this!

This release also contains infrastructure work:

What's Changed

Full Changelog: v4.3.1...v4.3.2

v5.0.0-alpha.1

30 Jun 09:51
fdeff5b

Choose a tag to compare

Small release to fix a publishing discrepency in the versions. Thanks @ychescale9 for the heads up!

  • [fix] Fix can't resolve apollo-gradle-plugin-tasks (#6603)
  • [new] Warn on unused fragments (#6601)

v5.0.0-alpha.0

30 Jun 07:20
052bf34

Choose a tag to compare

Version 5.0.0-alpha.0

This is the first alpha release of version 5

The package name stayed the same. Version 5 is aiming to be binary compatibile with version 4 with a few exceptions (read more in the migration guide).

Version 5.0 also includes new GraphQL features (default value coercion, schema coordinates), improves data builders and compiler plugin APIs amongst other things.

Read more

Changes

Infrastructure:

  • [breaking] Remove ApolloIdlingResource (#6492)
  • [breaking] Remove PackageNameGenerator and OperationOutputGenerator, replaced by compiler plugins (#6494)
  • [breaking] Move internal testing code to an unpublished module (#6449)
  • [breaking] Update deprecations for v5 (#6496)
  • [upgrade] Bump ktor to 3.1.2 (#6465)
  • [new] Move IJ plugin to its own repository (#6574)
  • [new] Switch publication to the central portal (#6581)

Gradle

  • [fix] Do not generate the version as const (#6563)
  • [new] Switch the gradle plugin to gratatouille (#6524)
  • [fix] Remove checkApolloVersion (#6569)
  • [new] Introspection: add a hint that more details are available in the exception cause. (#6590)

Compiler:

  • [new] Add schema-transform API (#6450)
  • [new] Allow to generate Data Builders outside the main source set (#6485)
  • [breaking] Using @nonnull is now an error (#6499)
  • [fix] Ignore scalars/enums in checkCapitalizedFields (#6502)
  • [fix] Call DocumentTransform.transform after adding required fields (#6510)
  • [fix] Add key fields to selections even when they're already selected with an alias (#6503)
  • [fix] Transform the GraphQL documents before running validation (#6511)
  • [new] Add key fields of possible types of interfaces and fragments (#6515)
  • [new] Allow to register multiple Apollo Compiler plugins (#6523)

Runtime:

  • [new] Add cacheInterceptor() and autoPersistedQueriesInterceptor() (#6455)
  • [new] Add ApolloCall.ignoreUnknownKeys and ApolloClient.Builder.ignoreUnknownKeys (#6473)
  • [fix] fix the batch size not respected issue (#6528)
  • [fix] Fix losing response headers when using batch request (#6538)

AST:

  • [new] Add allowAddingDirectivesToExistingFieldDefinitions (#6470)
  • [new] Implement schema coordinates (#6560)

Execution

  • [fix] Implement defaultValues coercion (#6440)
  • [new] Add JsonCoercing (#6471)

v4.3.1

18 Jun 12:46
@BoD BoD
f3c9d1c

Choose a tag to compare

This is maintenance release that fixes an issue with Gradle task dependencies when using connectToAndroidSourceSet().

This release also introduces an Enhanced Client Awareness feature that adds the version of the library to requests in the extensions object. This is useful for server-side analytics and debugging. This is enabled by default, and can be disabled by calling sendEnhancedClientAwareness(false) on your ApolloClient.Builder.

💜 Contributors

Many thanks to @calvincestari for the client awareness contribution 💜

👷‍♂️ All changes

  • Backport IJ plugin changes from main (#6559)
  • simplify task wiring and fix propagating task dependencies when using connectToAndroidSourceSet() (#6564)
  • feature: Enhanced Client Awareness (#6567)

v3.8.6

12 Jun 14:21

Choose a tag to compare

Maintenance release with a fix for using persisted queries together with subscriptions #6283

Full Changelog: v3.8.5...v3.8.6

4.3.0

05 Jun 12:54
4c4b92c

Choose a tag to compare

Version 4.3.0

Version 4.3.0 allows adding multiple compiler plugins and stabilizes ApolloCompilerPlugin.beforeCompilationStep() as the main entry point for compiler plugins. You can read more in the compiler plugins documentation page.

This allows to move some cache-specific code generation logic to the new normalized cache repo and better separate concerns.

Moving forward, ApolloCompilerPlugin.beforeCompilationStep() and ApolloCompilerRegistry.registerOperationIdsGenerator() are considered stable because they play an important part in setting up persisted queries. Other APIs are considered more advanced and will most likely stay unstable for the foreseeable future.

Contributors 💜

Many thanks to @gnehz972 and @mengdd for their fixes about HTTP batching 💜

👷‍♂️ All changes

  • Fix losing response headers when using batch request (#6538)
  • fix the batch size not respected issue (#6528)
  • prepare compiler plugins for 4.3 (#6549)
  • Allow to register multiple compiler plugins (#6546)
  • Add key fields to selections even when they're already selected with an alias (#6503) (#6544)
  • Ignore scalars/enums in checkCapitalizedFields (#6502) (#6543)
  • Call DocumentTransform.transform after processing (#6510) (#6512)

v4.2.0

28 Apr 14:29
@BoD BoD
439f2e8

Choose a tag to compare

Generate custom scalars as inline classes with @map and @mapTo (#6404)

It is now possible to configure the adapters to use with scalars by using the @map directive:

extend schema @link(url: "https://specs.apollo.dev/kotlin_labs/v0.5/", import: ["@mapTo", "@map"])

extend scalar Date @map(to: "kotlinx.datetime.Instant", with: "com.apollographql.adapters.InstantAdapter")

If the to parameter is an inline value class, use the inlineProperty parameter to have the generated code box/unbox the value. In that case, with needs to point to an adapter of the underlying type:

extend scalar Timestamp @map(to: "com.example.Timestamp", with: "com.apollographql.apollo.api.LongAdapter", inlineProperty: "ts")

For the common cases where the scalar can be represented as a built-in Kotlin type (String, Boolean, Int, Long, Float, Double), you can use @mapTo and the compiler infers the adapter and generates an inline value class automatically:

extend scalar Length @mapTo(builtIn: Long)

Scalar definitions in schemas downloaded from introspection (#6389)

Downloading or converting an SDL schema from introspection now includes scalar definitions.
This is required for clients to get a full view of the schema.

Support for @disableErrorPropagation

Apollo Kotlin now automatically adds @disableErrorPropagation if your server supports it and you opted in @catchByDefault in your schema extensions. This allows to use non-null types more liberally and still get support for partial data.

See graphql/graphql-js#4348 and graphql-java/graphql-java#3772

Contributors 💜

Many thanks to @bobbysothebys, @jvanderwee, @dhritzkiv, @lwasyl and @rohandhruva for all the contributions and help in this release 💜

👷‍♂️ All changes

  • [intellij-plugin] Fix MemoryCache package name (#6383)
  • [intellij-plugin] Rover: always pass path to supergraph.yaml if present (#6384)
  • [intellij-plugin] Make 'Download Schema action' consider deep subprojects (#6394)
  • [intellij-plugin] Fix a crash when invoking the 'missing @link' quickfix (#6402)
  • [intellij-plugin] Use configured Gradle JVM when executing tasks (#6425)
  • [intellij-plugin] Fix pulling normalized cache for recent AS (#6437)
  • [intellij-plugin] Use a coroutines to prevent an IllegalStateException (#6460, #6487)
  • [intellij-plugin] Use coroutines in ApolloCodegenService (#6477, #6487)
  • [intellij-plugin]Use incubating cache 0.0.8 and show errors in cache viewer (#6439)
  • [runtime] Use ephemeral NSURLSessionConfiguration by default (#6376)
  • [runtime] Add toString() method to ApolloResponse (#6409)
  • [runtime] Better error messages for ApolloClient.Builder() (#6424)
  • [runtime] Add Swift interceptor iOS test and allow HttpInterceptor.intercept() to throw Throwable (#6403)
  • [runtime] Add cacheInterceptor() and autoPersistedQueriesInterceptor() (#6456)
  • [runtime] Revert behaviour change (#6482)
  • [runtime] Introduce @DataBuilderDsl (#6484)
  • [ast] Simplify semanticEquals (#6388)
  • [ast] Remove withBuiltInDefinitions() and add flag to dump scalar definitions in SDL (#6389)
  • [ast] Refactor schema validation (#6396)
  • [ast] Better @link handling (#6417)
  • [ast] Add support for @disableErrorPropagation (#6414)
  • [compiler] Add @map and @mapTo (#6404)
  • [compiler] Inline classes, fix using inline classes in input positions (#6427)
  • [compiler] Java Codegen: add some @SuppressWarnings("unchecked") (#6434)
  • [gradle-plugin] Make logLevel property internal to not take it into account when caching (#6399)
  • [gradle-plugin] expose regular configurations for multi-module projects (#6408)
  • [gradle-plugin] Keep the @RequiresOptIn annotation in the Gradle plugin (#6406)
  • [gradle-plugin] Remove possible eager task creation (#6442)
  • [infra] Track @ApolloInternal in public ABI (#6407)
  • [infra] Track @ApolloExperimental symbols in public API (#6416)
  • [infra] Cache: add a 'large list' benchmark (#6432)
  • [infra] Remove a bunch of warnings (#6441)
  • [all] Bump Kotlin to 2.1.10 (#6370)
  • [all] Bump Kotlin to 2.1.20 (#6431)