-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically omit "params" when it's empty #8
Comments
Thanks for the proposal, yeah that makes sense to me! If you're willing to put together a PR I'd be happy to merge. Please make sure to include tests! |
Makman2
added a commit
to Makman2/jsonrpc-base
that referenced
this issue
Dec 10, 2023
According to the JSON-RPC 2.0 Specification Section 4 (https://www.jsonrpc.org/specification#request_object) the "params" key may be omitted. Closes emlove#8
@emlove submitted 😉 |
emlove
pushed a commit
that referenced
this issue
Dec 11, 2023
According to the JSON-RPC 2.0 Specification Section 4 (https://www.jsonrpc.org/specification#request_object) the "params" key may be omitted. Closes #8
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello 😄
I would propose to remove the "params" field in
Request.serialize
not only when it'sNone
, but also when it's empty (i.e. when calling a method without any parameters).Motivations:
Performance in the form of smaller messages
For my particular use-case I have a server that does not support empty objects/dicts specifically (we have a C++ implementation without any argument-name mapping - only positional arguments work). I am currently doing a workaround by monkey-patching the implementation of serialize with:
I hope that would be a worthwile addition. I would gladly submit a PR if this is deemed useful 😄
EDIT:
Forgot to mention the actual reference that omitting "params" is actually possible according to the JSON-RPC spec.
The text was updated successfully, but these errors were encountered: