akhq
akhq copied to clipboard
Decimals are not parsed correctly
If I have a schema with a decimal like this (example from the code):
{
"name": "Dog",
"namespace": "org.akhq",
"type": "record",
"fields" : [
{"name": "id", "type": "int"},
{"name": "name", "type": "string"},
{"name": "weight", "type" : { "type" : "bytes", "logicalType" : "decimal", "precision" : 4, "scale" : 2}}
]
}
and I create a message with decimal 1.00 like this:
{
"id": 1,
"name": "Doggy",
"weight": 1.0
}
The message is displayed in the extended json view like this:
{
"id": 1,
"name": "Doggy",
"weight": 1
}
This json can then not be used to send the message again because it cannot serialize 1.
While testing I got two different errors:
Uncaught (in promise)
Object { status: 500, message: "Internal Server Error: Cannot serialize value", stacktrace: null }
And
Uncaught (in promise)
Object { status: 500, message: "Internal Server Error: Expected bytes. Got VALUE_NUMBER_INT", stacktrace: null }
We also had the case that it did accept the message but created a big decimal like 251235313.123
from the input 1
but I cannot reproduce this.
Hmm now that I tried it again, just to be sure it worked like expected. They I only wonder how we did manage to create this random number when sending the same message that was displayed again to the topic...
Hi,
I am facing the same issue with Double fields.
So if I get one of the messages from AKHQ and try to publish it again, it shows the error as below so I need to add ".0" and it will work.
Hi, i will like to know if it's possible to get this issue assigned :>
done @IsaacNoga enjoy ;)
Experiencing the same problems. Any progress in fixing it, @IsaacNoga ?
Root cause for the described issue seems to be that the value is parsed and then stringified. See here:
https://github.com/tchiotludo/akhq/blob/e57cc02c790ae833f1e2fd4f77b5cbe8def03c96/client/src/containers/Topic/Topic/TopicData/TopicData.jsx#L929-L934