Closed dvisockas closed 1 year ago
Hello! Yes this all makes sense. Thank you for the code sample clearly explaining the issue.
I think you identified the correct fix, or at least the first fix that I would try. Would you be willing to submit a PR? I can help you on it if you're stuck and would be happy to review and merge it (though I am on leave though and may not respond super fast).
I would approach it something like...:
when String
case.\
then it's a Rational
, else BigDecimal
.WDYT?
I'd be happy to submit a PR. Will ping you if I get stuck!
👋 Hi!
If we initialize a weight value and serialize it:
If we then deserialize it:
This is the case because
Measured
assumes that if the first argument is a string - it is parsed as aBigDecimal
. Maybe it could be a bit smarter and try to parse the value asRational
if some condition (maybe just a simple\d+\\\d+
regex matched)?