Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-3090

C# AvroGen - Generated _SCHEMA field not including "doc" and "order"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Duplicate
    • 1.10.2
    • None
    • csharp
    • None

    Description

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

      How to reproduce:

      1. Create a MyRecord.avsc file: 

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

       

       2. Run avrogen to generate the C# class:

      avrogen -s MyRecord.avsc .

       

      3. Check the output:

      /// <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\"]}]}");
      

      The generated schema does not include the "doc" 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.

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            José Magalhães José Magalhães
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: