From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu46l-0005Gh-Bi for qemu-devel@nongnu.org; Tue, 02 Jul 2013 13:11:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uu46j-00051K-Rw for qemu-devel@nongnu.org; Tue, 02 Jul 2013 13:11:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58517) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu46j-00051F-JZ for qemu-devel@nongnu.org; Tue, 02 Jul 2013 13:11:13 -0400 Message-ID: <51D309AB.2040403@redhat.com> Date: Tue, 02 Jul 2013 11:11:07 -0600 From: Eric Blake MIME-Version: 1.0 References: <1371644677-11041-1-git-send-email-akong@redhat.com> <878v1pqak4.fsf@codemonkey.ws> <51D2F1B3.1080903@redhat.com> <87a9m4j3i7.fsf@codemonkey.ws> In-Reply-To: <87a9m4j3i7.fsf@codemonkey.ws> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2SHXDBNICBDBLWVOIEKGA" Subject: Re: [Qemu-devel] [PATCH] full introspection support for QMP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org, armbru@redhat.com, lcapitulino@redhat.com, qiaonuohan@cn.fujitsu.com, pbonzini@redhat.com, Amos Kong This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2SHXDBNICBDBLWVOIEKGA Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/02/2013 11:06 AM, Anthony Liguori wrote: >> Because qapi-schema.json requires further parsing. For example, how i= s >> a client supposed to know that '*foo':'int' means that there is an >> argument named 'foo' but it is optional? The rule of thumb with QMP i= s >> that if you have to post-process JSON output, then the JSON was not >> designed correctly. >=20 > Then we should fix qapi-schema.json. >=20 > One reasonable compromise would be: >=20 > { "command": "foo", "arguments": { "name": "str", "id": "int" }, > "optional": { "bar": "bool" } } >=20 > Then libvirt only has to test 'does command["optional"] contain key > "bar"' to test for an optional parameter. Yes, that might be a reasonable compromise - at least that way, the optional parameter names are listed directly, and libvirt doesn't have to probe every single parameter to name to see which begin with '*'. >=20 > Although to be honest, '*bar' in command['arguments'] is reasonable too= > IMHO. It may be reasonable, but it forces every QMP client to reimplement the post-processing step, rather than presenting the parameter names already in isolation. Food for thought - suppose we wanted to start expressing in the .json file what the default value is for any parameter that is listed as optional? What representation is most compact for that purpose, while still being valid JSON and not requiring QMP clients to reimplement post-processing? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2SHXDBNICBDBLWVOIEKGA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJR0wmrAAoJEKeha0olJ0Nq5p0IAIpCthXDlY4JlWyc8TC1F5sT apTf4dwd/FNplTAtrxicO5gFEwm2HHNbynyqrNH174jUCOE2AbK8FRMwNjJFc1UG EYMwa/uhDPoH0aABLfez5d0ucTLossJe6pY1w9or0YhjuR340DOJ8uIOVUYmRaD5 I8tGM1p/ZnApO8aqZrb6wmZCN6ZGFoEhKEYAl32RaRA1KbY/NiV8LHTiyAjDN+RU Ul86KJ98D9GibIEMGZcA0hILgnTzoXj73J8KBNibp19m+TRQTYwSUoCl3Ux2QWcP 3mq7ies7NlvZDGoSZ0lF5o8Sv07XiMr+RVxm+Oq3fFt5wo+vs8hDs2w4qasBlso= =g0OM -----END PGP SIGNATURE----- ------enig2SHXDBNICBDBLWVOIEKGA--