[
https://issues.apache.org/jira/browse/AVRO-4075?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Oscar Westra van Holthe - Kind updated AVRO-4075:
-------------------------------------------------
Fix Version/s: (was: 1.13.0)
> [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
> Assignee: Zoltan Csizmadia
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.12.1
>
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> 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)