mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
msggen: Disable grpc response -> json response temporarily
We use overrides that omit fields in some cases, which makes the conversion lossy. This also means that until we complete the mapping we can't reconvert back.
This commit is contained in:
parent
e7a96cac11
commit
d28815f7b8
BIN
cln-grpc/src/convert.rs
generated
BIN
cln-grpc/src/convert.rs
generated
Binary file not shown.
@ -221,11 +221,11 @@ fn test_listpeers() {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
let u: cln_rpc::model::ListpeersResponse = serde_json::from_value(j.clone()).unwrap();
|
let u: cln_rpc::model::ListpeersResponse = serde_json::from_value(j.clone()).unwrap();
|
||||||
let l: ListpeersResponse = u.into();
|
let _l: ListpeersResponse = u.into();
|
||||||
let u2: cln_rpc::model::ListpeersResponse = l.into();
|
//let u2: cln_rpc::model::ListpeersResponse = l.into();
|
||||||
let j2 = serde_json::to_value(u2).unwrap();
|
//let j2 = serde_json::to_value(u2).unwrap();
|
||||||
println!("{}", j);
|
println!("{}", j);
|
||||||
println!("{}", j2);
|
//println!("{}", j2);
|
||||||
// assert_eq!(j, j2); // TODO, still some differences to fix
|
// assert_eq!(j, j2); // TODO, still some differences to fix
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,10 +247,10 @@ fn test_getinfo() {
|
|||||||
"fees_collected_msat": "0msat", "lightning-dir": "/tmp/ltests-20irp76f/test_pay_variants_1/lightning-1/regtest",
|
"fees_collected_msat": "0msat", "lightning-dir": "/tmp/ltests-20irp76f/test_pay_variants_1/lightning-1/regtest",
|
||||||
"our_features": {"init": "8808226aa2", "node": "80008808226aa2", "channel": "", "invoice": "024200"}});
|
"our_features": {"init": "8808226aa2", "node": "80008808226aa2", "channel": "", "invoice": "024200"}});
|
||||||
let u: cln_rpc::model::GetinfoResponse = serde_json::from_value(j.clone()).unwrap();
|
let u: cln_rpc::model::GetinfoResponse = serde_json::from_value(j.clone()).unwrap();
|
||||||
let g: GetinfoResponse = u.into();
|
let _g: GetinfoResponse = u.into();
|
||||||
let u2: cln_rpc::model::GetinfoResponse = g.into();
|
//let u2: cln_rpc::model::GetinfoResponse = g.into();
|
||||||
let j2 = serde_json::to_value(u2).unwrap();
|
//let j2 = serde_json::to_value(u2).unwrap();
|
||||||
assert_eq!(j, j2);
|
//assert_eq!(j, j2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -412,7 +412,9 @@ class GrpcUnconverterGenerator(GrpcConverterGenerator):
|
|||||||
"""
|
"""
|
||||||
def generate(self, service: Service):
|
def generate(self, service: Service):
|
||||||
self.generate_requests(service)
|
self.generate_requests(service)
|
||||||
self.generate_responses(service)
|
|
||||||
|
# TODO Temporarily disabled since the use of overrides is lossy
|
||||||
|
# self.generate_responses(service)
|
||||||
|
|
||||||
def generate_composite(self, prefix, field: CompositeField) -> None:
|
def generate_composite(self, prefix, field: CompositeField) -> None:
|
||||||
# First pass: generate any sub-fields before we generate the
|
# First pass: generate any sub-fields before we generate the
|
||||||
@ -437,6 +439,9 @@ class GrpcUnconverterGenerator(GrpcConverterGenerator):
|
|||||||
|
|
||||||
for f in field.fields:
|
for f in field.fields:
|
||||||
name = f.normalized()
|
name = f.normalized()
|
||||||
|
if overrides.get(f.path, "") is None:
|
||||||
|
continue
|
||||||
|
|
||||||
if isinstance(f, ArrayField):
|
if isinstance(f, ArrayField):
|
||||||
typ = f.itemtype.typename
|
typ = f.itemtype.typename
|
||||||
mapping = {
|
mapping = {
|
||||||
|
Loading…
Reference in New Issue
Block a user