diff --git a/generator/src/main.rs b/generator/src/main.rs index cb34843..94c1c87 100644 --- a/generator/src/main.rs +++ b/generator/src/main.rs @@ -711,6 +711,11 @@ fn create_struct_for_definition( (true, false) => format!("Option<{prop_ty}>"), (true, true) => format!("Option>"), }; + if &field_name != prop_name { + fields.push_str("#[serde(rename = \""); + fields.push_str(prop_name); + fields.push_str("\")]\n"); + } fields.push_str(&field_name); fields.push_str(": "); fields.push_str(&field_ty); @@ -718,7 +723,7 @@ fn create_struct_for_definition( } } - let out = format!("{docs}pub struct {name} {{\n{fields}}}\n\n"); + let out = format!("{docs}#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]\npub struct {name} {{\n{fields}}}\n\n"); Ok(out) }