From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdKhC-0007c5-87 for qemu-devel@nongnu.org; Wed, 01 Apr 2015 11:36:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YdKh7-00078Y-Aj for qemu-devel@nongnu.org; Wed, 01 Apr 2015 11:36:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58619) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdKh7-00078I-5M for qemu-devel@nongnu.org; Wed, 01 Apr 2015 11:36:41 -0400 Message-ID: <551C1087.4060608@redhat.com> Date: Wed, 01 Apr 2015 09:36:39 -0600 From: Eric Blake MIME-Version: 1.0 References: <1427227433-5030-1-git-send-email-eblake@redhat.com> <1427227433-5030-2-git-send-email-eblake@redhat.com> <874mozq33w.fsf@blackfin.pond.sub.org> In-Reply-To: <874mozq33w.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="HAVUVm0wSsHUEPuL0mnX4QLKgtoT3fjcG" Subject: Re: [Qemu-devel] [PATCH v5 01/28] qapi: Document type-safety considerations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, lcapitulino@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, wenchaoqemu@gmail.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --HAVUVm0wSsHUEPuL0mnX4QLKgtoT3fjcG Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/01/2015 09:29 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 > [...] >> =3D=3D=3D Union types =3D=3D=3D >> >> + >> +A flat union definition specifies a complex type as its base, and >> +avoids nesting on the wire. In this case, the fields of the complex >> +type are included as top-level fields of the union dictionary in the >> +QMP wire format, and the 'discriminator' field must be the name of an= >> +enum-typed member of the base type. An example definition is: >> >> { 'type': 'BlockdevCommonOptions', 'data': { 'readonly': 'bool' } } >> { 'union': 'BlockdevOptions', > 'base': 'BlockdevCommonOptions', > 'data': { 'raw': 'RawOptions', > 'qcow2': 'Qcow2Options' } } >=20 > Where's 'discriminator'? Kevin already flagged this. I forgot to remove simple-with-base documentation in v5; it's already gone from my working copy of v6. > Resulting in this JSON object: >=20 > { "driver": "qcow2", > "readonly": false, > "backing-file": "/some/place/my-image", > "lazy-refcounts": true } >=20 > This actually matches the above example with the "data" wrapper peeled > off the variant part. Yep - with the bad intermediate stuff gone, the remaining stuff makes sen= se. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --HAVUVm0wSsHUEPuL0mnX4QLKgtoT3fjcG 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVHBCHAAoJEKeha0olJ0NqkdEH/1J6uR06Q+X+qXQVuGa1Xytq 52FS8rzLmFov+RXMzFfQborDgeSe0VXXlLFD5IOWu+nRJQQye45eD6e+wnEHgRyF 8Ea6YNcFKgFOCvwaxsqxJFVtVwxpfk9t7/Npa0rXsRu00LvuInH5Wj8K2yTZ1m5u QSDwm8R9wv2blxAxAde0fSvRiXl7/PneYNvzrmHq2VvCDksaoXbhfGZBQXsveRZw vK3Wm9ZsUsswMAfXxyS3AwxwQ+NBrWmN6C4Q8r7msfNYQ/12VQ9c0HJTPNx+UO7C 8U4s1ZraP5jb8X/vVX/+gglSkVF6c8cHGkArz80IvGKZJmAXV+hPePbSHGUXya0= =HTRX -----END PGP SIGNATURE----- --HAVUVm0wSsHUEPuL0mnX4QLKgtoT3fjcG--