Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.11.0
Description
In the Avro C# library, if Avro.SchemaNormalization.ToParsingForm(Schema) is given a schema that includes a logical type, then it normalizes that just to "logical" and not to the base type. The resulting JSON cannot even be parsed by Avro.Schema.Parse(string). This also makes SchemaNormalization.ParsingFingerprint return an incorrect fingerprint for schemas that include logical types.
To reproduce
using System; class Program { static void Main() { var schema = Avro.Schema.Parse( @"[""int"", {""type"": ""string"", ""logicalType"": ""uuid""}]"); string pcf = Avro.SchemaNormalization.ToParsingForm(schema); Console.WriteLine(pcf); Avro.Schema.Parse(pcf); } }
Expected result
["int","string"]
Actual result
["int","logical"] Unhandled exception. Avro.SchemaParseException: Undefined name: logical at '[1]' at Avro.Schema.ParseJson(JToken jtok, SchemaNames names, String encspace) at Avro.UnionSchema.NewInstance(JArray jarr, PropertyMap props, SchemaNames names, String encspace) at Avro.Schema.ParseJson(JToken jtok, SchemaNames names, String encspace) at Avro.Schema.Parse(String json, SchemaNames names, String encspace) at Avro.Schema.Parse(String json) at Program.Main()