You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Kyle Schoonover (Jira)" <ji...@apache.org> on 2022/03/16 21:09:00 UTC

[jira] [Commented] (AVRO-1362) C# parser allows incorrect syntax for record fields of a named type

    [ https://issues.apache.org/jira/browse/AVRO-1362?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17507878#comment-17507878 ] 

Kyle Schoonover commented on AVRO-1362:
---------------------------------------

[~mgrigorov] It appears Java will now be permissive in parsing this as well. 

Ran Schema.Parse and then toString

Java outputs: \{"type":"record","name":"Batch","namespace":"SampleClasses","fields":[{"name":"Invoices","type":{"type":"array","items":{"type":"record","name":"Invoice","fields":[{"name":"Id","type":"string"}]}}},\{"name":"SingleInvoice","type":"Invoice"},\{"name":"ListOfInvoices","type":{"type":"array","items":"Invoice"}}]}

 

C# outputs: \{{"type":"record","name":"Batch","namespace":"SampleClasses","fields":[{"name":"Invoices","type":{"type":"array","items":{"type":"record","name":"Invoice","namespace":"SampleClasses","fields":[{"name":"Id","type":"string"}]}}},\{"name":"SingleInvoice","type":"Invoice"},\{"name":"ListOfInvoices","type":{"type":"array","items":"Invoice"}}]}}

> C# parser allows incorrect syntax for record fields of a named type
> -------------------------------------------------------------------
>
>                 Key: AVRO-1362
>                 URL: https://issues.apache.org/jira/browse/AVRO-1362
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: csharp
>    Affects Versions: 1.7.4
>         Environment: Schema class - org.apache.avro:avro:1.7.4
> Also confirmed in Avro 1.7.5 (RC)
>            Reporter: Bill Baird
>            Priority: Major
>
> The following schema compiles successfully in Avro(c#), but in Avro(Java)returns a "Type not supported: Invoice" when parsing the "ListOfInvoices" array.  
> Problem appears to be in the parse method.  \{"items": "Invoice"\} does not properly parse to find the "Invoice" type.
> {   "namespace": "SampleClasses",
>     "name": "Batch",
>     "type": "record",
>     "fields": [
> 		{ "name": "Invoices", "type": {
> 				"type": "array",
> 				"items": {
>                             "name": "Invoice",
>                             "type": "record",
>                             "fields": [
>                                 { "name": "Id", "type": "string" }
>                             ]
> 						}
> 				}
> 		},
> 		{ "name": "SingleInvoice", "type": "Invoice" },            // This reference to "Invoice" works fine.
> 		{ "name": "ListOfInvoices", "type": {
> 				"type": "array", "items": {	"type": "Invoice" }    // Fails - does not get previous definition of "Invoice"
> 			    }
> 		}
> 	]
> }



--
This message was sent by Atlassian Jira
(v8.20.1#820001)