Skip to content

Commit 6b5a6be

Browse files
authored
Docs for next version (#6008)
* Update nullability.mdx * minor edits * minor edits * minor edits * update NetworkInterceptor doc * minor edits * add a section about package Name * Forgot to take that from the migration guide tweaks * update package name * add CHANGELOG * better ordering
1 parent cefc816 commit 6b5a6be

22 files changed

+331
-287
lines changed

CHANGELOG.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,51 @@
11
Change Log
22
==========
33

4+
# Version 4.0.0-rc.1
5+
6+
_2024-07-08_
7+
8+
## New package name & evolution policy
9+
10+
We changed the package name from `com.apollographql.apollo3` to `com.apollographql.apollo` for version 4. This is a safe default for the many years to come and works well with our new [evolution policy](https://www.apollographql.com/docs/kotlin/v4/essentials/evolution).
11+
12+
If you are updating from version 3 or an alpha/beta version 4, you need to replace all `com.apollographql.apollo3` with `com.apollographql.apollo`
13+
14+
## Apollo galaxy
15+
16+
As part of this release, some of the non-core artifacts have been moved to separate coordinates and GitHub repositories. Moving forward, this will allow us to iterate faster on those artifacts while keeping the core ones more maintainable.
17+
18+
Some of the existing symbols are kept as deprecated to ease the transition (like `MockServer` for an example). Others (the `-incubating` ones) have been removed, and you need to update them now.
19+
20+
You can read more in the [migration guide](https://go.apollo.dev/ak-moved-artifacts).
21+
22+
## All changes
23+
24+
* [BREAKING][all] Change package name to `com.apollographql.apollo`
25+
* [BREAKING][all] Remove incubating compose support (#5987)
26+
* [BREAKING][all] Remove apollo-cli (#5986)
27+
* [BREAKING][all] Remove incubating normalized cache (#5985)
28+
* [BREAKING][all] Nullability: Move nullability directives to v0.4 (#6002)
29+
* [BREAKING][all] Suffix ApolloStore write/publish overloads with `Sync` to avoid them taking precedence over their suspend counterparts (#5976)
30+
* [NEW][cache] SqlNormalizedCacheFactory make sqldriver public to support Sqlcipher data encryption. (#5973)
31+
* [NEW][runtime] Add ApolloClient.Builder.retryOnErrorInterceptor (#5989)
32+
* [adapters] Deprecate apollo-adapters (#6012)
33+
* [🐘gradle-plugin] Rename the multi-module configurations (#6027)
34+
* [IJ Plugin] Tweak cache name display for Apollo 3, 4, and incubating (#6026)
35+
* [compiler] remove unused argument to scalarAdapterInitializer() (#5996)
36+
* [java] Use published version of the Java support libs (#5991)
37+
* [runtime] Deprecate apollo engine ktor and publish engine tests (#5988)
38+
* [mpp-utils] Cleanup mpp utils (#5980)
39+
* [CI] use `gradle/actions/setup-gradle` instead of `gradle-build-action` (#5981)
40+
* [infra] Update to develocity API (#5967)
41+
* [incubating cache] Add a CacheKeyApolloResolver based on ApolloResolver (incubating) (#5970)
42+
* [mockserver] Robustify TCP server (#5968)
43+
* [runtime] adding checks for json end_document in http batching interceptors (#5893)
44+
* [IJ plugin] Cache ApolloKotlinService into project settings (#5962)
45+
* [IJ plugin] Avoid a ConcurrentModificationException occurring in conjunction to the IJ Platform Gradle plugin. (#5959)
46+
* [websockets] Send Sec-WebSocket-Protocol (#5948)
47+
* [mockserver] Deprecate com.apollographql.apollo3.mockserver.MockServer (#5943)
48+
449
# Version 4.0.0-beta.7
550

651
_2024-06-05_

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
[![Slack](https://img.shields.io/static/v1?label=kotlinlang&message=apollo-kotlin&color=15a2f5&logo=slack)](https://app.slack.com/client/T09229ZC6/C01A6KM1SBZ)
77
[![Discord](https://img.shields.io/discord/1022972389463687228.svg?color=7389D8&labelColor=6A7EC2&logo=discord&logoColor=ffffff&style=flat-square)](https://discord.com/invite/graphos)
88
[![CI](https://img.shields.io/github/actions/workflow/status/apollographql/apollo-kotlin/push.yml?branch=main)](https://github.com/apollographql/apollo-kotlin/actions/workflows/push.yml?query=branch%3Amain)
9-
[![Maven Central](https://img.shields.io/maven-central/v/com.apollographql.apollo3/apollo-api)](https://repo1.maven.org/maven2/com/apollographql/apollo3/)
10-
[![Gradle Plugin](https://img.shields.io/gradle-plugin-portal/v/com.apollographql.apollo3)](https://plugins.gradle.org/plugin/com.apollographql.apollo3)
11-
[![OSS Snapshots](https://img.shields.io/nexus/s/com.apollographql.apollo3/apollo-api?server=https%3A%2F%2Fs01.oss.sonatype.org&label=oss-snapshots)](https://s01.oss.sonatype.org/content/repositories/snapshots/com/apollographql/apollo3/)
9+
[![Maven Central](https://img.shields.io/maven-central/v/com.apollographql.apollo/apollo-api)](https://repo1.maven.org/maven2/com/apollographql/apollo/)
10+
[![Gradle Plugin](https://img.shields.io/gradle-plugin-portal/v/com.apollographql.apollo)](https://plugins.gradle.org/plugin/com.apollographql.apollo)
11+
[![OSS Snapshots](https://img.shields.io/nexus/s/com.apollographql.apollo/apollo-api?server=https%3A%2F%2Fs01.oss.sonatype.org&label=oss-snapshots)](https://s01.oss.sonatype.org/content/repositories/snapshots/com/apollographql/apollo/)
1212
[![Revved up by Develocity](https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.apollographql.com/scans)
1313

1414
| ☑️ Apollo Clients User Survey |
@@ -88,15 +88,15 @@ Add the plugin to your `build.gradle.kts`:
8888

8989
```kotlin
9090
plugins {
91-
id("com.apollographql.apollo3") version "4.0.0-rc.1"
91+
id("com.apollographql.apollo") version "4.0.0-rc.1"
9292
}
9393
```
9494

9595
Add the runtime dependency:
9696

9797
```kotlin
9898
dependencies {
99-
implementation("com.apollographql.apollo3:apollo-runtime:4.0.0-rc.1")
99+
implementation("com.apollographql.apollo:apollo-runtime:4.0.0-rc.1")
100100
}
101101
```
102102

@@ -179,29 +179,29 @@ Installation instructions and more information can be found [here](https://githu
179179

180180
## Releases
181181

182-
The latest version is [![Maven Central](https://img.shields.io/maven-central/v/com.apollographql.apollo3/apollo-api)](https://repo1.maven.org/maven2/com/apollographql/apollo3/)
182+
The latest version is [![Maven Central](https://img.shields.io/maven-central/v/com.apollographql.apollo/apollo-api)](https://repo1.maven.org/maven2/com/apollographql/apollo/)
183183

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

186-
Releases are hosted on [Maven Central](https://repo1.maven.org/maven2/com/apollographql/apollo3/). The plugin is additionally hosted on the [Gradle Plugin Portal](https://plugins.gradle.org/plugin/com.apollographql.apollo3)
186+
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)
187187

188188
```kotlin
189189
plugins {
190-
id("com.apollographql.apollo3") version "4.0.0-rc.1"
190+
id("com.apollographql.apollo") version "4.0.0-rc.1"
191191
}
192192

193193
repositories {
194194
mavenCentral()
195195
}
196196

197197
dependencies {
198-
implementation("com.apollographql.apollo3:apollo-runtime:4.0.0-rc.1")
198+
implementation("com.apollographql.apollo:apollo-runtime:4.0.0-rc.1")
199199

200200
// Optional: if you want to use the normalized cache
201-
implementation("com.apollographql.apollo3:apollo-normalized-cache-sqlite:4.0.0-rc.1")
201+
implementation("com.apollographql.apollo:apollo-normalized-cache-sqlite:4.0.0-rc.1")
202202
// Optional: if you just want the generated models and parsers and write your own HTTP code/cache code, you can remove apollo-runtime
203203
// and use apollo-api instead
204-
implementation("com.apollographql.apollo3:apollo-api:4.0.0-rc.1")
204+
implementation("com.apollographql.apollo:apollo-api:4.0.0-rc.1")
205205
}
206206
```
207207

docs/source/advanced/apollo-ast.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Add the `apollo-ast` dependency to your project:
2121
dependencies {
2222
// ...
2323

24-
implementation("com.apollographql.apollo3:apollo-ast:4.0.0-rc.1")
24+
implementation("com.apollographql.apollo:apollo-ast:4.0.0-rc.1")
2525
}
2626
```
2727

docs/source/advanced/compiler-plugins.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ plugins {
3333

3434
dependencies {
3535
// Add apollo-compiler as a dependency
36-
implementation("com.apollographql.apollo3:apollo-compiler:4.0.0-rc.1")
36+
implementation("com.apollographql.apollo:apollo-compiler:4.0.0-rc.1")
3737
}
3838
```
3939

@@ -42,10 +42,10 @@ Next create your plugin in a `src/main/kotlin/mypackage/MyPlugin` file:
4242
```kotlin
4343
package mypackage
4444

45-
import com.apollographql.apollo3.compiler.OperationOutputGenerator
46-
import com.apollographql.apollo3.compiler.ApolloCompilerPlugin
47-
import com.apollographql.apollo3.compiler.operationoutput.OperationDescriptor
48-
import com.apollographql.apollo3.compiler.operationoutput.OperationId
45+
import com.apollographql.apollo.compiler.OperationOutputGenerator
46+
import com.apollographql.apollo.compiler.ApolloCompilerPlugin
47+
import com.apollographql.apollo.compiler.operationoutput.OperationDescriptor
48+
import com.apollographql.apollo.compiler.operationoutput.OperationId
4949

5050
class MyPlugin: ApolloCompilerPlugin {
5151
override fun operationIds(descriptors: List<OperationDescriptor>): List<OperationId> {
@@ -72,15 +72,15 @@ class MyPluginProvider: ApolloCompilerPluginProvider {
7272
}
7373
```
7474

75-
Make your plugin discoverable by [ServiceLoader](https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html) by adding a resource in `src/main/resources/META-INF/services/com.apollographql.apollo3.compiler.ApolloCompilerPluginProvider`. This file contains the fully qualified name of your plugin:
75+
Make your plugin discoverable by [ServiceLoader](https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html) by adding a resource in `src/main/resources/META-INF/services/com.apollographql.apollo.compiler.ApolloCompilerPluginProvider`. This file contains the fully qualified name of your plugin:
7676

7777
```
7878
mypackage.MyPluginProvider
7979
```
8080

8181
<Note>
8282

83-
The name of the resource file is important. It must be `com.apollographql.apollo3.compiler.ApolloCompilerPluginProvider` and be in the `META-INF/services` folder. This is how `ServiceLoader` looks up plugins at runtime.
83+
The name of the resource file is important. It must be `com.apollographql.apollo.compiler.ApolloCompilerPluginProvider` and be in the `META-INF/services` folder. This is how `ServiceLoader` looks up plugins at runtime.
8484
</Note>
8585

8686
## Adding a plugin to the Apollo compiler classpath
@@ -91,7 +91,7 @@ Use the `Service.plugin()` Gradle method to add the plugin to the Apollo compile
9191
// app/build.gradle.kts
9292
plugins {
9393
id("org.jetbrains.kotlin.jvm")
94-
id("com.apollographql.apollo3")
94+
id("com.apollographql.apollo")
9595
}
9696

9797
apollo {
@@ -146,6 +146,6 @@ Because codegen is run in a separate classloader when using compiler plugins, it
146146

147147
## Other references
148148

149-
For other plugin APIs like layout, IR, JavaPoet and KotlinPoet transforms, check out the [ApolloCompilerPlugin API docs](https://www.apollographql.com/docs/kotlin/kdoc/apollo-compiler/com.apollographql.apollo3.compiler/-apollo-compiler-plugin/index.html)
149+
For other plugin APIs like layout, IR, JavaPoet and KotlinPoet transforms, check out the [ApolloCompilerPlugin API docs](https://www.apollographql.com/docs/kotlin/kdoc/apollo-compiler/com.apollographql.apollo.compiler/-apollo-compiler-plugin/index.html)
150150

151151
For more examples, check out the [integration-tests](https://github.com/apollographql/apollo-kotlin/tree/main/tests/compiler-plugins).

docs/source/advanced/experimental-websockets.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Historically, WebSockets have been one of the most complex and error-prone parts
1515
3. Because WebSockets are long-lived connections, they are more exposed to errors and knowing when (or if) to retry is hard.
1616
4. Not all subscriptions happen on WebSockets. Some use [HTTP multipart](https://www.apollographql.com/docs/router/executing-operations/subscription-multipart-protocol/) for an example.
1717

18-
Starting with 4.0.0, Apollo Kotlin provides a new `com.apollographql.apollo3.network.websocket` package containing new `WebSocketNetworkTransport` and `WebSocketEngine` implementations (instead of `com.apollographql.apollo3.network.ws` for the current implementations).
18+
Starting with 4.0.0, Apollo Kotlin provides a new `com.apollographql.apollo.network.websocket` package containing new `WebSocketNetworkTransport` and `WebSocketEngine` implementations (instead of `com.apollographql.apollo.network.ws` for the current implementations).
1919

20-
The `com.apollographql.apollo3.network.websocket` implementation provides the following:
20+
The `com.apollographql.apollo.network.websocket` implementation provides the following:
2121

2222
1. Defaults to the [graphql-ws](https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md) protocol, which has become the de facto standard. Using the other protocols is still possible but having a main, specified, protocol ensures we can write a good and solid test suite.
2323
2. Does not inherit from the old memory model design, making the code considerably simpler. In particular, `WebSocketEngine` is now event based and no attempt at flow control is done. If you buffers grow too much, your subscription fails.
@@ -34,17 +34,17 @@ After a feedback phase, the current `.ws` APIs will become deprecated and the `.
3434

3535
## Migration guide
3636

37-
In simple cases where you did not configure the underlying `WsProtocol` or retry logic, the migration should be about replacing `com.apollographql.apollo3.network.ws` with `com.apollographql.apollo3.network.websocket` everywhere:
37+
In simple cases where you did not configure the underlying `WsProtocol` or retry logic, the migration should be about replacing `com.apollographql.apollo.network.ws` with `com.apollographql.apollo.network.websocket` everywhere:
3838

3939
```kotlin
4040
// Replace
41-
import com.apollographql.apollo3.network.ws.WebSocketNetworkTransport
42-
import com.apollographql.apollo3.network.ws.WebSocketEngine
41+
import com.apollographql.apollo.network.ws.WebSocketNetworkTransport
42+
import com.apollographql.apollo.network.ws.WebSocketEngine
4343
// etc...
4444

4545
// With
46-
import com.apollographql.apollo3.network.websocket.WebSocketNetworkTransport
47-
import com.apollographql.apollo3.network.websocket.WebSocketEngine
46+
import com.apollographql.apollo.network.websocket.WebSocketNetworkTransport
47+
import com.apollographql.apollo.network.websocket.WebSocketEngine
4848
// etc...
4949
```
5050

@@ -60,7 +60,7 @@ val apolloClient = ApolloClient.Builder()
6060
.build()
6161

6262
// With
63-
import com.apollographql.apollo3.network.websocket.*
63+
import com.apollographql.apollo.network.websocket.*
6464

6565
// [...]
6666

docs/source/advanced/http-engine.mdx

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,11 @@ By default, Apollo Kotlin uses the following HTTP clients for different platform
1010
| JavaScript/Wasm | [fetch()](https://developer.mozilla.org/en-US/docs/Web/API/fetch) / [Node Fetch](https://www.npmjs.com/package/node-fetch) for HTTP, [Ktor](https://ktor.io/) for WebSockets |
1111
| iOS/MacOS | [NSURLSesssion](https://developer.apple.com/documentation/foundation/nsurlsession) |
1212

13-
14-
## Ktor engine
15-
16-
Additionally, an optional implementation based on [Ktor](https://ktor.io/) for all targets is available in the `apollo-engine-ktor` module. To use it, add the following dependency to your project:
17-
18-
```kotlin title="build.gradle[.kts]"
19-
dependencies {
20-
// ...
21-
implementation("com.apollographql.apollo3:apollo-engine-ktor:4.0.0-rc.1")
22-
}
23-
```
24-
25-
And configure your `ApolloClient` to use the Ktor engine:
26-
27-
```kotlin
28-
val client = ApolloClient.Builder()
29-
.serverUrl("https://example.com/graphql")
30-
// Create a new Ktor engine
31-
.httpEngine(KtorHttpEngine())
32-
// Or, if you want to reuse an existing Ktor client
33-
.ktorClient(myKtorClient)
34-
.build()
35-
```
36-
3713
## Implement your own HTTP engine
3814

3915
You can use a different HTTP client with Apollo Kotlin by creating a custom class that implements the `HttpEngine` interface.
4016

41-
The [HttpEngine interface](https://apollographql.github.io/apollo-kotlin/kdoc/apollo-runtime/com.apollographql.apollo3.network.http/-http-engine/index.html)
17+
The [HttpEngine interface](https://apollographql.github.io/apollo-kotlin/kdoc/apollo-runtime/com.apollographql.apollo.network.http/-http-engine/index.html)
4218
defines two functions: `execute` and `close`. Here's an example implementation that also includes a couple of helper
4319
methods:
4420

@@ -89,7 +65,7 @@ This example uses an asynchronous `wrappedClient` that runs the network request
8965

9066
### Using your `HttpEngine`
9167

92-
After you create your `HttpEngine` implementation, you can register it with your [`ApolloClient`](https://apollographql.github.io/apollo-kotlin/kdoc/apollo-runtime/com.apollographql.apollo3/-apollo-client/index.html) instance using [`ApolloClient.Builder.httpEngine`](https://apollographql.github.io/apollo-kotlin/kdoc/apollo-runtime/com.apollographql.apollo3/-apollo-client/-builder/http-engine.html):
68+
After you create your `HttpEngine` implementation, you can register it with your [`ApolloClient`](https://apollographql.github.io/apollo-kotlin/kdoc/apollo-runtime/com.apollographql.apollo/-apollo-client/index.html) instance using [`ApolloClient.Builder.httpEngine`](https://apollographql.github.io/apollo-kotlin/kdoc/apollo-runtime/com.apollographql.apollo/-apollo-client/-builder/http-engine.html):
9369

9470
```kotlin
9571
// Use your HttpEngine
@@ -101,6 +77,11 @@ val client = ApolloClient.Builder()
10177

10278
With this configuration, Apollo Kotlin sends all of its GraphQL operation requests with `MyHttpEngine`.
10379

80+
81+
## Ktor engine
82+
83+
An implementation of `HttpEngine` based on [Ktor](https://ktor.io/) is available in [apollographql/apollo-kotlin-ktor-support](https://github.com/apollographql/apollo-kotlin-ktor-support)
84+
10485
## Other HTTP customizations
10586

10687
Besides implementing `HttpEngine`, Apollo Kotlin also supports other methods for customizing HTTP behavior:

docs/source/advanced/multi-modules.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ apollo {
7676

7777
<ExperimentalFeature>
7878

79-
The `bidirectional` parameter is experimental because it may break <a href="https://docs.gradle.org/current/userguide/build_environment.html">Gradle project isolation</a>. For a project-isolation compatible method, try <a href="https://www.apollographql.com/docs/kotlin/kdoc/apollo-gradle-plugin-external/com.apollographql.apollo3.gradle.api/-service/is-a-dependency-of.html">isADependencyOf</a>
79+
The `bidirectional` parameter is experimental because it may break <a href="https://docs.gradle.org/current/userguide/build_environment.html">Gradle project isolation</a>. For a project-isolation compatible method, try <a href="https://www.apollographql.com/docs/kotlin/kdoc/apollo-gradle-plugin-external/com.apollographql.apollo.gradle.api/-service/is-a-dependency-of.html">isADependencyOf</a>
8080

8181
</ExperimentalFeature>
8282

docs/source/advanced/network-connectivity.mdx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Android and Apple targets provide APIs to monitor the network state of your devi
1313
- [ConnectivityManager](https://developer.android.com/training/monitoring-device-state/) on Android targets.
1414
- [NWPathMonitor](https://developer.apple.com/documentation/network/nwpathmonitor) on Apple targets.
1515

16-
You can configure your [ApolloClient](https://www.apollographql.com/docs/kotlin/kdoc/apollo-runtime/com.apollographql.apollo3/-apollo-client/index.html) to use these APIs to improve latency of your requests using the `NetworkMonitor` API:
16+
You can configure your [ApolloClient](https://www.apollographql.com/docs/kotlin/kdoc/apollo-runtime/com.apollographql.apollo/-apollo-client/index.html) to use these APIs to improve latency of your requests using the `NetworkMonitor` API:
1717

1818
```kotlin
1919
// androidMain
@@ -25,7 +25,7 @@ val networkMonitor = NetworkMonitor()
2525
// commonMain
2626
val apolloClient = ApolloClient.Builder()
2727
.serverUrl("https://example.com/graphql")
28-
.networkMonitor(networkMonitor)
28+
.retryOnErrorInterceptor(RetryOnErrorInterceptor(networkMonitor))
2929
.build()
3030
```
3131

@@ -54,10 +54,7 @@ When a `NetworkMonitor` is configured, `retryOnError` uses `NetworkMonitor.waitF
5454

5555
### Customizing the retry algorithm
5656

57-
You can customize the retry algorithm further by defining you won interceptor. Make sure to:
58-
59-
- add your interceptor last, so that it wraps the network call and doesn't get cache misses or any other errors that may be emitted by upstream interceptors.
60-
- call `retryOnError(false)` when forwarding the request downstream so that the retry is not made twice.
57+
You can customize the retry algorithm further by defining you own interceptor:
6158

6259
```kotlin
6360
internal class MyRetryInterceptor(private val networkMonitor: NetworkMonitor?): ApolloInterceptor {

0 commit comments

Comments
 (0)