Subject: bug#72941: closed (Re: bug#72941: jsonrpc: Check if parameters are in line with the spec)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 12 Oct 2024 11:23:02 +0000

Your bug report

#72941: jsonrpc: Check if parameters are in line with the spec

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
72941: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=72941
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#72941: jsonrpc: Check if parameters are in line with the spec
From: Eli Zaretskii <[email-masked]>
To: Daniel Pettersson <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked]
Date: Sat, 12 Oct 2024 14:21:42 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Daniel Pettersson <[email-masked]>
> Cc: Felician Nemeth <[email-masked]>,  [email-masked],
>   [email-masked]
> Date: Sat, 28 Sep 2024 13:40:00 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > So do we want to close this as wontfix?
> 
> Yes, if anybody would clarify the variable type expectations
> documentation that would be great but all in all this is would be
> wontfix.
> 
> >> From: Felician Nemeth <[email-masked]>
> 
> >> Maybe when the server responds with an error to a jsonrpc-request, then
> >> jsonrpc.el could create an additional warning if the params of the
> >> request was not structured.  Or maybe it is too much work for a very
> >> small gain.
> 
> It seams like something that would be a bit of mess and I would expect
> that an sane jsonrpc server would include the reason for error in the
> error response.

No further comments, so I'm now closing this bug.

Subject: jsonrpc: Check if parameters are in line with the spec
From: Felician Nemeth <[email-masked]>
To: [email-masked]
Date: Sun, 01 Sep 2024 18:26:02 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

I failed to implement an LSP extension to Eglot, because my function
sent a required parameter as a string instead of an array containing a
single element: the string.  In the end it turned out that this was my
fault, because according to the JSON specification: "If present,
parameters for the rpc call MUST be provided as a Structured
value. Either by-position through an Array or by-name through an
Object."  https://www.jsonrpc.org/specification#parameter_structures

Would it be possible to extend jsonrpc.el to check the params argument
of jsonrpc-request, jsonrpc-notify, and jsonrpc-async-request whether it
is a structured value?  And if it is not, then guide the programmer to
the above URL with a warning.

Thank you.

(Background: <https://github.com/ocaml/ocaml-lsp/issues/1330>)