github apollographql/apollo-kotlin v3.2.1

latest releases: v4.1.0, v4.0.1, v4.0.0...
2 years ago

This release introduces a few improvements and bug fixes.

✨️ [new] ApolloCall<D>.emitCacheMisses(Boolean) (#3980)

When observing the cache with watch, the behavior was to not emit cache misses at all, which may not desirable in certain cases. With this new option, you can now choose to emit them: in that case responses will be emitted with a null data.

This can be used like so:

apolloClient.query(query)
  .fetchPolicy(FetchPolicy.CacheOnly)
  .emitCacheMisses(true)
  .watch()
  .collect { response ->
    // response.data will be null in case of cache misses
  }

This is also closer to the behavior that was in place in v2. Many thanks to @mateuszkwiecinski for the insights and raising the issue!

⚙️ [breaking] Allow configuration of frame types used in SubscriptionWsProtocol and default to Text (#3992)

When using subscriptions over WebSockets with SubscriptionWsProtocol (the default), the frames were sent in the binary format. It was reported that this was not compatible with certain servers (DGS, graphql-java-kickstart) that are expecting text frames. This is now fixed and the default is to send text frames.

⚠️ This may be a breaking change if your server expects binary frames only!
If that is the case, you can use the new frameType option to configure the frame type to be sent:

client = ApolloClient.Builder()
  .webSocketServerUrl("wss://...")
  .wsProtocol(GraphQLWsProtocol.Factory(frameType = WsFrameType.Binary))
  .build()

Many thanks to @Krillsson and @aviewfromspace1 for the insights and raising the issue!

👷‍ All changes

  • Allow configuration of frame types used in SubscriptionWsProtocol and default to Text (#3992)
  • add ApolloRequest.newBuilder(operation: Operation<E>) (#3988)
  • Add exception handlers to ApolloCacheInterceptor and SqlNormalizedCache (#3989)
  • 📠 Fix some @DeprecatedSince annotations (#3983)
  • 👓 add ApolloCall.emitCacheMisses(Boolean) (#3980)
  • ⚙️ Fix fragments on the root query type in operationBased codegen (#3973)

❤️ External contributors

Many thanks to @AdamMTGreenberg and @Krillsson for the contributions! 🙏

Don't miss a new apollo-kotlin release

NewReleases is sending notifications on new releases.