From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#72941: jsonrpc: Check if parameters are in line with the spec Date: Mon, 02 Sep 2024 14:26:22 +0300 Message-ID: <8634mi9u01.fsf@gnu.org> References: <87bk17l4rp.fsf@betli.tmit.bme.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38928"; mail-complaints-to="usenet@ciao.gmane.io" Cc: daniel@dpettersson.net, 72941@debbugs.gnu.org To: Felician Nemeth , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 02 14:04:42 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sl5nV-0009q7-94 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 02 Sep 2024 14:04:41 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sl5mt-0002eL-RC; Mon, 02 Sep 2024 08:04:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sl5ms-0002dg-6F for bug-gnu-emacs@gnu.org; Mon, 02 Sep 2024 08:04:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sl5mr-0004oc-TL for bug-gnu-emacs@gnu.org; Mon, 02 Sep 2024 08:04:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-version:References:In-Reply-To:From:Date:To:Subject; bh=V8kXmNErWDAkR62+1aLkzd7b7SXQDUUxLKsduxjdBio=; b=neXEJywGeeRJwYd2semFiIdvn1W8W+hwJYckC6vG9sKmNgUk2wHyrwzVg/xBjaRvTImDJJ73E/8HNz9RdiglWXchnr2ovBc4ghTQ9Yz5oDPpbP4XLbcBBGH/md7gYWtFerLJnBe92Ljm9Qdg0k6T9+hzVsokY1l4dTULqDGXR51d9gsd6X9TUxT+IwsiQuBaTEbso+jB6FM8dcj1lmow/PElVYCjn96PmwpTw0sCHbIej6nSl1yNuuPgHKJLDKbPzD0CpqpmQdECBWogPcqgUhN7G0P45+uodNTtKu8ftWaJTZX+ybkAtz39oY9cQdUlhnVvkiioTOn/vcSdnJVviQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sl5nq-0000CS-CX for bug-gnu-emacs@gnu.org; Mon, 02 Sep 2024 08:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Sep 2024 12:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72941 X-GNU-PR-Package: emacs Original-Received: via spool by 72941-submit@debbugs.gnu.org id=B72941.1725278698749 (code B ref 72941); Mon, 02 Sep 2024 12:05:02 +0000 Original-Received: (at 72941) by debbugs.gnu.org; 2 Sep 2024 12:04:58 +0000 Original-Received: from localhost ([127.0.0.1]:46968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sl5nl-0000C1-Mq for submit@debbugs.gnu.org; Mon, 02 Sep 2024 08:04:58 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:60108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sl5nh-0000B6-Op for 72941@debbugs.gnu.org; Mon, 02 Sep 2024 08:04:54 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sl5CR-00074z-TD; Mon, 02 Sep 2024 07:26:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=V8kXmNErWDAkR62+1aLkzd7b7SXQDUUxLKsduxjdBio=; b=iCfvZayP7We9JBdD+AYi oSPNqZ11wwaShUOUcZfKIgV2r5X3QflhUP/h/ft/35/IEpxF1pEKgM+aYkDnJNW4vl8p/0yMLuJGl uFd9S8J2A8EpXa8vQzp8Fr3LBiTab1MSVUVtOh10XXcEMfQva9GZrPFOzN027JJtFqqzl3dysZUnT OBurCVaYwbDKfwFtI3GF+qTQfjJ7myMejlbbndFpflxGnn4PyzgCtdW4u/kOXV/3Sxo/N6ZudAfiV oY3+zHvPTM242Hj3WeMBVXcRnBWm7U0nbWNsItOvUUtNodTO8j0l7BlRCIbLuSJpLlrsnO0MWyr0g PNnNF5KqI22Tdg==; In-Reply-To: <87bk17l4rp.fsf@betli.tmit.bme.hu> (message from Felician Nemeth on Sun, 01 Sep 2024 18:26:02 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:291099 Archived-At: > Cc: Daniel Pettersson > From: Felician Nemeth > Date: Sun, 01 Sep 2024 18:26:02 +0200 > > 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: ) Adding João.