You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "José Magalhães (Jira)" <ji...@apache.org> on 2021/03/22 15:08:00 UTC

[jira] [Created] (AVRO-3090) C# AvroGen - Generated _SCHEMA field not including "doc", "primaryKey" and "order"

José Magalhães created AVRO-3090:
------------------------------------

             Summary: C# AvroGen - Generated _SCHEMA field not including "doc", "primaryKey" and "order"
                 Key: AVRO-3090
                 URL: https://issues.apache.org/jira/browse/AVRO-3090
             Project: Apache Avro
          Issue Type: Bug
          Components: csharp
    Affects Versions: 1.10.2
            Reporter: José Magalhães


This issue is causing producers not to find the schemas when serializing messages. 

How to reproduce:

1. Create a MyRecord.avsc file:

 
{code:java}
{  
   "type": "record",  
   "name": "MyRecord",  
   "namespace": "my.namespace",  
   "doc": "my documentation",  
   "fields": [    
   {      
      "name": "field1",      
      "type": {        
         "type": "int",        
         "primaryKey": true      
      }
   },    
   {      
      "name": "field2",      
      "type": {        
         "type": "string",        
         "order": "ascending"      
      },      
      "aliases": [ "field3" ]    
   }]
}

{code}
 

 

2. Run avrogen to generate the C# class:
{code:java}
avrogen -s MyRecord.avsc .{code}
3. Check the output:
{code:java}
/// <summary>    
/// my documentation    
/// </summary>    
public partial class MyRecord : ISpecificRecord    
{        
   public static Schema _SCHEMA = Avro.Schema.Parse("{\"type\":\"record\",\"name\":\"MyRecord\",\"namespace\":\"my.namespace\",\"fields\":[{\"name\":\"" +                "field1\",\"type\":\"int\"},{\"name\":\"field2\",\"type\":\"string\",\"aliases\":[\"field3\"]}]}");
{code}
The generated schema does not include the "doc", "primaryKey" and "order" data as it would be expected, which makes it very different from the schema the class was generated from.

Serializers that do not allow the automatic registration of schemas will never be able to find the schema and will always throw the "schema not found" error.

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)