Jarek Rosiek created AVRO-2728:
----------------------------------

             Summary: idl2schemata: same types in different namespaces => 
overwritten files
                 Key: AVRO-2728
                 URL: https://issues.apache.org/jira/browse/AVRO-2728
             Project: Apache Avro
          Issue Type: Bug
          Components: tools
    Affects Versions: 1.9.1
            Reporter: Jarek Rosiek


For the following AVDL:
{code:java}
@namespace("ns1")
protocol Proto {
  record Foo {
    ns2.Foo foo;
  }  

  @namespace("ns2")
  record Foo {
    int x;
  }
}

{code}
the tool will generate just a single file named {{Foo.avsc}} with the schema of 
the last record Foo.

 

Suggested solution:

Add an option to the {{idl2schemata}} command named, for example, {{-fqnames}} 
that will make the tool generate files named using full qualified type names. 
For example, for the protocol shown above the files would be named:
{code:java}
ns1.Foo.avsc
ns2.Foo.avsc{code}
 

Impact:

My company wanted to use Avro IDL as a specification format for the schemas 
(more readable, ability to import other files). We need to push the schemas to 
kafka Schema Registry. We could use {{idl2schemata}}  to generate schemas in 
JSON format but we risk pushing wrong schema whenever different teams working 
on schemas from different namespaces create a type with the same base name.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to