Kriskras99 commented on code in PR #448:
URL: https://github.com/apache/avro-rs/pull/448#discussion_r2745855857
##########
avro_derive/src/lib.rs:
##########
@@ -146,15 +164,13 @@ fn get_struct_schema_def(
} else if field_attrs.flatten {
// Inline the fields of the child record at runtime, as we
don't have access to
// the schema here.
- let flatten_ty = &field.ty;
+ let get_record_fields =
+ get_field_get_record_fields_expr(&field,
field_attrs.with)?;
record_field_exprs.push(quote! {
- if let
::apache_avro::schema::Schema::Record(::apache_avro::schema::RecordSchema {
fields, .. }) = #flatten_ty::get_schema() {
- for mut field in fields {
- field.position = schema_fields.len();
- schema_fields.push(field)
- }
+ if let Some(flattened_fields) = #get_record_fields {
+ schema_fields.extend(flattened_fields)
Review Comment:
I've added my suggestion in the last commit, I think it's cleaner overall
--
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]