[
https://issues.apache.org/jira/browse/AVRO-4243?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kit Danison-Fieldhouse updated AVRO-4243:
-----------------------------------------
Description:
Hi all, the current hosted version of the [specification
|https://avro.apache.org/docs/++version++/specification/]says the following
about allowable schema:
{code:java}
Schema Declaration
A Schema is represented in JSON by one of:
A JSON string, naming a defined type.
A JSON object, of the form:
{"type": "typeName", ...attributes...}
where typeName is either a primitive or derived type name, as defined below.
Attributes not defined in this document are permitted as metadata, but must not
affect the format of serialized data.
A JSON array, representing a union of embedded types.
{code}
What is vague is the use of the term "derived type name". In this version of
the specification, the only other mention of "derived" is on the section on
Logical Types and is not related to its use here.
What is unclear to me is if this should mean "primitive or complex built-in
type names" or should mean "primitive or complex built-in type names as well as
user defined type names". If its the second case, what should the specified
behavior be if the JSON schema includes extra attributes or redefines
attributes. For instance, in this case, what should we do if we have the
schemata:
{code:json}
{
"type": "enum",
"name": "someEnum",
"symbols": ["A", "B", "C"]
}
{
"type": "someEnum",
"name": "someEnumAgain",
"symbols": ["A", "D", "E"],
"someMetaData" : "helloWorld"
}
{code}
In this case we are referencing "someEnum" but then also appear to give it a
new name, redefine its symbols, and add some meta data into the schema. I don't
think it is obvious what the behavior should be in this case. Therefore, I
think the sensible interpretation of this sentence is that "derived type" means
"complex built-in type names".
> Specification is vague about what type strings are allowed in JSON schema's
> "type" field
> ----------------------------------------------------------------------------------------
>
> Key: AVRO-4243
> URL: https://issues.apache.org/jira/browse/AVRO-4243
> Project: Apache Avro
> Issue Type: Bug
> Components: spec
> Affects Versions: 1.12.1
> Reporter: Kit Danison-Fieldhouse
> Priority: Blocker
>
> Hi all, the current hosted version of the [specification
> |https://avro.apache.org/docs/++version++/specification/]says the following
> about allowable schema:
> {code:java}
> Schema Declaration
> A Schema is represented in JSON by one of:
> A JSON string, naming a defined type.
> A JSON object, of the form:
> {"type": "typeName", ...attributes...}
> where typeName is either a primitive or derived type name, as defined below.
> Attributes not defined in this document are permitted as metadata, but must
> not affect the format of serialized data.
> A JSON array, representing a union of embedded types.
> {code}
> What is vague is the use of the term "derived type name". In this version of
> the specification, the only other mention of "derived" is on the section on
> Logical Types and is not related to its use here.
> What is unclear to me is if this should mean "primitive or complex built-in
> type names" or should mean "primitive or complex built-in type names as well
> as user defined type names". If its the second case, what should the
> specified behavior be if the JSON schema includes extra attributes or
> redefines attributes. For instance, in this case, what should we do if we
> have the schemata:
> {code:json}
> {
> "type": "enum",
> "name": "someEnum",
> "symbols": ["A", "B", "C"]
> }
> {
> "type": "someEnum",
> "name": "someEnumAgain",
> "symbols": ["A", "D", "E"],
> "someMetaData" : "helloWorld"
> }
> {code}
> In this case we are referencing "someEnum" but then also appear to give it a
> new name, redefine its symbols, and add some meta data into the schema. I
> don't think it is obvious what the behavior should be in this case.
> Therefore, I think the sensible interpretation of this sentence is that
> "derived type" means "complex built-in type names".
--
This message was sent by Atlassian Jira
(v8.20.10#820010)