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

Cannot parse Avro schemas for a record with depth less than the default maximum of 64 in C#

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.11.2
    • None
    • csharp

    Description

      When parsing the Avro Schema with Newtonsoft.Json max depth is limited to 64, the default. It cannot be customized because it's using JObject.Parse that doesn't allow to customize it.
      Using JsonConvert could allow to change default MaxDepth

                      JsonConvert.DefaultSettings = () =>
                      {
                          return new JsonSerializerSettings
                          {
                              MaxDepth = 100
                          };
                      };
                      var schema = File.ReadAllText("schema.avsc");
                      var json = JsonConvert.DeserializeObject<JObject>(schema);
      

      https://github.com/apache/avro/blob/41b3c08ca5da192786c2b08546e691b3126e1856/lang/csharp/src/apache/main/Schema/Schema.cs#L250

      An alternative solution is to configure Json max depth so it corresponds to an Avro schema for a 64 levels depth record.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              emasab Emanuele Sabellico
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h 20m
                  3h 20m