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

Handle null namespace properly for canonicalized schema representation

    XMLWordPrintableJSON

Details

    Description

      Considering the following schema, which contains namespaces of "".

      {
       "namespace": "",
       "type": "record",
       "name": "my_schema",
       "fields": [
         {
           "name": "a",
           "type": {
             "type": "enum",
             "name": "my_enum",
             "namespace": "",
             "symbols": ["a", "b"]
           }
         },  {
           "name": "b",
           "type": {
             "type": "fixed",
             "name": "my_fixed",
             "namespace": "",
             "size": 10
           }
         }
       ]
      }
      

      If we try to canonicalize this schema with the following code

      let schema = Schema::parse_str(schema_str).unwrap().canonical_form();
      println!("{schema}");
      

      We get the following result.

      {"name":".my_schema","type":"record","fields":[{"name":"a","type":{"name":".my_enum","type":"enum","symbols":["a","b"]}},{"name":"b","type":{"name":".my_fixed","type":"fixed","size":10}}]}
      

      But .my_schema, .my_enum and .my_fixed should not starts with a dot.

      Attachments

        Issue Links

          Activity

            People

              mgrigorov Martin Tzvetanov Grigorov
              sarutak Kousuke Saruta
              Votes:
              0 Vote for this issue
              Watchers:
              2 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 - 1h 10m
                  1h 10m