You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "Martin Tzvetanov Grigorov (Jira)" <ji...@apache.org> on 2023/02/09 07:28:00 UTC

[jira] [Resolved] (AVRO-3709) [Rust] Add aliases to RecordField

     [ https://issues.apache.org/jira/browse/AVRO-3709?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Tzvetanov Grigorov resolved AVRO-3709.
---------------------------------------------
    Fix Version/s: 1.12.0
                   1.11.2
       Resolution: Fixed

> [Rust] Add aliases to RecordField
> ---------------------------------
>
>                 Key: AVRO-3709
>                 URL: https://issues.apache.org/jira/browse/AVRO-3709
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: rust
>    Affects Versions: 1.11.1
>            Reporter: Santiago Fraire Willemoes
>            Assignee: Martin Tzvetanov Grigorov
>            Priority: Minor
>              Labels: pull-request-available, rust
>             Fix For: 1.12.0, 1.11.2
>
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Hello everyone, I'm working on an [avdl parser for rust|https://github.com/woile/avdl-rs] and I'm having an issue with the lack of aliases on the `RecordField`.
> For an Avdl like this:
> {code:java}
> protocol MyProtocol {
>     record Hello {
>         string @aliases(["nickname"]) name;
>     }
> }
> {code}
> The schema is rendered as:
> {code:java}
> {
>   "type" : "record",
>   "name" : "Hello",
>   "fields" : [ {
>     "name" : "name",
>     "type" : "string",
>     "aliases" : [ "nickname" ]
>   } ]
> }
> {code}
> But when I generate the schema on rust using the `RecordField`, it doesn't have aliases. 
> See [https://github.com/apache/avro/blob/master/lang/rust/avro/src/schema.rs#L559-L580]
> And even if I use `custom_attributes` with aliases, when generating the schema using `schema.canonical_form()`, they don't appear.
> The `RecordField` has `custom_attributes` for unknown fields but aliases are known. See documentation here:
> [https://avro.apache.org/docs/1.11.1/idl-language/#other-language-features]
> The interesting thing is that the Specification doesn't mention aliases in a RecordField, but they are used widely everywhere.
> I would be willing to submit a PR, not sure if there's another reason for the lack of aliases that I'm missing.
> I would also like to ask for advice, is the Schema supposed to be used to generate a json schema? or is it solely for deserializing a json schema? Should I create a fork of it? I find it strange that it implements serde's serialize but it doesn't fully serialize all the attributes.
> Thanks a lot.



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