iotaledger / iotaledger/identity
[Task] Replace deprecated `JsValue::into_serde` in Wasm bindings
- Dominant language
- Rust
- Stars
- 346
- Forks
- 100
- Avg merge
- 13h 41m
- Merged PRs (30d)
- 2
Description
## Description
Find an alternative to the deprecated `JsValue::into_serde` calls in the Wasm bindings. It suggests `serde-wasm-bindgen` or `gloo_utils::format::JsValueSerdeExt`.
We currently ignore deprecation warnings with `#![allow(deprecated)]`, due to the diffing being deprecated as well.
## Motivation
The latest `wasm-bindgen` update (0.2.83) deprecated `JsValue::into_serde`,
E.g. https://github.com/iotaledger/identity.rs/pull/1010/checks?check_run_id=8310097028
```rust
use of deprecated associated function `wasm_bindgen::JsValue::into_serde`: causes dependency cycles, use `serde-wasm-bindgen` or `gloo_utils::format::JsValueSerdeExt` instead
error: use of deprecated associated function `wasm_bindgen::JsValue::into_serde`: causes dependency cycles, use `serde-wasm-bindgen` or `gloo_utils::format::JsValueSerdeExt` instead
--> tests/wasm.rs:285:47
|
285 | let de: Timestamp = JsValue::from_str(&ser).into_serde().unwrap();
| ^^^^^^^^^^
```
## Resources
- `wasm-bindgen` deprecation PR: https://github.com/rustwasm/wasm-bindgen/pull/3031
- `wasm-bindgen` JSON guide: https://rustwasm.github.io/wasm-bindgen/reference/arbitrary-data-with-serde.html#an-alternative-approach---using-json
## To-do list
- [ ] Decide on a replacement.
- [ ] Update wasm-bindings.
- [ ] Un-pin `wasm-bindgen` dependency.
## Change checklist
Add an `x` to the boxes that are relevant to your changes, and delete any items that are not.
- [ ] The feature or fix is implemented in Rust and across all bindings whereas possible.
- [ ] The feature or fix has sufficient testing coverage
- [ ] All tests and examples build and run locally as expected
- [ ] Every piece of code has been document according to the documentation guidelines.
- [ ] If conceptual documentation (mdbook) and examples highlighting the feature exist, they are properly updated.
- [ ] If the feature is not currently documented, a documentation task Issue has been opened to address this.
Contributor guide
Research direction
Start with the deprecated call shown in tests/wasm.rs and inspect the Wasm bindings plus the pinned wasm-bindgen dependency. Compare the suggested serde-wasm-bindgen and gloo_utils alternatives before choosing one. Done means the bindings no longer use JsValue::into_serde, the deprecation allowance and dependency pin are addressed, and the Wasm tests build and run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- build-system, web-dev
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100