Compatibility release for Kotlin 2.4.0-Beta1
Full Changelog: https://github.com/apollographql/apollo-kotlin/compare/v5.0.0-alpha.6...v5.0.0-alpha.7
Compatibility release for Kotlin 2.4.0-Beta1. This release contains only a single change:
This version is probably one of the last alpha before going -rc.
@ignore (https://github.com/apollographql/apollo-kotlin/pull/6900)org.gradle.category attribute and use reverse DNS naming to avoid name clashes (https://github.com/apollographql/apollo-kotlin/pull/6886)@oneOf input objects. (https://github.com/apollographql/apollo-kotlin/pull/6894)compileSdk version to 35 for better compatibility (https://github.com/apollographql/apollo-kotlin/pull/6899, https://github.com/apollographql/apollo-kotlin/pull/6902)Many thanks to @eboudrant for the contributions in this release 💙
Maintenance release that adds a new KMP target and makes it easier to work with the new cache and AGP9.
This version also bumps KGP to 2.2. This is transparent for Android/JVM consumers but requires native/JS/wasm consumers to use KGP 2.2 to compile against 4.4.2.
New developments happen in the 5.0 alphas.
5.0.0-alpha.5 is "golden-path" ready ✨! It supports the latest GraphQL experimental features:
It also bumps KGP version to 2.3.10. This has no impact for JVM/Android consumers but requires Native/JS/Wasm consumers to compile with Kotlin 2.3.
Many thanks to @abeggsnf for the contributions in this release!
onError (#6860)This version has a single fix for a regression in the Gradle plugin:
./gradlew download${Service}ApolloSchemaFromIntrospection was crashing due to a bad class relocation (https://github.com/apollographql/apollo-kotlin/issues/6863)Many thanks @MatthewFolbigg, @scana, and @simonlebras for their contributions to this release!
ApolloCall.extensions() in https://github.com/apollographql/apollo-kotlin/pull/6834Purpose and Import definitions in https://github.com/apollographql/apollo-kotlin/pull/68384.4.0 adds compatibility with AGP9 as well as a few other fixes.
Most of the development is now made in the 5.x alphas.
@catch support for responseBased codegen (#6698)ApolloInterceptor.InsertionPoint to control where the interceptors are added (#6767)@stream supportYou 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.
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.
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.
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")
}
@catch support for responseBased codegen by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6697Service.issueSeverity() by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6731@defer and @stream as of incremental/v0.2 by @BoD in https://github.com/apollographql/apollo-kotlin/pull/6331ApolloRequest.Builder.url(String) by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6758ApolloInterceptor.InsertionPoint to control where the interceptors are added by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6761RetryStrategy by @martinbonnin in https://github.com/apollographql/apollo-kotlin/pull/6764Optional.Absent a data object by @JakeWharton in https://github.com/apollographql/apollo-kotlin/pull/6686if/else to avoid Int boxing by @JakeWharton in https://github.com/apollographql/apollo-kotlin/pull/6688@defer documentation by @calvincestari in https://github.com/apollographql/apollo-kotlin/pull/6751In this new alpha of v5, here are the main highlights:
generateApolloEnums option to generate enums as a sealed hierarchy distinguishing known and unknown valuesYour feedback is greatly appreciated as you try the new version!
To migrate your project, please read the migration guide (work in progress).
Service.generateApolloEnums to generate enums with a __Known interface (#6611)fetch (#6674)Many thanks to @pedromfmachado, @jvanderwee, @aryapreetam and @francescocervone for the contributions and help in this release 💜
This is maintenance release that includes a few fixes.
Many thanks to @francescocervone for the Gradle plugin fix 💜
Maintainance release to fix the Accept: header during introspection. Many thanks @pedromfmachado for diving into this!
This release also contains infrastructure work:
Full Changelog: https://github.com/apollographql/apollo-kotlin/compare/v4.3.1...v4.3.2
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.
Infrastructure:
Gradle
Compiler:
Runtime:
ApolloCall.ignoreUnknownKeys and ApolloClient.Builder.ignoreUnknownKeys (#6473)AST:
Execution
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.
Many thanks to @calvincestari for the client awareness contribution 💜
Maintenance release with a fix for using persisted queries together with subscriptions #6283
Full Changelog: https://github.com/apollographql/apollo-kotlin/compare/v3.8.5...v3.8.6
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.
Many thanks to @gnehz972 and @mengdd for their fixes about HTTP batching 💜
@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)
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.
@disableErrorPropagationApollo 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
Many thanks to @bobbysothebys, @jvanderwee, @dhritzkiv, @lwasyl and @rohandhruva for all the contributions and help in this release 💜
@link' quickfix (#6402)HttpInterceptor.intercept() to throw Throwable (#6403)@DataBuilderDsl (#6484)withBuiltInDefinitions() and add flag to dump scalar definitions in SDL (#6389)@link handling (#6417)@disableErrorPropagation (#6414)@map and @mapTo (#6404)@SuppressWarnings("unchecked") (#6434)@RequiresOptIn annotation in the Gradle plugin (#6406)@ApolloInternal in public ABI (#6407)@ApolloExperimental symbols in public API (#6416)The artifacts are now compiled with Kotlin 2.1.0. This change should be transparent for JVM and Android users thanks to languageVersion but requires klib consumers (native + JS) to update their KGP version to 2.1.0.
The IntelliJ plugin now has a dedicated mode for backend developers that uses Rover LSP (Language Server Protocol) to parse federation and connectors directives. This mode is only available when using IntelliJ Ultimate and other IDEs with LSP support. It is recommended for subgraphs authors.
This release supports Gradle isolated projects for shorter configuration times.
Many thanks to @jvanderwee, @varahash, @whyoleg, @StylianosGakis and @scana for all the contributions and help in this release !
onSchema() once in multi-module scenrios (#6252)@link schema extensions (#6284)Version 4.1.0 updates usages of Ktor from 2.3.11 to 3.0.0:
apollo-runtime-js or apollo-debug-server-jvm, you need to update your app to Ktor 3.0.0+ at the same time as updating to Apollo 4.1.0 (apollo-debug-server-android is unaffected).apollo-mockserver or apollo-ktor-support from this repo, you need to update to the new coordinates.All other cases are unaffected. In particular, apollo-runtime on Android and iOS uses OkHttp and NsUrlConnection respectively and is not impacted by the Ktor update.
You can read more details in the pull request.
application/graphql-response+jsonapplication/graphql-response+json is a new media type being introduced by the GraphQL over HTTP draft. It allows differentiating a valid GraphQL response from an error JSON response that could be transmitted by a cache or proxy in the HTTP chain.
If your server uses application/graphql-response+json and returns non-2xx response, Apollo Kotlin will now parse those responses and expose data and errors instead of returning an ApolloHttpException before.
The IntelliJ plugin is now compatible with K2 (#6150)
apollo-mockserver and apollo-ktor-supportapollo-mockserver is now at com.apollographql.mockserver:apollo-mockserver:0.1.0 and developed at https://github.com/apollographql/apollo-kotlin-mockserverapollo-ktor-support is now at com.apollographql.ktor:apollo-engine-ktor:0.1.0 and developed at https://github.com/apollographql/apollo-kotlin-ktor-support/apollo-mockserver and apollo-ktor-support (#6215)