Skip to content

Commit

Permalink
chore: release v0.18.0 (#1092)
Browse files Browse the repository at this point in the history
* chore: release v0.18.0

* add PR link in the release

* link to latest in README

* fix rust example

* Update CHANGELOG.md

* Update CHANGELOG.md

* update changelog
  • Loading branch information
niklasad1 committed Apr 24, 2023
1 parent e58e021 commit 1f8c8c5
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 10 deletions.
73 changes: 73 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,79 @@ The format is based on [Keep a Changelog].

[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/

## [v0.18.0] - 2023-04-21

This is a breaking release that removes the `CallError` which was used to represent a JSON-RPC error object that
could happen during JSON-RPC method call and one could assign application specific error code, message and data in a
specific implementation.

Previously jsonrpsee provided `CallError` that could be converted to/from `jsonrpsee::core::Error`
and in some scenarios the error code was automatically assigned by jsonrpsee. After jsonrpsee
added support for custom error types the `CallError` doesn't provide any benefit because one has to implement `Into<ErrorObjectOwned>`
on the error type anyway.

Thus, `jsonrpsee::core::Error` can't be used in the proc macro API anymore and the type alias
`RpcResult` has been modified to `Result<(), ErrorObjectOwned>` instead.

Before it was possible to do:

```rust
#[derive(thiserror::Error)]
enum Error {
A,
B,
}

#[rpc(server, client)]
pub trait Rpc
{
#[method(name = "getKeys")]
async fn keys(&self) -> Result<String, jsonrpsee::core::Error> {
Err(jsonrpsee::core::Error::to_call_error(Error::A))
// or jsonrpsee::core::Error::Call(CallError::Custom(ErrorObject::owned(1, "a", None::<()>)))
}
}
```

After this change one has to do:

```rust
pub enum Error {
A,
B,
}

impl From<Error> for ErrorObjectOwned {
fn from(e: Error) -> Self {
match e {
Error::A => ErrorObject::owned(1, "a", None::<()>),
Error::B => ErrorObject::owned(2, "b", None::<()>),
}
}
}

#[rpc(server, client)]
pub trait Rpc {
// Use a custom error type that implements `Into<ErrorObject>`
#[method(name = "custom_err_ty")]
async fn custom_err_type(&self) -> Result<String, Error> {
Err(Error::A)
}

// Use `ErrorObject` as error type directly.
#[method(name = "err_obj")]
async fn error_obj(&self) -> RpcResult<String> {
Err(ErrorObjectOwned::owned(1, "c", None::<()>))
}
}
```

### [Changed]
- remove `CallError` ([#1087](https://github.com/paritytech/jsonrpsee/pull/1087))

### [Fixed]
- fix(proc macros): support parsing params !Result ([#1094](https://github.com/paritytech/jsonrpsee/pull/1094))

## [v0.17.1] - 2023-04-21

This release fixes HTTP graceful shutdown for the server.
Expand Down
18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ resolver = "2"

[workspace.package]
authors = ["Parity Technologies <admin@parity.io>", "Pierre Krieger <pierre.krieger1708@gmail.com>"]
version = "0.17.1"
version = "0.18.0"
edition = "2021"
rust-version = "1.64.0"
license = "MIT"
Expand All @@ -30,11 +30,11 @@ keywords = ["jsonrpc", "json", "http", "websocket", "WASM"]
readme = "README.md"

[workspace.dependencies]
jsonrpsee-types = { path = "types", version = "0.17.1" }
jsonrpsee-core = { path = "core", version = "0.17.1" }
jsonrpsee-server = { path = "server", version = "0.17.1" }
jsonrpsee-ws-client = { path = "client/ws-client", version = "0.17.1" }
jsonrpsee-http-client = { path = "client/http-client", version = "0.17.1" }
jsonrpsee-wasm-client = { path = "client/wasm-client", version = "0.17.1" }
jsonrpsee-client-transport = { path = "client/transport", version = "0.17.1" }
jsonrpsee-proc-macros = { path = "proc-macros", version = "0.17.1" }
jsonrpsee-types = { path = "types", version = "0.18.0" }
jsonrpsee-core = { path = "core", version = "0.18.0" }
jsonrpsee-server = { path = "server", version = "0.18.0" }
jsonrpsee-ws-client = { path = "client/ws-client", version = "0.18.0" }
jsonrpsee-http-client = { path = "client/http-client", version = "0.18.0" }
jsonrpsee-wasm-client = { path = "client/wasm-client", version = "0.18.0" }
jsonrpsee-client-transport = { path = "client/transport", version = "0.18.0" }
jsonrpsee-proc-macros = { path = "proc-macros", version = "0.18.0" }
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
![MIT](https://img.shields.io/crates/l/jsonrpsee.svg)
[![CI](https://github.com/paritytech/jsonrpsee/actions/workflows/ci.yml/badge.svg)](https://github.com/paritytech/jsonrpsee/actions/workflows/ci.yml)
[![Benchmarks](https://github.com/paritytech/jsonrpsee/actions/workflows/benchmarks.yml/badge.svg)](https://github.com/paritytech/jsonrpsee/actions/workflows/benchmarks.yml)
[![dependency status](https://deps.rs/crate/jsonrpsee/0.17.1/status.svg)](https://deps.rs/crate/jsonrpsee/0.17.1)
[![dependency status](https://deps.rs/crate/jsonrpsee/0.18.0/status.svg)](https://deps.rs/crate/jsonrpsee/0.18.0)

JSON-RPC library designed for async/await in Rust.

Expand Down

0 comments on commit 1f8c8c5

Please sign in to comment.