In 81ad8e65 a temporary measure was added for compatibility with the latest VF-GraphQL spec without requiring extensive updates to the zome APIs. To prevent any possible numerical truncation, the new Decimal type should be de/serialized as a string rather than a JavaScript number.
This will require a new externally-facing variant of the QuantityValue struct where has_numerical_value is a String. Custom serialization logic will need to be added to convert to/from the external string-based representation to an internal Rust format that is able to handle accurate arbitrary-precision decimal math. There are probably crates that integrate with Serde to do this automatically, but some investigation needs to be made.
Filing this as a bug since until these changes are made, very large values (in excess of 2^1024-1) will be truncated before sending. Since such use-cases are likely to be very rare, we can consider this a low priority issue.
(Probably best to add that I'm unclear on the details re maximum expressible values in JS; could equally be 2^53 - 1 or some other value depending on floating point storage overhead and script engine.)
In 81ad8e65 a temporary measure was added for compatibility with the latest VF-GraphQL spec without requiring extensive updates to the zome APIs. To prevent any possible numerical truncation, the new
Decimal
type should be de/serialized as a string rather than a JavaScript number.This will require a new externally-facing variant of the
QuantityValue
struct wherehas_numerical_value
is a String. Custom serialization logic will need to be added to convert to/from the external string-based representation to an internal Rust format that is able to handle accurate arbitrary-precision decimal math. There are probably crates that integrate with Serde to do this automatically, but some investigation needs to be made.Filing this as a bug since until these changes are made, very large values (in excess of 2^1024-1) will be truncated before sending. Since such use-cases are likely to be very rare, we can consider this a low priority issue.