Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,107 @@ Change Log

# Next version

# Version 5.0.0-alpha.3
_2025-11-13_

### `@stream` support

You may now use [`@stream`](https://github.com/graphql/graphql-wg/blob/main/rfcs/DeferStream.md#stream) to stream list responses from a compatible server.

To do this, opt in support for the [incremental:v0.2 protocol](https://specs.apollo.dev/incremental/v0.2/):

```kotlin
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.

### WebSockets

The [experimental WebSockets](https://github.com/apollographql/apollo-kotlin/issues/5862) are promoted to stable. In particular, the [request url](https://github.com/apollographql/apollo-kotlin/pull/6758) may now be changed in interceptors. This can be used together with [RetryStrategy](https://github.com/apollographql/apollo-kotlin/pull/6764) 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](https://www.apollographql.com/docs/kotlin/v5/migration/5.0).

### HTTP cache

You can now use OkHttp [cacheUrlOverride()](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-request/-builder/cache-url-override.html) to cache POST requests.

To do so, [configure a cache on your OkHttpClient](https://square.github.io/okhttp/features/caching/) and use `enablePostCaching`:

```kotlin
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](https://www.apollographql.com/docs/kotlin/v5/migration/5.0).

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

```kotlin
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

* NEW: Promote experimental websockets to stable by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6774
* NEW: Add `@catch` support for responseBased codegen by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6697
* NEW: Support descriptions on variable definitions by @BoD in https://github.com/apollographql/apollo-kotlin/pull/6699
* NEW: Support Android Gradle Plugin 9 (AGP9) by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6703
* NEW: Add `Service.issueSeverity()` by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6731
* NEW: Add HTTP caching using OkHttp cacheUrlOverride by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6739
* NEW: Implement `@defer` and `@stream` as of `incremental/v0.2` by @BoD in https://github.com/apollographql/apollo-kotlin/pull/6331
* NEW: Add `ApolloRequest.Builder.url(String)` by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6758
* NEW: Add a specific issue type for fragment cycles by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6759
* NEW: Add `ApolloInterceptor.InsertionPoint` to control where the interceptors are added by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6761
* NEW: Introduce `RetryStrategy` by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6764
* FIX: Make `Optional.Absent` a `data object` by @JakeWharton in https://github.com/apollographql/apollo-kotlin/pull/6686
* FIX: Use regular `if`/`else` to avoid `Int` boxing by @JakeWharton in https://github.com/apollographql/apollo-kotlin/pull/6688
* FIX: Remove kotlin-node dependency by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6708
* FIX: Do not check already checked fragments in checkCapitalizedFields by @BoD in https://github.com/apollographql/apollo-kotlin/pull/6718
* FIX: Pretty-print operation manifest by @BoD in https://github.com/apollographql/apollo-kotlin/pull/6720
* FIX: Allow empty deprecationReasons by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6729
* FIX: Fix IndexOutOfBoundsException in keyFields validation by @BoD in https://github.com/apollographql/apollo-kotlin/pull/6748
* FIX: Allow multiple success responses in ApolloCall.execute() by @BoD in https://github.com/apollographql/apollo-kotlin/pull/6772
* FIX: Restore JsonReader state if a field throws in-flight by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6775
* FIX: Exclude auto-imported cache related directives when the Apollo cache plugin is present by @BoD in https://github.com/apollographql/apollo-kotlin/pull/6766
* FIX: fix a timeout leak in the default HttpEngine by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6762
* DOCS: add linuxX64 as supported for apollo-runtime by @hrach in https://github.com/apollographql/apollo-kotlin/pull/6689
* DOCS: Update `@defer` documentation by @calvincestari in https://github.com/apollographql/apollo-kotlin/pull/6751
* UPDATE: Bump KGP to 2.2.20 by @BoD in https://github.com/apollographql/apollo-kotlin/pull/6716

# Version 5.0.0-alpha.2
_2025-08-21_

Expand Down
2 changes: 1 addition & 1 deletion docs/source/advanced/apollo-ast.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Add the `apollo-ast` dependency to your project:
dependencies {
// ...

implementation("com.apollographql.apollo:apollo-ast:5.0.0-alpha.2")
implementation("com.apollographql.apollo:apollo-ast:5.0.0-alpha.3")
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/source/advanced/compiler-plugins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ plugins {

dependencies {
// Add apollo-compiler as a compileOnly dependency
compileOnly("com.apollographql.apollo:apollo-compiler:5.0.0-alpha.2")
compileOnly("com.apollographql.apollo:apollo-compiler:5.0.0-alpha.3")
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/source/advanced/no-runtime.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Using the models without apollo-runtime
For this, remove the `com.apollographql.apollo:apollo-runtime` dependency and replace it with:

```kotlin title="build.gradle"
implementation("com.apollographql.apollo:apollo-api:5.0.0-alpha.2")
implementation("com.apollographql.apollo:apollo-api:5.0.0-alpha.3")
```

## Composing an HTTP request body
Expand Down
4 changes: 2 additions & 2 deletions docs/source/caching/normalized-cache.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Apollo Kotlin's `MemoryCache` is a normalized, in-memory cache for storing objec

```kotlin title="build.gradle[.kts]"
dependencies {
implementation("com.apollographql.apollo:apollo-normalized-cache:5.0.0-alpha.2")
implementation("com.apollographql.apollo:apollo-normalized-cache:5.0.0-alpha.3")
}
```

Expand Down Expand Up @@ -110,7 +110,7 @@ To enable SQLite cache support, add the `apollo-normalized-cache-sqlite` depende

```kotlin title="build.gradle.kts"
dependencies {
implementation("com.apollographql.apollo:apollo-normalized-cache-sqlite:5.0.0-alpha.2")
implementation("com.apollographql.apollo:apollo-normalized-cache-sqlite:5.0.0-alpha.3")
}
```

Expand Down
14 changes: 7 additions & 7 deletions docs/source/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ Add the plugin to your `build.gradle.kts`:

```kotlin
plugins {
id("com.apollographql.apollo") version "5.0.0-alpha.2"
id("com.apollographql.apollo") version "5.0.0-alpha.3"
}
```

Add the runtime dependency:

```kotlin
dependencies {
implementation("com.apollographql.apollo:apollo-runtime:5.0.0-alpha.2")
implementation("com.apollographql.apollo:apollo-runtime:5.0.0-alpha.3")
}
```

Expand Down Expand Up @@ -165,29 +165,29 @@ Installation instructions and more information can be found [here](/kotlin/testi

## Releases

The latest version is `5.0.0-alpha.2`.
The latest version is `5.0.0-alpha.3`.

Check the [changelog](https://github.com/apollographql/apollo-kotlin/releases) for the release history.

Releases are hosted on [Maven Central](https://repo1.maven.org/maven2/com/apollographql/apollo/). The plugin is additionally hosted on the [Gradle Plugin Portal](https://plugins.gradle.org/plugin/com.apollographql.apollo)

```kotlin
plugins {
id("com.apollographql.apollo") version "5.0.0-alpha.2"
id("com.apollographql.apollo") version "5.0.0-alpha.3"
}

repositories {
mavenCentral()
}

dependencies {
implementation("com.apollographql.apollo:apollo-runtime:5.0.0-alpha.2")
implementation("com.apollographql.apollo:apollo-runtime:5.0.0-alpha.3")

// Optional: if you want to use the normalized cache
implementation("com.apollographql.apollo:apollo-normalized-cache-sqlite:5.0.0-alpha.2")
implementation("com.apollographql.apollo:apollo-normalized-cache-sqlite:5.0.0-alpha.3")
// Optional: if you just want the generated models and parsers and write your own HTTP code/cache code, you can remove apollo-runtime
// and use apollo-api instead
implementation("com.apollographql.apollo:apollo-api:5.0.0-alpha.2")
implementation("com.apollographql.apollo:apollo-api:5.0.0-alpha.3")
}
```

Expand Down
4 changes: 2 additions & 2 deletions docs/source/migration/5.0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ val apolloClient = ApolloClient.Builder()
.httpEngine(
DefaultHttpEngine {
OkHttpClient.Builder()
// Make sure to use a different directory for your cache
.cache(directory = "http_cache2", maxSize = 10_000_000)
// Make sure to use a different directory for your cache as the format changed
.cache(directory = File(application.cacheDir, "http_cache2"), maxSize = 10_000_000)
.build()
}
)
Expand Down
2 changes: 1 addition & 1 deletion docs/source/testing/apollo-debug-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies {
// ...

// For security, add the dependency to your debug builds only
debugImplementation("com.apollographql.apollo:apollo-debug-server:5.0.0-alpha.2")
debugImplementation("com.apollographql.apollo:apollo-debug-server:5.0.0-alpha.3")
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/source/testing/mocking-graphql-responses.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Add the dependency to your project's `build.gradle` file:

```kotlin title="build.gradle[.kts]"
dependencies {
testImplementation("com.apollographql.apollo:apollo-testing-support:5.0.0-alpha.2")
testImplementation("com.apollographql.apollo:apollo-testing-support:5.0.0-alpha.3")
}
```

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=5.0.0-alpha.3-SNAPSHOT
VERSION_NAME=5.0.0-alpha.4-SNAPSHOT

android.useAndroidX=true

Expand Down Expand Up @@ -26,4 +26,4 @@ kotlin.internal.collectFUSMetrics=false
ksp.version.check=false

# See https://youtrack.jetbrains.com/issue/KT-81708
kotlin.incremental.native=false
kotlin.incremental.native=false
2 changes: 1 addition & 1 deletion gradle/libraries.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android-sdkversion-benchmark-min = "24"
android-sdkversion-target = "30"
androidx-sqlite = "2.6.0"
# This is used by the Gradle integration tests to get the artifacts locally
apollo = "5.0.0-alpha.3-SNAPSHOT"
apollo = "5.0.0-alpha.4-SNAPSHOT"
apollo-execution = "0.1.1"
apollo-normalizedcache-incubating = "1.0.0-alpha.6"
# Used by the apollo-tooling project which uses a published version of Apollo
Expand Down
2 changes: 1 addition & 1 deletion tests/integration-tests/testFixtures/allPlanets.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"operationName":"AllPlanets","variables":{},"query":"query AllPlanets { allPlanets(first: 300) { planets { __typename ...PlanetFragment filmConnection { totalCount films { __typename title ...FilmFragment } } } } } fragment PlanetFragment on Planet { name climates surfaceWater } fragment FilmFragment on Film { title producers }","extensions":{"clientLibrary":{"name":"apollo-kotlin","version":"5.0.0-alpha.3-SNAPSHOT"}}}
{"operationName":"AllPlanets","variables":{},"query":"query AllPlanets { allPlanets(first: 300) { planets { __typename ...PlanetFragment filmConnection { totalCount films { __typename title ...FilmFragment } } } } } fragment PlanetFragment on Planet { name climates surfaceWater } fragment FilmFragment on Film { title producers }","extensions":{"clientLibrary":{"name":"apollo-kotlin","version":"5.0.0-alpha.4-SNAPSHOT"}}}
Loading