I'm not the best at writing macros and think what I came up with is pretty ugly, so someone may give you a better one, but yes it's possible. (Under Tools you can Expand Macros by the way.)
@MoSal being able to add attrs is perfectly possible; the issue lies in performing "products" of different repetitions. Such a thing is not directly doable, but in your case, with a bit of recursion to dispatch handling all the extended definitions one by one, there is no issue anymore:
gen_from_base! {
base {
#[serde(rename = "bF")]
bf: Option<String>,
}
#[derive(Deserialize, Debug)]
pub struct S {
/* base inserted here */
ef: String,
}
#[derive(Deserialize, Debug)]
pub struct S2 {
/* base inserted here */
pub ef: u8,
}
#[derive(Deserialize, Debug)]
enum Baz {
Inline {
/* base inserted here (first enum variant) */
foo: u16,
},
SomeVariant,
}
}