Closed ethanfrey closed 3 years ago
@webmaster128 looks like using ()
here instead of bool
has caused a few headaches.
I think if parsing is fixed, then all tests should work.
I will try to parse with serde-json
as well
Right, deserializing into ()
was not tested. It should be easy to add.
I wonder where you need this. For contract -> VM communication (like ContractResult) we use serde-json-wasm for serializing and serde-json for deserializing.
It shows up in the unit tests: https://github.com/CosmWasm/cosmwasm/blob/bcd465b3e1307c21a7d23ac5d9f67908301df71b/contracts/ibc-reflect/src/contract.rs#L398-L404
It is not blocking the PR, but one step of the unit test is disabled. I guess I could directly use serde_json::from_slice
there, but that seems rather ugly to mix. The same test passes in the integration test: https://github.com/CosmWasm/cosmwasm/blob/bcd465b3e1307c21a7d23ac5d9f67908301df71b/contracts/ibc-reflect/tests/integration.rs#L218-L220
Ahh, okay! Good to know this is used.
Not implemented:
/// Unsupported. Use a more specific deserialize_* method
fn deserialize_unit<V>(self, _visitor: V) -> Result<V::Value>
where
V: Visitor<'de>,
{
unreachable!()
}
As of #24 we now support encoding
()
, such as inContractResult<()>
In my tests,
ContractResult::Ok(())
will encode to{"ok":null}
properly. However, when I try to deserialize it, I get an error:Error:
Note: Tested with
v0.2.2