Description
Problem
I'm trying to use the Client/ServerCodegenDecorator extensibility points to generate Rust structs which implement serde::{Serialize, Deserialize}
. I can't find a way to insert a custom derive
statement into the RustMetadata
class using existing hooks, and I don't want to generate the impl
myself as I would need to repeat all the logic of the serde-derive macro.
Request
Provide a way for codegen decorators to augment the default RustMetadata from the SymbolProviders with additional derive attributes.
Workaround
I ended up working around this by patching the generated rust code with find/replace, but I suspect this hack will eventually break. Ideally, I'd like a more sustainable solution.
perl -0777 -i.original -pe "s/#\[derive\(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug\)\]\npub struct $name/#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug, serde::Serialize, serde::Deserialize)]$serde_tag\npub struct $name/g" $model_file