Nathaniel Borg created AVRO-4075: ------------------------------------ Summary: [CSharp] JsonDecoder fails to decode string when given an ISO formatted date string Key: AVRO-4075 URL: https://issues.apache.org/jira/browse/AVRO-4075 Project: Apache Avro Issue Type: Bug Components: csharp Affects Versions: 1.12.0 Reporter: Nathaniel Borg
I have been using Avro to convert JSON to a GenericRecord and noticed a bug. When having a schema field with a type string and an ISO formatted date is passed in, Avro thinks would try to decode it as a Date. {*}For example{*}: {code:java} var schema = /*lang=json,strict*/ "{\"type\":\"record\",\"name\":\"User\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"}]}"; var payload = /*lang=json,strict*/ "{ \"name\": \"1900-01-01T00:00:00Z\" }"; var recordSchema = Schema.Parse(schema); var reader = new DefaultReader(recordSchema, recordSchema); var decoder = new JsonDecoder(recordSchema, payload); var genericRecord = reader.Read<GenericRecord?>(null, decoder); {code} This code will throw an error stating the following: *AvroTypeException: Expected string. Got Date* -- This message was sent by Atlassian Jira (v8.20.10#820010)