[
https://issues.apache.org/jira/browse/AVRO-3479?focusedWorklogId=755546&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-755546
]
ASF GitHub Bot logged work on AVRO-3479:
----------------------------------------
Author: ASF GitHub Bot
Created on: 12/Apr/22 03:02
Start Date: 12/Apr/22 03:02
Worklog Time Spent: 10m
Work Description: jklamer commented on PR #1631:
URL: https://github.com/apache/avro/pull/1631#issuecomment-1095891894
@martin-g darling is exactly what I was thinking there should be when I was
making it! Refactored it a bit to break it up into NamedTypes and their schema
options , and fields and their schema options! So we get docs on fields and
types out of the box and super easily. Check it out:
```
#[derive(Debug, Serialize, Deserialize, AvroSchema, Clone, PartialEq)]
#[avro(namespace = "com.testing.namespace", doc = "A Documented Record")]
struct TestBasicWithAttributes {
#[avro(doc = "Documented Field")]
a: i32,
b: String,
}
```
Also I was able to solve the `doc` issue where ToTokens on Option was
flattening away None by manually preserving it in the output tokens:
```
fn preserve_optional(op: Option<impl quote::ToTokens>) -> TokenStream {
match op {
Some(tt) => quote! {Some(#tt.to_owned())},
None => quote! {None},
}
}
```
Issue Time Tracking
-------------------
Worklog Id: (was: 755546)
Time Spent: 2h 10m (was: 2h)
> [rust] Derive Avro Schema macro
> -------------------------------
>
> Key: AVRO-3479
> URL: https://issues.apache.org/jira/browse/AVRO-3479
> Project: Apache Avro
> Issue Type: Improvement
> Reporter: Jack Klamer
> Assignee: Jack Klamer
> Priority: Major
> Labels: pull-request-available
> Time Spent: 2h 10m
> Remaining Estimate: 0h
>
> The tracking Issue for the Avro Derive Feature of the rust SDK.
> Proposal (copied from email):
> Have another rust crate that is importable as a feature on the main crate (in
> the same manner as serde derive), that will provide a derive proc_macro that
> implements a simple trait that returns the schema for the implementing type.
> Right now, schemas must be parsed from strings ( or read from files first),
> and closely coordinated with the associated struct. This makes sense for
> workflows that need to associate the same type across languages. For programs
> that are all within Rust, there are usability advantages of the proc_macro.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)