Hi, I have an API defined by proc macro like this:
#[method(name = "foo")]
async fn foo(&self, parameter: FooParameter) -> Result<(), ErrorObjectOwned>;
Using a struct FooParameter because there are many parameters and I think it's a best practice for grouping parameters.
But now the client has to have one more level to construct the parameter:
var payload = {
jsonrpc: "2.0",
method: "foo",
params: {
parameter: {
name: "bob",
age: 40,
},
id: 1,
}
}
So is there a way to flatten the struct parameter when using proc macro to allow the client use like this:
var payload = {
jsonrpc: "2.0",
method: "foo",
params: {
name: "bob",
age: 40,
},
id: 1,
};
Hi, I have an API defined by proc macro like this:
Using a struct
FooParameterbecause there are many parameters and I think it's a best practice for grouping parameters.But now the client has to have one more level to construct the parameter:
So is there a way to flatten the struct parameter when using proc macro to allow the client use like this: