Download Latest Version v4.3.1 source code.tar.gz (3.4 MB)
Email in envelope

Get an email when there's a new version of Apollo Kotlin

Home / v4.2.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2025-04-28 4.6 kB
v4.2.0 source code.tar.gz 2025-04-28 3.4 MB
v4.2.0 source code.zip 2025-04-28 9.1 MB
Totals: 3 Items   12.5 MB 0

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:

:::graphql
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:

:::graphql
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:

:::graphql
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 https://github.com/graphql/graphql-js/pull/4348 and https://github.com/graphql-java/graphql-java/pull/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)
Source: README.md, updated 2025-04-28