Sufflope commented on code in PR #311:
URL: https://github.com/apache/avro-rs/pull/311#discussion_r2419787184


##########
avro/src/schema.rs:
##########
@@ -2456,6 +2456,9 @@ pub mod derive {
     use super::*;
     use std::borrow::Cow;
 
+    pub use crate::writer::SERDE_FLATTEN;
+    pub use serde_json;

Review Comment:
   It is for this line that I had to change further down:
   
   `let mut attributes: std::collections::BTreeMap<String, 
apache_avro::schema::derive::serde_json::Value> = Default::default();`
   
   My experience writing proc-macros (in internal projects mostly, so not many 
public occurrences to show for credit) is that you should publicly re-export 
these external crates that you depend on in the generated code, because 
otherwise, if a project uses `avro-rs` but does not yet depend on `serde_json`, 
the macro will generate confusing compilation errors about a missing 
`serde_json` crate, with the user not finding a single `serde_json` in their 
source. They would then have to depend on that crate for "no reason" and this 
could mess e.g. linters which would see it as unused dependency. See [one 
PR](https://github.com/juhaku/utoipa/pull/1243) I made with this rationale 
:smile: 
   
   I forgot to add a doc(hidden) on it though.



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