fastapi-jsonrpc icon indicating copy to clipboard operation
fastapi-jsonrpc copied to clipboard

Support by-position parameters

Open hongqn opened this issue 2 years ago • 5 comments

According to JSON-RPC 2.0 Specification , the params field of request object may be either by-position (Array) or by-name (Object).

However the current implementation of fastapi-jsonrpc forces to use by-name parameter:

https://github.com/smagafurov/fastapi-jsonrpc/blob/1329be64ea635a844cdb529eaf31a1ac3055ae58/fastapi_jsonrpc/init.py#L369

This causes this awesome library is not usable in some circumstances. Can we support by-position parameters in the future version?

hongqn avatar Nov 21 '22 10:11 hongqn

Sure

spumer avatar Nov 21 '22 11:11 spumer

It was too hard to implement it in quick way. Need more refactoring

@hongqn can you tell what is the "some circumstances" in your cases?

spumer avatar Sep 15 '23 08:09 spumer

@hongqn can you tell what is the "some circumstances" in your cases?

Thanks for your response!

The situation I encountered is that in the EIP-4337 specification of Ethereum, the parameter of method eth_sendUserOperation is an array (with two items of different types though), not an object. I haven’t delved deeper into this yet, but it’s possible that there are other methods in Ethereum’s jsonrpc specification that also use arrays instead of objects to pass parameters.

hongqn avatar Sep 17 '23 08:09 hongqn

Do you have workaround for that case or you don't use fastapi-jsonrpc for this integration yet?

spumer avatar Sep 18 '23 07:09 spumer

I finally adopted a Typescript based solution 😅

hongqn avatar Sep 18 '23 12:09 hongqn