Skip to content

1.2.0

Latest

Choose a tag to compare

@skydoves skydoves released this 16 Sep 12:49
a01c840

Breaking changes

  • minSdk is now 23, required by Paging 3.5.1. compileSdk and targetSdk are now 37, required by okhttp-android 5.5.0.
  • retrofit-adapters-result no longer exposes retrofit-adapters-serialization transitively. If you use deserializeHttpError, add the converter artifact you actually use.
  • onFailureSuspendAsError now takes a deserialize lambda as its first parameter, so it works with any json library:
    result.onFailureSuspendAsError({ it.deserializeHttpError<ErrorMessage>() }) { errorModel ->
      // handle the error model
    }
  • ResultCallAdapterFactory.create() and EitherCallAdapterFactory.create() gained a second parameter, which changes their synthetic default-argument signature. Recompile against 1.2.0 rather than dropping the artifact into an existing build.

Fixes

  • retrofit-adapters-paging was broken in minified release builds. R8 renamed the private Retrofit call argument array the adapter reflects on, and shrank the @PagingKeyConfig mapper classes away entirely, so paging worked in debug and crashed in release. The module now ships consumer R8 rules, locates the argument array by type, and reads parameter annotations with java reflection, which also drops the kotlin-reflect dependency.
  • EitherDeferredCallAdapter ran the request inside runBlocking, so the returned Deferred was already completed and the caller blocked on the network, and a transport failure escaped the adapter instead of completing as a Left.
  • CancellationException was swallowed by runCatchingSuspend, both enqueue implementations, and NetworkPagingSource.load. Cancelled coroutines kept running, and a cancelled page load surfaced as a Paging error state.
  • execute() now encapsulates transport failures the way enqueue() already did.
  • deserializeHttpError ignores unknown keys, returns null rather than throwing on a malformed payload, and no longer consumes the error body on first read.
  • Restored ABI validation for the two Android library modules, which lost their apiCheck tasks when AGP 9 replaced the kotlin-android plugin.

New

  • retrofit-adapters-moshi and retrofit-adapters-gson, alongside the existing retrofit-adapters-serialization, so you only pull in the json library you already use.
  • retrofit-adapters-core with Throwable.httpErrorBody() and NullBodyException.
  • retrofit-adapters-paging-compiler, a KSP processor that validates @PagingKeyConfig and @PagingKey at compile time and generates a reflection free mapper registry:
    ksp("com.github.skydoves:retrofit-adapters-paging-compiler:1.2.0")
    It reports a missing annotation, a non Int paging key, a non suspend method, a keySize of zero or less, and a mapper that does not implement PagingMapper, cannot be instantiated, or whose type arguments do not match the returned NetworkPagingSource.
  • Either.onLeftSuspendAsError, matching Result.onFailureSuspendAsError.
  • nullBodyAsFailure on both adapter factories, reporting an unexpected null body as a failure instead of a successful null.

What's Changed

  • Update dependencies to the latest versions by @skydoves in #39
  • Harden the call adapters and make error deserialization pluggable by @skydoves in #40
  • Prepare for release 1.2.0 by @skydoves in #41

Full Changelog: 1.1.0...1.2.0