avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Łukasz Budnik <lukasz.bud...@gmail.com>
Subject array of complex type
Date Sat, 27 Dec 2014 08:51:53 GMT
Hi all,

I have a very simple question. I would like to create schema for test run
object which contains a list of test cases.

I’m using gradle plugin v1.7.2 from Spring source so I realise that I may
not have the latest functionality (althought the avro compiler is set to
1.7.7).

I have such avsc file:

{
  "namespace": "io.github.lukaszbudnik.avro.model",
  "type": "record",
  "name": "TestRunV1",
  "fields": [
    {"name": "name", "type": "string"},
    {"name": "testCasesString",  "type": { "type": "array", "items":
"string" } }
  ]
}

it works without any problems. I get a list of strings (char sequence) as
testCasesString. But that’s not what I really want. I want a list of
TestCase objects. In my other avsc file I have:

{
  "namespace": "io.github.lukaszbudnik.avro.model",
  "type": "record",
  "name": "TestCaseV1",
  "fields": [
    {"name": "name", "type": "string"}
  ]
}

Above schema parses OK and I have TestCaseV1 class generated. So I have
TestRunV1 and TestCaseV1 but I would like to link them together and I’m
struggling a lot with adding the following field to TestRunV1 object:

{"name": "testCases",  "type": { "type": "array", "items": { "type":
"TestRunV1" } } }

I keep getting "Type not supported: TestCaseV1”. When I change type to
“TestRunV1” (just like in the documentation there is a example of linked
list definition) I also get error: "Type not supported: TestRunV1”.

I also tried prefixing type with the namespace with no luck.

I’m pretty sure I have a very simple mistake somewhere, but I just can’t
see it. Could you tell me what am I doing wrong?

thanks,
Łukasz

Mime
View raw message