Scott Banachowski wrote:
If a record refers to itself without using a union-type, this leads to
infinite recursion, so it's impossible to serialize the data.
(e.g.)
{
"type": "record",
"name": "LongList",
"fields" : [
{"name": "value", "type": "long"},
{"name": "next", "type": "LongList"}
]
}
Does the spec or the implementation(s) do anything to address such cases?
No. The schema would be parsed successfully, but it would be impossible
to construct an instance that conforms to it.
Do you think implementations should be required to detect and reject
such schemas at parse time? To me this seems like a "nice-to-have"
feature, like a compiler warning you about unreachable code, but not a
requirement. Such a schema could never be used to write data, so
there's no risk of data loss by permitting such schemas.
Doug