-
-
Notifications
You must be signed in to change notification settings - Fork 692
Produce to topic: avro with nullable can't be produced #407
New issue
Have a question abo 8000 ut this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I tested your app, and works exactly like avro-tools :
So the pb is present when avro is not generated from json ! |
Sorry to close the previous one ! Your goal is to produce the good.json or the bad.json from akhq ? |
🙂 |
must be done on |
Dear Ludovic, I reopen the issue that you closed because I really like your product and like to use it in my organization.
My goal is not to flood you with issues ! I think that the "produce to topic" function is cool but does not work since any given bad encoded JSON cannot be handled. Try to take the json you display and use it to produce a new message, you will get a "org.apache.avro.AvroTypeException" !
So here is the avro spec (link that I already added in the previous ticket) :
http://avro.apache.org/docs/current/spec.html#json_encoding
And an example of serde using avro-tools (we always learn even if you are a specialist):
test.asvc :
{
"type" : "record",
"name" : "recordName",
"namespace" : "name.space",
"fields" : [ {
"name" : "id",
"type" : ["null", "int"]
} ]
}
bad.json:
{
"id" : 141
}
good.json:
{
"id" : {"int" : 141}
}
$ java -jar avro-tools-1.10.0.jar fromjson --schema-file test.asvc bad.json > test.avro
Exception in thread "main" org.apache.avro.AvroTypeException: Expected start-union. Got VALUE_NUMBER_INT
$ java -jar avro-tools-1.10.0.jar fromjson --schema-file test.asvc good.json > test.avro
OK
$ java -jar avro-tools-1.10.0.jar tojson test.avro > test.json
test.json :
{
"id" : {"int" : 141}
}
The text was updated successfully, but these errors were encountered: