github apollographql/apollo-kotlin v3.0.0-beta05

latest releases: v4.0.0, v4.0.0-rc.2, v3.8.5...
2 years ago

We intended this version to be the first release candidate but we found a few bugs justifying a new beta instead. Many thanks to @CoreFloDev, @olivierg13, @rohandhruva, @adavis and @sproctor for identifying the bugs and sending feedback, this helps a ton ๐Ÿ™ ๐Ÿ’™ .
Next one should be release candidate ๐Ÿคž ๐Ÿš€

๐Ÿชฒ Bug fixes

  • Fix a crash when using Auto Persisted Queries on iOS (#3637)
  • Fix a crash that could happen when saving an object to the cache after some types of schema changes (#3636)
  • Escape reserved enum value names ("name" and "ordinal") (#3629)
  • Do not crash when trying to send to a closed websocket (#3638)

๐Ÿ–‹๏ธ Better escaping for Kotlin codegen

The escaping of Kotlin keywords used in field names now uses Kotlin's backtick escaping (`keyword`) convention instead of suffixing an underscore (keyword_). This could impact the generated code in your projects if a schema contains such fields. (#3630)

โš™๏ธ [breaking] API changes

Before going stable, the public API has been tweaked to ensure consistency.

Uniformize Upload creation (#3613)

Creating an Upload used to be possible by calling Upload.fromXyz() methods and now has been changed to use a Builder API which is more consistent with the rest of the API:

// Before
val upload = Upload.fromSource(okioSource)
// or if you're on the JVM
val upload = Upload.fromFile(file)

// After
val upload = DefaultUpload.Builder()
    .content(bufferedSource)
    // or if you're on the JVM
    .content(file)
    .build()

Simplify Automatic Persisted Queries configuration (#3622)

The method to enable or disable Automatic Persisted Queries on a specific call has been renamed to a more meaningful name:

// Before
val response = apolloClient.query(HeroNameQuery())
    .hashedQuery(false)
    .execute()

// After
val response = apolloClient.query(HeroNameQuery())
    .enableAutoPersistedQueries(false)
    .execute()

Remove temporarily deprecated methods (#3632)

During the course of the alpha and beta, a number of APIs have been evolving, and to allow a smooth transition by early adopters, some early APIs have been marked as deprecated in favor of new ones.

Now that we are soon reaching a stable API, it is time to remove these early APIs.

This means if you were using 3.0.0-beta04 or earlier you may want to first review the deprecation warnings and update your code to use the newer APIs, before upgrading to this version.

Other changes

  • Should you need to create an ApolloResponse, you can now do so by using a Builder API (#3608)
  • Ast, Compiler and MockServer modules have been marked as experimental to reflect the fact that they haven't been widely used as of now and therefore their APIs could evolve in the future (#3614)
  • Some overloads were removed in APIs related to JSON parsing/writing to simplify these APIs. Now all of these APIs take an Okio BufferedSource as input. (#3620)
  • The actual implementations of HttpEngine (OkHttpEngine, NSURLSessionHttpEngine, and KtorHttpEngine) have all been renamed to DefaultHttpEngine for consistency (#3617)

โ˜•๏ธ Java Interop improvements

  • The built-in adapters are now usable in a more Java-friendly way (#3607):
// Before
String result = StringAdapter.INSTANCE.fromJson(jsonReader,CustomScalarAdapters.Empty);

// After
String result = Adapters.StringAdapter.fromJson(jsonReader,CustomScalarAdapters.Empty);
  • Correctly declare throwing IOException in Adapter APIs, making it possible to catch it in Java code (#3603)

๐Ÿ‘ท All Changes

  • Do not crash when trying to send to a closed websocket (#3638)
  • URLEncode more characters for NSURL to not crash (#3637)
  • Fix collecting fields on new schema types (#3636)
  • Remove temporarily deprecated methods (#3632)
  • Differentiate escaping of Java or Kotlin keywords (#3630)
  • Escape reserved enum value names ("name" and "ordinal") (#3629)
  • Move the HTTP cache to a HttpInterceptor (#3624)
  • Simplify APQ configuration (#3622)
  • Cleanup overloads (#3620)
  • ๐Ÿ™… No constructor fun (#3617)
  • Mark Ast, Compiler and MockServer modules as experimental (#3614)
  • Uniformize Upload creation (#3613)
  • ๐Ÿงผ ๐Ÿชฃ Polishing of the ApolloResponse API (#3608)
  • Make builtin scalar adapters easier to call from Java (#3607)
  • Fix CustomTypeAdapter compat (#3604)
  • Use kotlin.Throws (#3603)

Don't miss a new apollo-kotlin release

NewReleases is sending notifications on new releases.