Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add object as subscription params #623

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 0 additions & 7 deletions .gitlab-ci.yml
Expand Up @@ -56,13 +56,6 @@ test-linux-stable:
<<: *only
<<: *test_and_build

test-windows-stable:
stage: test
<<: *test_and_build
<<: *only
tags:
- rust-windows

test-mac-stable:
stage: test
<<: *test_and_build
Expand Down
4 changes: 2 additions & 2 deletions core-client/Cargo.toml
Expand Up @@ -8,7 +8,7 @@ keywords = ["jsonrpc", "json-rpc", "json", "rpc", "serde"]
license = "MIT"
name = "jsonrpc-core-client"
repository = "https://github.com/paritytech/jsonrpc"
version = "17.0.0"
version = "17.1.0"

categories = [
"asynchronous",
Expand All @@ -26,7 +26,7 @@ ipc = ["jsonrpc-client-transports/ipc"]
arbitrary_precision = ["jsonrpc-client-transports/arbitrary_precision"]

[dependencies]
jsonrpc-client-transports = { version = "17.0", path = "./transports", default-features = false }
jsonrpc-client-transports = { version = "17.1", path = "./transports", default-features = false }
futures = { version = "0.3", features = [ "compat" ] }

[badges]
Expand Down
12 changes: 6 additions & 6 deletions core-client/transports/Cargo.toml
Expand Up @@ -8,7 +8,7 @@ keywords = ["jsonrpc", "json-rpc", "json", "rpc", "serde"]
license = "MIT"
name = "jsonrpc-client-transports"
repository = "https://github.com/paritytech/jsonrpc"
version = "17.0.0"
version = "17.1.0"

categories = [
"asynchronous",
Expand Down Expand Up @@ -37,24 +37,24 @@ arbitrary_precision = ["serde_json/arbitrary_precision", "jsonrpc-core/arbitrary
[dependencies]
derive_more = "0.99"
futures = "0.3"
jsonrpc-core = { version = "17.0", path = "../../core" }
jsonrpc-pubsub = { version = "17.0", path = "../../pubsub" }
jsonrpc-core = { version = "17.1", path = "../../core" }
jsonrpc-pubsub = { version = "17.1", path = "../../pubsub" }
log = "0.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
url = "1.7"

hyper = { version = "0.13", optional = true }
hyper-tls = { version = "0.4", optional = true }
jsonrpc-server-utils = { version = "17.0", path = "../../server-utils", optional = true }
jsonrpc-server-utils = { version = "17.1", path = "../../server-utils", optional = true }
parity-tokio-ipc = { version = "0.8", optional = true }
tokio = { version = "0.2", optional = true }
websocket = { version = "0.24", optional = true }

[dev-dependencies]
assert_matches = "1.1"
jsonrpc-http-server = { version = "17.0", path = "../../http" }
jsonrpc-ipc-server = { version = "17.0", path = "../../ipc" }
jsonrpc-http-server = { version = "17.1", path = "../../http" }
jsonrpc-ipc-server = { version = "17.1", path = "../../ipc" }
lazy_static = "1.0"
env_logger = "0.7"

Expand Down
6 changes: 4 additions & 2 deletions core-client/transports/src/lib.rs
Expand Up @@ -301,9 +301,10 @@ impl TypedClient {
let params = match args {
Value::Array(vec) => Params::Array(vec),
Value::Null => Params::None,
Value::Object(map) => Params::Map(map),
_ => {
return Err(RpcError::Client(
"RPC params should serialize to a JSON array, or null".into(),
"RPC params should serialize to a JSON array, object or null".into(),
))
}
};
Expand All @@ -326,9 +327,10 @@ impl TypedClient {
let params = match args {
Value::Array(vec) => Params::Array(vec),
Value::Null => Params::None,
Value::Object(map) => Params::Map(map),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add this to fn notify?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do it tomorrow!

_ => {
return Err(RpcError::Client(
"RPC params should serialize to a JSON array, or null".into(),
"RPC params should serialize to a JSON array, object or null".into(),
))
}
};
Expand Down
2 changes: 1 addition & 1 deletion core-client/transports/src/transports/http.rs
Expand Up @@ -273,7 +273,7 @@ mod tests {

if let Err(RpcError::Other(err)) = res {
if let Some(err) = err.downcast_ref::<hyper::Error>() {
assert!(err.is_connect(), format!("Expected Connection Error, got {:?}", err))
assert!(err.is_connect(), "Expected Connection Error, got {:?}", err)
} else {
panic!("Expected a hyper::Error")
}
Expand Down
2 changes: 1 addition & 1 deletion core/Cargo.toml
Expand Up @@ -8,7 +8,7 @@ keywords = ["jsonrpc", "json-rpc", "json", "rpc", "serde"]
license = "MIT"
name = "jsonrpc-core"
repository = "https://github.com/paritytech/jsonrpc"
version = "17.0.0"
version = "17.1.0"

categories = [
"asynchronous",
Expand Down
10 changes: 5 additions & 5 deletions derive/Cargo.toml
Expand Up @@ -7,7 +7,7 @@ homepage = "https://github.com/paritytech/jsonrpc"
license = "MIT"
name = "jsonrpc-derive"
repository = "https://github.com/paritytech/jsonrpc"
version = "17.0.0"
version = "17.1.0"

[lib]
proc-macro = true
Expand All @@ -20,10 +20,10 @@ proc-macro-crate = "0.1.4"

[dev-dependencies]
assert_matches = "1.3"
jsonrpc-core = { version = "17.0", path = "../core" }
jsonrpc-core-client = { version = "17.0", path = "../core-client" }
jsonrpc-pubsub = { version = "17.0", path = "../pubsub" }
jsonrpc-tcp-server = { version = "17.0", path = "../tcp" }
jsonrpc-core = { version = "17.1", path = "../core" }
jsonrpc-core-client = { version = "17.1", path = "../core-client" }
jsonrpc-pubsub = { version = "17.1", path = "../pubsub" }
jsonrpc-tcp-server = { version = "17.1", path = "../tcp" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
trybuild = "1.0"
3 changes: 1 addition & 2 deletions derive/tests/ui/attr-invalid-meta-list-names.stderr
@@ -1,8 +1,7 @@
error: Invalid attribute parameter(s): 'Xalias'. Expected 'alias'
--> $DIR/attr-invalid-meta-list-names.rs:5:2
|
5 | /// Returns a protocol version
| _____^
5 | / /// Returns a protocol version
6 | | #[rpc(name = "protocolVersion", Xalias("alias"))]
7 | | fn protocol_version(&self) -> Result<String>;
| |_________________________________________________^
3 changes: 1 addition & 2 deletions derive/tests/ui/attr-invalid-meta-words.stderr
@@ -1,8 +1,7 @@
error: Invalid attribute parameter(s): 'Xmeta'. Expected 'meta, raw_params'
--> $DIR/attr-invalid-meta-words.rs:5:2
|
5 | /// Returns a protocol version
| _____^
5 | / /// Returns a protocol version
6 | | #[rpc(name = "protocolVersion", Xmeta)]
7 | | fn protocol_version(&self) -> Result<String>;
| |_________________________________________________^
3 changes: 1 addition & 2 deletions derive/tests/ui/attr-invalid-name-values.stderr
@@ -1,8 +1,7 @@
error: Invalid attribute parameter(s): 'Xname'. Expected 'name, returns, params'
--> $DIR/attr-invalid-name-values.rs:5:2
|
5 | /// Returns a protocol version
| _____^
5 | / /// Returns a protocol version
6 | | #[rpc(Xname = "protocolVersion")]
7 | | fn protocol_version(&self) -> Result<String>;
| |_________________________________________________^
3 changes: 1 addition & 2 deletions derive/tests/ui/attr-missing-rpc-name.stderr
@@ -1,8 +1,7 @@
error: rpc attribute should have a name e.g. `name = "method_name"`
--> $DIR/attr-missing-rpc-name.rs:5:2
|
5 | /// Returns a protocol version
| _____^
5 | / /// Returns a protocol version
6 | | #[rpc]
7 | | fn protocol_version(&self) -> Result<String>;
| |_________________________________________________^
3 changes: 1 addition & 2 deletions derive/tests/ui/multiple-rpc-attributes.stderr
@@ -1,8 +1,7 @@
error: Expected only a single rpc attribute per method
--> $DIR/multiple-rpc-attributes.rs:5:2
|
5 | /// Returns a protocol version
| _____^
5 | / /// Returns a protocol version
6 | | #[rpc(name = "protocolVersion")]
7 | | #[rpc(name = "protocolVersionAgain")]
8 | | fn protocol_version(&self) -> Result<String>;
Expand Down
3 changes: 1 addition & 2 deletions derive/tests/ui/too-many-params.stderr
@@ -1,8 +1,7 @@
error: Maximum supported number of params is 16
--> $DIR/too-many-params.rs:5:2
|
5 | /// Has too many params
| _____^
5 | / /// Has too many params
6 | | #[rpc(name = "tooManyParams")]
7 | | fn to_many_params(
8 | | &self,
Expand Down
6 changes: 3 additions & 3 deletions http/Cargo.toml
Expand Up @@ -8,13 +8,13 @@ keywords = ["jsonrpc", "json-rpc", "json", "rpc", "server"]
license = "MIT"
name = "jsonrpc-http-server"
repository = "https://github.com/paritytech/jsonrpc"
version = "17.0.0"
version = "17.1.0"

[dependencies]
futures = "0.3"
hyper = "0.13"
jsonrpc-core = { version = "17.0", path = "../core" }
jsonrpc-server-utils = { version = "17.0", path = "../server-utils" }
jsonrpc-core = { version = "17.1", path = "../core" }
jsonrpc-server-utils = { version = "17.1", path = "../server-utils" }
log = "0.4"
net2 = "0.2"
parking_lot = "0.11.0"
Expand Down
6 changes: 3 additions & 3 deletions ipc/Cargo.toml
Expand Up @@ -7,14 +7,14 @@ homepage = "https://github.com/paritytech/jsonrpc"
license = "MIT"
name = "jsonrpc-ipc-server"
repository = "https://github.com/paritytech/jsonrpc"
version = "17.0.1"
version = "17.1.0"

[dependencies]
futures = "0.3"
log = "0.4"
tower-service = "0.3"
jsonrpc-core = { version = "17.0", path = "../core" }
jsonrpc-server-utils = { version = "17.0", path = "../server-utils", default-features = false }
jsonrpc-core = { version = "17.1", path = "../core" }
jsonrpc-server-utils = { version = "17.1", path = "../server-utils", default-features = false }
parity-tokio-ipc = "0.8"
parking_lot = "0.11.0"

Expand Down
7 changes: 4 additions & 3 deletions pubsub/Cargo.toml
Expand Up @@ -8,19 +8,20 @@ keywords = ["jsonrpc", "json-rpc", "json", "rpc", "macros"]
license = "MIT"
name = "jsonrpc-pubsub"
repository = "https://github.com/paritytech/jsonrpc"
version = "17.0.0"
version = "17.1.0"

[dependencies]
futures = { version = "0.3", features = ["thread-pool"] }
jsonrpc-core = { version = "17.0", path = "../core" }
jsonrpc-core = { version = "17.1", path = "../core" }
lazy_static = "1.4"
log = "0.4"
parking_lot = "0.11.0"
rand = "0.7"
serde = "1.0"

[dev-dependencies]
jsonrpc-tcp-server = { version = "17.0", path = "../tcp" }
jsonrpc-tcp-server = { version = "17.1", path = "../tcp" }
serde_json = "1.0"

[badges]
travis-ci = { repository = "paritytech/jsonrpc", branch = "master"}
10 changes: 5 additions & 5 deletions pubsub/more-examples/Cargo.toml
Expand Up @@ -3,12 +3,12 @@ name = "jsonrpc-pubsub-examples"
description = "Examples of Publish-Subscribe extension for jsonrpc."
homepage = "https://github.com/paritytech/jsonrpc"
repository = "https://github.com/paritytech/jsonrpc"
version = "17.0.0"
version = "17.1.0"
authors = ["tomusdrw <tomasz@parity.io>"]
license = "MIT"

[dependencies]
jsonrpc-core = { version = "17.0", path = "../../core" }
jsonrpc-pubsub = { version = "17.0", path = "../" }
jsonrpc-ws-server = { version = "17.0", path = "../../ws" }
jsonrpc-ipc-server = { version = "17.0", path = "../../ipc" }
jsonrpc-core = { version = "17.1", path = "../../core" }
jsonrpc-pubsub = { version = "17.1", path = "../" }
jsonrpc-ws-server = { version = "17.1", path = "../../ws" }
jsonrpc-ipc-server = { version = "17.1", path = "../../ipc" }