Cody created AVRO-2862: -------------------------- Summary: C# Primitive Schema losing metadata Key: AVRO-2862 URL: https://issues.apache.org/jira/browse/AVRO-2862 Project: Apache Avro Issue Type: Bug Components: csharp Affects Versions: 1.9.2 Reporter: Cody
Using this ticket as a base reference: https://issues.apache.org/jira/browse/AVRO-1545 The same problem is happening in the C# version as well. Given: {code:java} { "type" : "record", "name" : "BrokenRecord", "namespace" : "whatever", "fields" : [ { "name" : "a_string", "type" : { "type" : "string", "foobar" : "some example here" } } ] } {code} The property "foobar" will be lost when parsing the schema. The fix that my team has implemented is modifying this line (file used from release 1.9.2) [https://github.com/apache/avro/blob/bf20128ca6138a830b2ea13e0490f3df6b035639/lang/csharp/src/apache/main/Schema/PrimitiveSchema.cs#L85] And replacing it with the following: {code:java} if(this.Props != null && this.Props.Count > 0) { w.WriteStartObject(); w.WritePropertyName("type"); w.WriteValue(Name); foreach(var prop in Props) { w.WritePropertyName(prop.Key); w.WriteRawValue(prop.Value); } w.WriteEndObject(); } else w.WriteValue(Name);{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)