Hi,

I want to be able to import and share a schema with multiple other schemas.
The schema is defined as such:

{ 
    "namespace" : "test.avro",
    "name" : "Address",
    "type" : "record",
    "fields" : [
                {"name" : "address1" , "type" : "string" },
                {"name" : "address2" , "type" : "string" },
                {"name" : "city" , "type" : "string" },
                {"name" : "state" , "type" : "string" },
                {"name" : "zip" , "type" : "int" },
                {"name" : "zip4", "type": "int" }
               ]
}

And I¹d like to refer to an Address in other schemas, e.g.:

{
      "namespace": "test.avro",
      "name" : "User",
      "type" : "record",
      "fields" : [
                                { "name": "name", "type": "string" },
                                { "name": "address", "type": { "type" : "
test.avro.Address" } }
          ]
}

Or

{
      "namespace": "test.avro",
      "name" : "Business",
      "type" : "record",
      "fields" : [
                                { "name": "businessName", "type": "string"
},
                                { "name": "address", "type": { "type" : "
test.avro.Address" } }
          ]
}


However when I try this I get the following error:
org.apache.avro.SchemaParseException: Type not supported: Address


Basically I want to have a generic Address schema that can be imported by a
number of different other schemas.  The motivation is to avoid having to
maintain an Address record for every User, Business, etc.  If this is not
possible, can someone recommend a workaround?  Is my syntax incorrect?

Thanks in advance.

Reply via email to