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

ASF subversion and git services commented on AVRO-3687:
-------------------------------------------------------

Commit 823ec2a0b5ea963f557dfbd44456edc124f98d84 in avro's branch 
refs/heads/branch-1.11 from John Bell
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=823ec2a0b ]

AVRO-3687 [Rust - avro_derive]: Add support for default enum values for rust 
derive macros (#2954)

* Add support for default enum values for rust derive macros

* AVRO-3687: Better error messages when multiple enum variants are marked as 
default

Signed-off-by: Martin Tzvetanov Grigorov <mgrigo...@apache.org>

---------

Signed-off-by: Martin Tzvetanov Grigorov <mgrigo...@apache.org>
Co-authored-by: Martin Tzvetanov Grigorov <mgrigo...@apache.org>
(cherry picked from commit 3413ac504b74d920a4fbaa1e106529e36ffb512c)


> Rust enum missing default
> -------------------------
>
>                 Key: AVRO-3687
>                 URL: https://issues.apache.org/jira/browse/AVRO-3687
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: rust
>    Affects Versions: 1.11.1
>            Reporter: Santiago Fraire Willemoes
>            Priority: Major
>              Labels: enum, pull-request-available, rust
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> I cannot seem to find the enum's default attribute as documented [in the 
> spec|https://avro.apache.org/docs/1.11.1/specification/#enums:~:text=for%20names).-,default,-%3A%20A%20default%20value]
> I'm trying to create an avdl parser and this is a blocker for me. I was 
> wondering if there's a reason for this. Otherwise I can submit a PR, please 
> let me know, thanks.
> Code sample:
> {code}
> let schema_str = 
> r#"{"name":"Shapes","type":"enum","symbols":["SQUARE","TRIANGLE","CIRCLE","OVAL"],
>  "default": "SQUARE"}"#;
> let r = Schema::parse_str(schema_str).unwrap();
> let can = r.canonical_form();
> println!("{r:?}");
> println!("{can}");
> {code}
> Observe the enum in its canonical form is missing the default.
> Looking at the Enum's code, we cannot see a default field:
> https://github.com/apache/avro/blob/master/lang/rust/avro/src/schema.rs#L113-L119
> I apologize if this is somehow wrong



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

Reply via email to