jsontypedef / json-typedef-codegen

A CLI tool that generates code from JSON Typedef schemas
https://jsontypedef.com/docs/tools/jtd-codegen
MIT License
157 stars 31 forks source link

Rust: Allow specifying of Custom `use` in header and `#[derives]` on Structs #30

Open AdamLeyshon opened 3 years ago

AdamLeyshon commented 3 years ago

This would enable people to use the generated Structs with other libraries such as Diesel that require us to use #[derive] macros on Structs that have complicated trait implementations and others such as Default

Example:



#[derive(FromSqlRow, AsExpression, Serialize, Deserialize, Debug, Default)]
#[serde(deny_unknown_fields)]
pub struct ApiConfigData {
    #[serde(rename = "inventory")]
    inventory: Inventory,

    #[serde(rename = "maintenance")]
    maintenance: Maintenance,
}