Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.12.0
Description
=================================
There still seems to be an issue with can't refine errors, at least in some non-recursive cases. Take the following example:
fn main() {
let schema = r#"
{
"name": "test.test",
"type": "record",
"fields": [
{
"name": "bar",
"type": { "name": "test.foo", "type": "record", "fields": [{ "name": "id", "type": "long" }] }
},
{ "name": "baz", "type": "test.foo" }
]
}
"#;
let schema = apache_avro::schema::Schema::parse_str(&schema).unwrap();
println!("{}", serde_json::to_string(&schema).unwrap());
}
This prints the following (the same thing happens if the test.foo definition is in a separate file):
$ target/release/avro-test | jq
{
"type": "record",
"name": "test.test",
"fields": [
{
"name": "bar",
"type": {
"type": "record",
"name": "test.foo",
"fields": [
{
"name": "id",
"type": "long"
}
]
}
},
{
"name": "baz",
"type": {
"type": "record",
"name": "test.foo",
"fields": [
{
"name": "id",
"type": "long"
}
]
}
}
]
}
Which will cause the Java tooling to fail with the org.apache.avro.SchemaParseException: Can't redefine: test error above.