# avro-user mailing list archives

##### Site index · List index
Message view
Top
From Aleksey Maslov <Aleksey.Mas...@Lab49.com>
Subject How to reference previously defined enum in avsc file?
Date Fri, 11 Mar 2011 04:04:58 GMT
Hi,
[i don't see my original post - but if you seen this already, I appologise
for re-post]

I am trying to define several objects in avsc files and compile the schema
using avro-1.4.1;
i have several questions;

1. Is it true that all objects MUST be defined in 1 huge file if I want to
reference previously defined ones?
(sounds a bit messy if you have dozens of objects to define, but ok);

2. I am having a problem defining a field of type enum (previously defined
in same avsc file), with error:
"KnownLetters" is not a defined name.

my avsc file contents:

{
"namespace": "def.al.pha.bet",
"type": "enum",
"name": "KnownLetters",
"doc": "Specifies known types of letters",
"symbols": ["A", "B", "C", "D", "E"],

"type": "record",
"name": "Page",
"doc": "Object definition of a Page composed of alphabet",
"fields": [
{"name": "letter",  "type": "KnownLetters"}
]
}

How could this be achived? What am i missing?

3. I am observing strange namespace related behavior; to experiment, in the
above avsc definition I defined letter as "int" (just to keep going), and
found that only 1 of the two objects are being generated (the Page.java);
the enum is not generated at all, and i get no errors on the command line;
why is that?

my invocation is:
> java -jar ..\lib\avro-tools-1.4.1.jar compile schema ..\def\test.avsc ..\

Thanks;

--
View this message in context: http://apache-avro.679487.n3.nabble.com/How-to-reference-previously-defined-enum-in-avsc-file-tp2663512p2663512.html
Sent from the Avro - Users mailing list archive at Nabble.com.


Mime
View raw message