zenrpc icon indicating copy to clipboard operation
zenrpc copied to clipboard

Ability to change parameter names

Open neetle opened this issue 7 years ago • 2 comments

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)

neetle avatar Dec 14 '17 00:12 neetle

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.

sergeyfast avatar Dec 14 '17 14:12 sergeyfast

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.

neetle avatar Dec 14 '17 19:12 neetle