Serialization typically refers to converting a TypeScript value into a DataValue. However, in the context of RPC calls, the conversion is not to a DataValue but rather to a WitValue.
Similarly, during deserialization, we normally convert from a DataValue to a TypeScript value.
But in RPC calls, the conversion starts from a WitValue instead.
A direct invocation always uses the shape of a DataValue. Therefore, the main deserialization function does not expect inputs like unstructured-text, unstructured-binary, or multimodal.
However, when everything is represented as a WitValue, we had to manually add some extra logic in the client generation process using WIT, and then pass the rest to the deserialization function.
These areas can be refactored and cleaned up to make the implementation more consistent and maintainable.
Recently, this ended up being not part of the tests and resulted in bug.