Skip to content

v0.5.0

Compare
Choose a tag to compare
@jhump jhump released this 07 Mar 16:04
· 62 commits to main since this release
8495500

Release v0.5.0 includes numerous fixes so that connect-kotlin now passes many test cases in the Connect conformance suite that failed with the previous release. It also includes some clean-up of some of the APIs (and internal implementation) which are not backwards-compatible, but should only require minor changes to user code. See the "API Updates" section below for a list of all changed APIs.

What's Changed

API Improvements

These include some API changes which may require modification to user programs.

  • Some cleanup in the HTTP request representations by @jhump in #211
  • Denormalize "Code" and further simplification of HTTP interfaces by @jhump in #224
    • This is likely the greatest impact to user code. See the "API Updates" for com.connectrpc.Code and com.connectrpc.ResponseMessage below for more details.
  • Simplify UnaryBlockingCall by @jhump in #225

Enhancements

  • Client-only and server-only streaming RPCs can now be used with HTTP 1.1 connections (previously required HTTP/2) by @jhump in #196, #210
  • Support for auto-dispatching potentially blocking operations to I/O coroutine context by @jhump in #218

Bugfixes

  • Fixes to bugs in unary RPCs that were revealed by conformance tests by @jhump in #193
  • Fixes to bugs in stream RPCs that were revealed by conformance tests by @jhump in #210

Other changes

New Contributors

API Updates

com.connectrpc.BidirectionalStreamInterface

  • methods sendClose and receiveClose are now suspend methods

com.connectrpc.ClientOnlyStreamInterface

  • method sendClose is now a suspend method
  • adds new method: suspend fun cancel(), to cancel operation w/out completing it

com.connectrpc.ServerOnlyStreamInterface

  • method receiveClose is now a suspend method

com.connectrpc.Code

  • removes enum constant OK
    • An operation is now determined to be successful by lack of an exception, instead of having an OK code
  • method fromValue(Int?):Code changed to return nullable Code?; an input value of zero returns null

com.connectrpc.UnaryFunction

  • requestFunction now accepts a UnaryHTTPRequest instead of HTTPRequest

com.connectrpc.ResponseMessage

  • removed code property
    • Success concrete sub-type does not need a code: code is an error code and does not apply (was previously always OK)
    • Failure concrete sub-type now has only the code inside the cause: ConnectException property (the code property was redundant)
  • updated constructors for Success and Failure concrete sub-types to no longer accept code

com.connectrpc.StreamResult

  • changed cause property to be ConnectException? instead of Throwable?
    • calling code can use new com.connectrpc.asConnectException extension function to transform a Throwable into a ConnectException
  • removed code property
    • it was redundant with the code property of cause
  • update constructor to no longer accept code and to require ConnectException? for cause
  • fold is now an inline fun
  • maybeFold has been removed (trivial to accomplish the same thing with fold and nullable result type)

com.connectrpc.UnaryBlockingCall

  • now an interface, not a class
  • otherwise, same API except there is no constructor or factory function

com.connectrpc.http.HTTPClientInterface

  • method unary now accepts a UnaryHTTPRequest instead of HTTPRequest
  • method stream now accepts a duplex: Boolean parameter, indicating whether the operation needs to support full-duplex communication with the server (for bidirectional streams)

com.connectrpc.http.HTTPRequest

  • no longer has message or httpMethod properties
    • for stream operations, method was always "POST" and message was always null/not applicable
    • for unary operations, there is now a sub-class UnaryHTTPRequest which adds these two properties
  • constructor updated to no longer accept message or http method
  • clone method updated to no longer accept message or http method

com.connectrpc.http.HTTPResponse

  • added status: Int? property to indicate the numeric HTTP response code
  • removed code and tracingInfo properties
    • tracingInfo replaced by new status property
    • code is not needed; it is provided by code property of cause or inferred from new status property
  • constructor updated to accept status and no longer accept code and tracing info

com.connectrpc.http.Stream

  • now an interface, not a class
  • otherwise, same API except:
    • methods send, sendClose, and receiveClose are now suspend methods
    • isClosed method removed; use isReceiveClosed instead
  • there is also a Stream factory function with same signature as previous class constructor except that all three callbacks are now suspend functions

com.connectrpc.okhttp.ConnectOkHttpClient

  • updated to conform to changes to HTTPClientInterface

com.connectrpc.extensions.GoogleJavaJSONStrategy

  • added optional constructor parameter: registry: com.google.protobuf.TypeRegistry

com.connectrpc.extensions.GoogleJavaProtobufStrategy

  • added optional constructor parameter: registry: com.google.protobuf.ExtensionRegistryLite

com.connectrpc.extensions.GoogleJavaLiteProtobufStrategy

  • added optional constructor parameter: registry: com.google.protobuf.ExtensionRegistryLite

Full Changelog: v0.4.0...v0.5.0