KalleOlaviNiemitalo commented on PR #3373:
URL: https://github.com/apache/avro/pull/3373#issuecomment-2854589190

   Can you show an example of the ambiguous JSON data and the Avro schema with 
which was encoded?
   
   <https://avro.apache.org/docs/1.12.0/specification/#json-encoding> 
stipulates:
   
   > otherwise it is encoded as a JSON object with one name/value pair whose 
name is the type’s name and whose value is the recursively encoded value. For 
Avro’s named types (record, fixed or enum) the user-specified name is used, for 
other types the type name is used.
   
   That specifically says "name" rather than "fullname".  If the JSON encoders 
now should output the fullname of the type as the property name, then the 
specification should be changed.
   
   This likewise says "name" rather than "fullname":
   
   > Unions may not contain more than one schema with the same type, except for 
the named types record, fixed and enum. For example, unions containing two 
array types or two map types are not permitted, but two types with different 
names are permitted. (Names permit efficient resolution when reading and 
writing unions.)
   
   Moreover, the schema resolution part of the specification says that schemas 
match if:
   
   > both schemas are records with the same (unqualified) name
   
   Suppose the specification were changed to allow multiple identically named 
record schemas as members of the same union, as long as they are in different 
namespaces.  Then, if such a union schema is the reader's schema, then both 
record schemas can match the writer's schema, in which case the first matching 
schema must be used in schema resolution — even if the other record schema has 
the same namespace as in the writer's schema.  That seems an undesirable result 
to me.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to