Skip to content
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

RPC Response: error while deserializing response for missing jsonrpc version field #1045

Closed
gnapoli23 opened this issue Mar 15, 2023 · 2 comments · Fixed by #1046
Closed

Comments

@gnapoli23
Copy link
Contributor

gnapoli23 commented Mar 15, 2023

I was using the lib for interacting with a JSON-RPC server that does not provide the jsonrpc protocol version in its responses (actually it sets this field to null) and received an error in deserializing them.
Looking at sources, I saw that the Response struct defines the jsonrpc version field as required, while checking in the JSON-RPC 2.0 specification, this field is not mandatory but is actually optional.
Here the spec: JSON-RPC 2.0 Spec

@niklasad1
Copy link
Member

niklasad1 commented Mar 15, 2023

Hey,

I agree with your interpretation as all other fields are marked as REQUIRED thus a request without that "jsonrpc":"2.0" is according to the spec.

with a JSON-RPC server that does not provide the jsonrpc protocol version in its responses (actually it sets this field to null

"jsonrpc":null is not according to the spec,

jsonrpc
A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".

@gnapoli23
Copy link
Contributor Author

gnapoli23 commented Mar 15, 2023

"jsonrpc":null is not according to the spec,

jsonrpc
A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".

Yeah, correct, I meant "missing" :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants