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

C# - AvroGen tool - Document for record type is not included in the Schema field

    XMLWordPrintableJSON

Details

    Description

      Steps to reproduce:
      1) MyRecord.asvc file : 
       

      {
      "type" : "record",
      "doc" : "Doc for record"
      "name" : "MyRecord",
      "namespace" : "My.Namespace",
      "fields" :
      		[
      			{ "name" : "Field1", "type" : "int" }
      		]
      }
      

      2) Run command to generate C# class from the Avro spec file:
      avrogen -s MyRecord.asvc ./

      -> Current behavior: the Schema field in C# class is missing the "doc" data, I got serialization error when tried to use this class because the subject in Schema Registry contains the "doc" field (I register the avro spec file to the schema registry seperately)

      	public partial class MyRecord : ISpecificRecord
      	{
      		public static Schema _SCHEMA = Schema.Parse("{\"type\":\"record\",\"name\":\"MyRecord\",\"namespace\":\"My.Namespace\",\"fields\":[{\"name\":\"" + "Field1\",\"type\":\"int\"}]}");
      

      -> Expected behavior: we should have the "doc" field for type "record", so it will be consistent with the spec file

      	public partial class MyRecord : ISpecificRecord
      	{
      		public static Schema _SCHEMA = Schema.Parse("{\"type\":\"record\", \"doc\":\"Doc for record\",  \"name\":\"MyRecord\", \"namespace\":\"My.Namespace\", \"fields\":[{\"name\":\"" + "Field1\",\"type\":\"int\"}]}");
      

      As a work around, right now I have to remove the "doc" for the type "record" but I think we should have it there and not causing a problem.

      Attachments

        Issue Links

          Activity

            People

              tom.j.irvine@gmail.com Tom Irvine
              MinhDev Minh Nguyen
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h