mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-20 13:54:36 +01:00
msggen: rust fix for methods containing '-'
This commit is contained in:
parent
2d0778ec38
commit
e418d0c08c
3 changed files with 9 additions and 2 deletions
4
cln-rpc/src/model.rs
generated
4
cln-rpc/src/model.rs
generated
|
@ -86,6 +86,7 @@ pub enum Request {
|
|||
PreApproveKeysend(requests::PreapprovekeysendRequest),
|
||||
PreApproveInvoice(requests::PreapproveinvoiceRequest),
|
||||
StaticBackup(requests::StaticbackupRequest),
|
||||
#[serde(rename = "bkpr-listincome")]
|
||||
BkprListIncome(requests::BkprlistincomeRequest),
|
||||
}
|
||||
|
||||
|
@ -162,6 +163,7 @@ pub enum Response {
|
|||
PreApproveKeysend(responses::PreapprovekeysendResponse),
|
||||
PreApproveInvoice(responses::PreapproveinvoiceResponse),
|
||||
StaticBackup(responses::StaticbackupResponse),
|
||||
#[serde(rename = "bkpr-listincome")]
|
||||
BkprListIncome(responses::BkprlistincomeResponse),
|
||||
}
|
||||
|
||||
|
@ -2612,7 +2614,7 @@ pub mod requests {
|
|||
type Response = super::responses::BkprlistincomeResponse;
|
||||
|
||||
fn method(&self) -> &str {
|
||||
"bkprlistincome"
|
||||
"bkpr-listincome"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -309,7 +309,7 @@ class RustGenerator(IGenerator):
|
|||
type Response = super::responses::{method.response.typename};
|
||||
|
||||
fn method(&self) -> &str {{
|
||||
"{method.name.lower()}"
|
||||
"{method.name_raw.lower()}"
|
||||
}}
|
||||
}}
|
||||
"""), numindent=1)
|
||||
|
@ -361,6 +361,8 @@ class RustGenerator(IGenerator):
|
|||
""")
|
||||
|
||||
for method in service.methods:
|
||||
if '-' in method.name_raw:
|
||||
self.write(f'#[serde(rename = "{method.name_raw.lower()}")]\n', numindent=1)
|
||||
self.write(f"{method.name}(requests::{method.request.typename}),\n", numindent=1)
|
||||
|
||||
self.write(f"""\
|
||||
|
@ -373,6 +375,8 @@ class RustGenerator(IGenerator):
|
|||
""")
|
||||
|
||||
for method in service.methods:
|
||||
if '-' in method.name_raw:
|
||||
self.write(f'#[serde(rename = "{method.name_raw.lower()}")]\n', numindent=1)
|
||||
self.write(f"{method.name}(responses::{method.response.typename}),\n", numindent=1)
|
||||
|
||||
self.write(f"""\
|
||||
|
|
|
@ -172,6 +172,7 @@ class Service:
|
|||
class Method:
|
||||
def __init__(self, name: str, request: Field, response: Field):
|
||||
self.name = name
|
||||
self.name_raw = name
|
||||
self.request = request
|
||||
self.response = response
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue