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

Fix Params deserialization on serde_json>=1.0.8 #222

Merged
merged 2 commits into from
Dec 13, 2017

Conversation

Marwes
Copy link
Contributor

@Marwes Marwes commented Dec 13, 2017

Due to serde-rs/json#389, serde_json no longer calls deserialize_any in deserialize_identifer (and all other default implemented methods). This causes Params to fail to deserialize maps and sequences since it has hinted that it expects an identifier.

This implements deserialize correctly, saying that it accepts any type.

cc @dtolnay (thought you might want to be aware of this regression/bug)

Due to serde-rs/json#389, serde_json no longer calls `deserialize_any` in `deserialize_identifer` (and all other default implemented methods). This causes `Params` to fail to deserialize maps and sequences since it has hinted that it expects an identifier.

This implements `deserialize` correctly, saying that it accepts any type.
@tomusdrw
Copy link
Contributor

Hi @Marwes! Thanks a bunch. Would you mind adding a test to cover current incorrect behaviour?

@Marwes
Copy link
Contributor Author

Marwes commented Dec 13, 2017

It should be covered by https://github.com/Marwes/jsonrpc/blob/9d6fcf1aa9d4f3b2eb174f83b4785284501976f8/core/src/types/params.rs#L98-L110 . It is just that the last build of jsonrpc-core was with serde_json<1.0,8.

(Also I couldn't build this locally due to rust-lang/cargo#4810 so I just opted for the minimal change through the github gui :/ )

@Marwes
Copy link
Contributor Author

Marwes commented Dec 13, 2017

Looks to be building with 1.0.8 so if it passes this should be good https://travis-ci.org/paritytech/jsonrpc/jobs/316075816#L491

@tomusdrw
Copy link
Contributor

I see, thanks! Will try to bump in my local Cargo.lock and test.

@Marwes
Copy link
Contributor Author

Marwes commented Dec 13, 2017

Same issue for Id. Fixed.

@tomusdrw tomusdrw merged commit 59cb86b into paritytech:master Dec 13, 2017
@debris
Copy link
Contributor

debris commented Dec 18, 2017

@tomusdrw we need to introduce the same fixes in parity ethabi

@Marwes Marwes deleted the patch-1 branch December 18, 2017 13:32
debris pushed a commit that referenced this pull request Jan 15, 2018
* Fix Params deserialization on serde_json>=1.0.8

Due to serde-rs/json#389, serde_json no longer calls `deserialize_any` in `deserialize_identifer` (and all other default implemented methods). This causes `Params` to fail to deserialize maps and sequences since it has hinted that it expects an identifier.

This implements `deserialize` correctly, saying that it accepts any type.

* Fix Id deserialization on serde_json>=1.0.8
@debris debris mentioned this pull request Jan 15, 2018
debris added a commit that referenced this pull request Jan 15, 2018
* Fix Params deserialization on serde_json>=1.0.8

Due to serde-rs/json#389, serde_json no longer calls `deserialize_any` in `deserialize_identifer` (and all other default implemented methods). This causes `Params` to fail to deserialize maps and sequences since it has hinted that it expects an identifier.

This implements `deserialize` correctly, saying that it accepts any type.

* Fix Id deserialization on serde_json>=1.0.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants