Description
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}
}
Metadata
Metadata
Assignees
Projects
Status