paritytech / jsonrpc

Rust JSON-RPC implementation
MIT License
791 stars 274 forks source link

Allow capital case on JSONRPC message #649

Closed MrCasCode closed 3 years ago

MrCasCode commented 3 years ago

Some providers send a non-standard typing, so add an alias to allow decoding capital version

tomusdrw commented 3 years ago

Hey @MrCasCode, thank you for the contribution. We are trying to implement the JSON-RPC specification strictly (see also https://github.com/paritytech/jsonrpc/issues/595, https://github.com/paritytech/jsonrpc/pull/448, https://github.com/paritytech/jsonrpc/issues/642) and the spec states:

All member names exchanged between the Client and the Server that are considered for matching of any kind should be considered to be case-sensitive. The terms function, method, and procedure can be assumed to be interchangeable.

Hence I'm going to close the PR without merging - adding support for arbitrary implementations that don't match the spec is not something we want to support long term - feel free to reach out to the providers you've mentioned and have them fix the member case.

Alternatively please consider implementing a more generic solution of non-strict mode, given in such mode we could support JSONRPC member I don't see a reason why JSONrpc or JsOnRpC should be rejected - i.e. we should ignore casing in members and also allow arbitrary extra members as described in #595.

I hope you'll understand the decision, but feel free to re-open or discuss further.