You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Kalle Niemitalo (Jira)" <ji...@apache.org> on 2022/08/24 08:33:00 UTC

[jira] [Commented] (AVRO-3620) name vs. fullname in JSON encoding of union

    [ https://issues.apache.org/jira/browse/AVRO-3620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17584121#comment-17584121 ] 

Kalle Niemitalo commented on AVRO-3620:
---------------------------------------

Separately from this, some implementations support a nonstandard JSON encoding (AVRO-1582) in which a union is encoded the same way as the member value itself, without adding a JSON object wrapper. That is okay as long as the implementations support the standard JSON encoding as well. (For the Java implementation, that feature is configured with [JsonEncoder.setIncludeNamespace|https://avro.apache.org/docs/1.11.1/api/java/org/apache/avro/io/JsonEncoder.html#setIncludeNamespace-boolean-], which was added in [https://github.com/apache/avro/pull/508].)

> name vs. fullname in JSON encoding of union
> -------------------------------------------
>
>                 Key: AVRO-3620
>                 URL: https://issues.apache.org/jira/browse/AVRO-3620
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: spec
>    Affects Versions: 1.11.1
>            Reporter: Kalle Niemitalo
>            Priority: Major
>
> The [JSON Encoding|https://avro.apache.org/docs/1.11.1/specification/#json-encoding] section of the Avro specification states that a union with a non-null value _"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."_ This refers to the {_}name{_}, but at least the JSON encoder for Java writes the _fullname_ of the type instead. The terms "name" and "fullname" are defined in [Names|https://avro.apache.org/docs/1.11.1/specification/#names].
> Tasks in this issue:
>  - Collect information about each implementation: whether its JSON encoder writes the name or the fullname, and whether its JSON decoder accepts the name, fullname, or both.
>  - Decide whether the name or the fullname should be used.
>  - Change the specification and implementations according to the decision, or file separate issues for individual implementations.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)