Closed jasonbekolay closed 5 years ago
Thanks for help improving moshi-jsonapi.
We can just follow behavior of moshi.
So just go ahead :-)
Thank you for the feedback 😀 I've added a commit with a fix. If you have further feedback, I'm happy to make modifications.
Currently just a reproduction in a failing test.
The cause of of this issue is in the
dump(JsonReader reader, JsonWriter writer)
method inMoshiHelper
Typically this code is called with an instance
JsonUtf8Reader
and everything works fine in that case. In the case of the failing test in this PR, it's called with an instance ofJsonValueReader
instead. InJsonValueReader.nextLong()
it essentially casts a double down to a long instead of throwing an exception.I'm happy to implement a solution but would appreciate some guidance. The
dump
method could be changed to something like this:I would also be open to the thought that
JsonValueReader
should throw an exception if you callnextLong()
when the value has a fractional part. If that is the preferred path, I can create an issue in the main moshi repo.Thank you for moshi-jsonapi! Your work on it is much appreciated by the team at Yapp!