ovotech / castle

Framework for building Kafka and avro based apps in typescript
Other
77 stars 19 forks source link

Wrong handling of namespaces #149

Open Nopik opened 10 months ago

Nopik commented 10 months ago

It seems, that record field types are not properly nested with a record namespace. Namely having a.avsc schema:

{
  "type": "enum",
  "name": "A",
  "namespace": "com.example",
  "symbols": [
    "foo",
    "bar"
  ]
}

and b.avsc schema:

{
  "type": "record",
  "name": "B",
  "namespace": "com.example",
  "fields": [
    {
      "name": "a",
      "type": "A"
    }
  ]
}

Doesn't work - when avro-ts a.avsc b.avsc is executed, the resulting b.avsc.ts file has no import. If, however, "type": "A" is replaced with "type": "com.example.A", import shows up. This seems to be conflicting with Avro specification and also with how avsc package handles this.