Skip to content

v4.2.0

Latest
Compare
Choose a tag to compare
@BoD BoD released this 28 Apr 14:29
· 6 commits to release-4.x since this release
439f2e8

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)