zenrpc
zenrpc copied to clipboard
Ability to change parameter names
Was wondering if there is currently any way to map parameter names to different names in RPC calls. i.e., having
{
"jsonrpc": "2.0",
"id": 123,
"method": "my.pets",
"params": {
"type": "cats"
}
}
map to
func (MyService) Pets(ctx context.Context, typ string)
Hi, can you describe case when it will be useful?
We are going to implement another case, when you can use one struct for all parameters instead of exploding it in method signature.
We've an external endpoint that currently uses a reserved word from golang as one of the method parameters (type).
If the struct implementation you mentioned lets you use json tags to map the parameters to fields, there should be no need to do anything else.