jklamer commented on code in PR #1651:
URL: https://github.com/apache/avro/pull/1651#discussion_r855686031
##########
lang/rust/avro_derive/src/lib.rs:
##########
@@ -117,16 +119,24 @@ fn get_data_struct_schema_def(
syn::Fields::Named(ref a) => {
for (position, field) in a.named.iter().enumerate() {
let name = field.ident.as_ref().unwrap().to_string(); // we
know everything has a name
- let field_documented =
+ let field_attrs =
FieldOptions::from_attributes(&field.attrs[..]).map_err(darling_to_syn)?;
- let doc = preserve_optional(field_documented.doc);
+ let doc = preserve_optional(field_attrs.doc);
+ let default_value = match field_attrs.default {
+ Some(default_value) => {
+ quote! {
Review Comment:
NIT: I would prefer to run `serde_json::from_str(#default_value)` here and
throw an error if invalid. To avoid runtime errors.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]