From 182a9cdcb61fa388dd58d468c8981a67e882b6e6 Mon Sep 17 00:00:00 2001 From: Riccardo Casatta Date: Tue, 17 Jan 2023 15:14:15 +0100 Subject: [PATCH] cln-rpc: use serde rename instead of alias rename is necessary to roundtrip, otherwise the rust name is used. This also remove the rename if they are not necessary. Note that: ``` #[serde(rename="foo", skip_serializing_if=="bar")] pub field: bool, ``` is equivalent to: ``` #[serde(rename="foo")] #[serde(skip_serializing_if=="bar")] pub field: bool, ``` and for simplicity of construction the latter is used --- cln-rpc/src/model.rs | Bin 132590 -> 114424 bytes contrib/msggen/msggen/gen/rust.py | 25 ++++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/cln-rpc/src/model.rs b/cln-rpc/src/model.rs index 3c7124b5fb367295a90730c2c1549dab0977e800..38601d8117860fcefb4b208893349d864b7a8392 100644 GIT binary patch delta 5722 zcmbtYd017|7XKDpKv3p+xXc%2P)JY_Em1*~G&S|%3sG_=2UI{w67cKGd|3#ta+Q{t zuUAB+=24Gn=?#6Qpg`Hv5(m;8av}|foOpXU_g+cu^ZVit&e{9!z1Ci9{nl@-eJ(HS zaPzM1#!DVp-yDzKJj3}@S?QS#;w8!ZS-`Xb-c)`P>@cj{2Sa^5v1gSNy?Oy$aK7(9 z@Pcm`rKLb;A)wMv2%r=FAc{}W+UsBtFUjMf177zR1I!Kx70cts#qg(+tRE}%VR2J0 z@k61}nW{6vS8Od=0wEYR!Aur?J!sB{C}A zyc=7h<;Ivz9ymPFSt*Q(W39TnjiynzRwkF zp%&eeLvVC*G?%?{8t9bTWafml0b%$`mMg9u;K)}APv8>+x!1W}Bl&9V*Uf=iZ-DR& zu1M+5CVQZLYM@!v{M1aYjqeCo{L>c77-=!a+O8dO#1QFM5nbaDVYL#KJ`)61%)p5m znuD8%`e4h@E`P>~5RM_waP9FXU|3*d1`-27SFt2+oHw3+cQ7XFBbDnTc3SgE%X;k~ zPD;s`0BhVaHbnevl7gnQ!*d)u@#vWwDV|Gm-O+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0n4FsXkgA^$)<}eVR`NVLHl^hDfKm~+&A%?Aho5SrT{D02Khx0+)VXzpe$IBcosEz!X>5XO{IfOMd z?RJ>_@x`mlmnYXJYR7Bc#IlU_aQ!X$DKpY-!iC0)O#~8}+E2cjW{L}HTgav@?m|*u zk@16FjDO|Uw9R3^b`0@~+AjbgvIOPswu^)>N**nX;1b093uLpkB|vpeTL6Yzw`}z` z2(bER4_|b3)A#gw76~sOzcWW?uqYce1=(z&8MxzgUx9_6Sw2;UuBS_#1p`O9`-?}O z2=K^fPJo^;t?R0W%gJ|jS<@isTVVHX7u++xfxFbr?MS?ASjN;L!n{*rS+7>jO85cF zcxrrRr-yJCwi{}ptlfq{mL9+YZLg6g>uINjSXyiBf!b)7(C9teXWQ)KFTtY9j%3$> zx72>oS{8vm7Y~Yg-b^B?-kc0DIrOo^jyd3QyQ(|oJ5i@*@o2Oq#2t;C6FXJb|JcqY zpqN8(E*hc5qdoE^Aeo}gs7pmFHtXatYMS8I`KD^s?%O;*w7xiQ9nVHV;N_~p$MnEU z3+XZDaAX4i>h5h-mw+=5>^%Aq4l$jt=hAyY8*odB1|f3Qrr,\n" @@ -149,14 +151,22 @@ def gen_primitive(p): if p.deprecated: defi += " #[deprecated]\n" + defi += rename_if_necessary(org, p.name.name) if p.required: - defi += f" #[serde(alias = \"{org}\")]\n pub {p.name}: {typename},\n" + defi += f" pub {p.name}: {typename},\n" else: - defi += f" #[serde(alias = \"{org}\", skip_serializing_if = \"Option::is_none\")]\n pub {p.name}: Option<{typename}>,\n" + defi += f" #[serde(skip_serializing_if = \"Option::is_none\")]\n pub {p.name}: Option<{typename}>,\n" return defi, decl +def rename_if_necessary(original, name): + if original != name: + return f" #[serde(rename = \"{original}\")]\n" + else: + return f"" + + def gen_array(a): name = a.name.normalized().replace("[]", "") logger.debug(f"Generating array field {a.name} -> {name} ({a.path})") @@ -180,10 +190,11 @@ def gen_array(a): defi = "" if a.deprecated: defi += " #[deprecated]\n" + defi += rename_if_necessary(alias, name) if a.required: - defi += f" #[serde(alias = \"{alias}\")]\n pub {name}: {'Vec<'*a.dims}{itemtype}{'>'*a.dims},\n" + defi += f" pub {name}: {'Vec<'*a.dims}{itemtype}{'>'*a.dims},\n" else: - defi += f" #[serde(alias = \"{alias}\", skip_serializing_if = \"crate::is_none_or_empty\")]\n pub {name}: Option<{'Vec<'*a.dims}{itemtype}{'>'*a.dims}>,\n" + defi += f" #[serde(skip_serializing_if = \"crate::is_none_or_empty\")]\n pub {name}: Option<{'Vec<'*a.dims}{itemtype}{'>'*a.dims}>,\n" return (defi, decl) @@ -206,9 +217,9 @@ def gen_composite(c) -> Tuple[str, str]: if c.deprecated: defi += " #[deprecated]\n" if c.required: - defi += f" #[serde(alias = \"{c.name.name}\")]\n pub {c.name}: {c.typename},\n" + defi += f" pub {c.name}: {c.typename},\n" else: - defi += f" #[serde(alias = \"{c.name.name}\", skip_serializing_if = \"Option::is_none\")]\n pub {c.name}: Option<{c.typename}>,\n" + defi += f" #[serde(skip_serializing_if = \"Option::is_none\")]\n pub {c.name}: Option<{c.typename}>,\n" return defi, r