martin-g commented on code in PR #397:
URL: https://github.com/apache/avro-rs/pull/397#discussion_r2697494525
##########
avro_derive/src/lib.rs:
##########
@@ -166,7 +170,13 @@ fn get_data_struct_schema_def(
None => quote! { None },
};
let aliases = preserve_vec(field_attrs.alias);
- let schema_expr = type_to_schema_expr(&field.ty)?;
+ let schema_expr = match field_attrs.with {
+ With::Trait => type_to_schema_expr(&field.ty)?,
+ With::Serde(path) => {
+ quote! {#path::get_schema_in_ctxt(named_schemas,
enclosing_namespace)}
+ }
+ With::Expr(expr) => quote! {#expr(named_schemas,
enclosing_namespace)},
Review Comment:
```diff
- With::Expr(expr) => quote! {#expr(named_schemas,
enclosing_namespace)},
+ With::Expr(expr) => match expr {
+ Expr::Closure(closure) => {
+ let inputs = &closure.inputs;
+ let body = &closure.body;
+ dbg!("==========", &closure);
+ dbg!(">>>>>", quote! {#body});
+ quote! {#body}
+ }
+ _ => quote! {#expr(named_schemas,
enclosing_namespace)},
+ },
};
```
This seems to work for `|| Schema::Bytes` !
I guess we could make it work also for `|named_schemas, enclosing_namespace|
Schema::Bytes`
--
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]