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

Rust: The canonical form should preserve schema references

    XMLWordPrintableJSON

Details

    Description

      Reported at https://github.com/flavray/avro-rs/issues/182#issuecomment-1059762821

      =================================

      There still seems to be an issue with can't refine errors, at least in some non-recursive cases. Take the following example:

      fn main() {
          let schema = r#"
          {
            "name": "test.test",
            "type": "record",
            "fields": [
              {
                "name": "bar",
                "type": { "name": "test.foo", "type": "record", "fields": [{ "name": "id", "type": "long" }] }
              },
              { "name": "baz", "type": "test.foo" }
            ]
          }
          "#;
      
          let schema = apache_avro::schema::Schema::parse_str(&schema).unwrap();
      
          println!("{}", serde_json::to_string(&schema).unwrap());
      } 

      This prints the following (the same thing happens if the test.foo definition is in a separate file):

      $ target/release/avro-test | jq
      {
        "type": "record",
        "name": "test.test",
        "fields": [
          {
            "name": "bar",
            "type": {
              "type": "record",
              "name": "test.foo",
              "fields": [
                {
                  "name": "id",
                  "type": "long"
                }
              ]
            }
          },
          {
            "name": "baz",
            "type": {
              "type": "record",
              "name": "test.foo",
              "fields": [
                {
                  "name": "id",
                  "type": "long"
                }
              ]
            }
          }
        ]
      } 

      Which will cause the Java tooling to fail with the org.apache.avro.SchemaParseException: Can't redefine: test error above.

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            mgrigorov Martin Tzvetanov Grigorov
            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 - 6h 20m
                6h 20m