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

Jimmy Pramosi commented on AVRO-3633:
-------------------------------------

It looks like it gets a bit more complicated than I thought. After trying to 
write a few tests I noticed the 'Schema.Record.lookup' field from 
'Schema.Record' doesn't reflect the correct index of the field 
'Schema.Record.fields' if used with the proposed 'skip' attribute.

It might take a bit more time to resolve this..

> Additional attributes for 'avro_derive' crate
> ---------------------------------------------
>
>                 Key: AVRO-3633
>                 URL: https://issues.apache.org/jira/browse/AVRO-3633
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: rust
>    Affects Versions: 1.11.1
>            Reporter: Jimmy Pramosi
>            Priority: Minor
>              Labels: easyfix, features
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Hello,
> At the moment it is not possible to skip or rename a specific field within a 
> struct derived with 'AvroSchema'. For e.g.
> {code:java}
> use std::time::Instant;
> use apache_avro::AvroSchema;
> use serde::Deserialize;
> use serde::Serialize;
> #[derive(Clone, Debug, Deserialize, Serialize, AvroSchema)]
> pub struct FileDescriptor {
>     #[avro(rename = "pflags")]    // <--- NOT POSSIBLE
>     #[serde(rename = "pflags")]
>     pub flags: u64,
>     #[avro(skip)]                 // <--- NOT POSSIBLE
>     #[serde(skip)]
>     access_time: Instant,
> }{code}
> I would like to suggest to implement additional attributes 'skip' and 
> 'rename' to the 'avro_derive' crate. These attributes are also common in 
> other procedural macro crates like 'serde'.
> Exemplary proposal:
> [https://www.diffchecker.com/iju3tSuX]
>  
> Best Regards,
> Jimmy



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

Reply via email to