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

Replace JsValue::into/from_serde with serde-wasm-bindgen #678

Merged
merged 4 commits into from
Jun 5, 2023

Conversation

sergeyboyko0791
Copy link
Contributor

wasm-bindgen::serde-serialize feature may lead to a cyclic package dependency like

error: cyclic package dependency: package `wasm-bindgen v0.2.74` depends on itself. Cycle:
package `wasm-bindgen v0.2.74`
    ... which is depended on by `js-sys v0.3.51`
    ... which is depended on by `getrandom v0.2.2`
    ... which is depended on by `ahash v0.7.4`
    ... which is depended on by `hashbrown v0.11.2`
    ... which is depended on by `indexmap v1.7.0`
    ... which is depended on by `serde_json v1.0.57`
    ... which is depended on by `wasm-bindgen v0.2.74`
    ... which is depended on by `getrandom v0.1.14`
    ... which is depended on by `const-random-macro v0.1.8`
    ... which is depended on by `const-random v0.1.8`
    ... which is depended on by `ahash v0.2.18`

Due to this problem, JsValue::into_serde and JsValue::from_serde were deprecated at rustwasm/wasm-bindgen#3031

Motivation: KomodoPlatform/komodo-defi-framework#1042 (comment)

@sergeyboyko0791 sergeyboyko0791 marked this pull request as draft January 4, 2023 21:34
@sergeyboyko0791
Copy link
Contributor Author

serde-wasm-bindgen likely doesn't handle serde(deny_unknown_fields) attribute properly. Will try to find a workaround.

@sergeyboyko0791 sergeyboyko0791 marked this pull request as ready for review January 5, 2023 11:21
@sergeyboyko0791
Copy link
Contributor Author

I had to disable serde(deny_unknown_fields) due to RReverser/serde-wasm-bindgen#39

@sergeyboyko0791
Copy link
Contributor Author

As a workaround I can follow this advice RReverser/serde-wasm-bindgen#39 (comment)
Please let me know if it's critical to deny unknown fields.

Copy link
Owner

@tomusdrw tomusdrw left a comment

Choose a reason for hiding this comment

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

deny_unknown_fields was kind of inherited from jsonrpc_core while solving #544.
I like it, but for no particular practical reason, just an ocd. But getting rid of a deprecation warning is way more important, so thank you for the PR!

@tomusdrw tomusdrw enabled auto-merge (squash) June 5, 2023 19:19
@tomusdrw tomusdrw merged commit 69f2e31 into tomusdrw:master Jun 5, 2023
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.

2 participants