avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Spencer Nelson...@spencerwnelson.com>
Subject Do fully-qualified names imply creation of a namespace?
Date Thu, 11 Mar 2021 20:11:57 GMT
When a named type definition has no dots in its 'name' field, and has no
'namespace' field, then the namespace is "taken from the most tightly
enclosing schema or protocol." For example:

{
  "type": "record",
  "name": "X",
  "namespace": "org.foo",
  "fields": [
    {"type": {"type": "fixed", "size": 8, "name": "Y"}, "name": "field"}
  ]
}

It is clear here that the fixed field's fullname is "org.foo.Y".

But what about if there is no *explicit* enclosing namespace? For example:

{
  "type": "record",
  "name": "org.foo.X",
  "fields": [
    {"type": {"type": "fixed", "size": 8, "name": "Y"}, "name": "field"}
  ]
}

What is the fullname of the fixed field here? Is it "org.foo.Y", because
the record implicitly created a namespace by using a fully-qualified name?
Or is it "Y", because there is no enclosing namespace?

Similarly, what if there is an explicit enclosing namespace - but only
after going past a fully-named type?

{
  "type": "record",
  "name": "Z",
  "namespace": "com.bar",
  "fields": [
    {
      "type": {
          "type": "record",
          "name": "org.foo.X",
          "fields": [
            {"type": "fixed", "size": 8, "name": "Y"}, "name": "field"}
          ],
     "name": "field",
    }
}

What is the fullname of the fixed field? Is it "org.foo.Y" (because the
record implicitly creates a namespace) or is it "com.bar.Y" (because the
tightest enclosing namespace is "com.bar")?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message