martin-g commented on code in PR #398:
URL: https://github.com/apache/avro-rs/pull/398#discussion_r2703794298


##########
avro_derive/src/lib.rs:
##########
@@ -250,23 +237,85 @@ fn get_data_struct_schema_def(
     })
 }
 
+/// Use the schema definition of the only field in the struct as the schema
+fn get_transparent_struct_schema_def(
+    fields: Fields,
+    input_span: Span,
+) -> Result<TokenStream, Vec<syn::Error>> {
+    match fields {
+        Fields::Named(fields_named) => {
+            let mut found = None;
+            for field in fields_named.named {
+                let attrs = FieldOptions::new(&field.attrs, field.span())?;
+                if attrs.skip {
+                    continue;
+                }
+                if found.replace((field, attrs)).is_some() {
+                    return Err(vec![syn::Error::new(
+                        input_span,
+                        "AvroSchema: #[serde(transparent)] is only allowed on 
structs with one unskipped field",
+                    )]);
+                }
+            }

Review Comment:
   ```suggestion
               }
   
   ```



-- 
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]

Reply via email to