unum-cloud / ucall

Web Serving and Remote Procedure Calls at 50x lower latency and 70x higher bandwidth than FastAPI, implementing JSON-RPC & REST over io_uring ☎️
https://unum-cloud.github.io/ucall/
Apache License 2.0
1.13k stars 41 forks source link

Bug: object and array params not supported? #111

Open sdebionne opened 6 days ago

sdebionne commented 6 days ago

Describe the bug

When using a dict in the rpc params, the server returns {'jsonrpc': '2.0', 'id': 35342, 'error': {'code': -32602, 'message': 'Invalid method param(s).'}}.

Steps to reproduce

File server.py:

from ucall.posix import Server

server = Server(
    port=8545,
)

@server
def foo(person: dict):
    print(f"[RCV] prepare {person=}", flush=True)

server.run()

File client.py:

from ucall.client import Client

params = {
    "firstname": "John",
    "lastname": "Doe",
}

client = Client(port=8545)

res = client.foo(person=params)
print(f"[CLIENT] client.foo returned {res.data=}", flush=True)

Expected behavior

Should serialize/deserialize the dict from/to JSON.

UCall version

0.5.4

Operating System

Ubuntu 20.04

Hardware architecture

x86

Which interface are you using?

Official Python bindings

Which implementation are you using?

POSIX

Contact Details

No response

Is there an existing issue for this?

Code of Conduct

ashvardanian commented 6 days ago

Yes, such arguments are not supported in v0, but will be in v1.

sdebionne commented 5 days ago

I found this project that provides a python binding for simdjson: https://github.com/TkTech/pysimdjson If it works as advertised, that means not much work (or even simplification) should be necessary to support the full JSON data model.