]> git.proxmox.com Git - mirror_qemu.git/commit - tests/qapi-schema/alternate-any.json
qapi: Forbid 'any' inside an alternate
authorEric Blake <eblake@redhat.com>
Thu, 18 Feb 2016 06:48:17 +0000 (23:48 -0700)
committerMarkus Armbruster <armbru@redhat.com>
Fri, 19 Feb 2016 10:08:56 +0000 (11:08 +0100)
commit46534309e667fd860720f983c2c9aefe0354340d
treedef73f0f34e3c1fd607c2624d350312e2a0a0791
parent02a57ae32b08e8981b59979b80e682c9a153e94d
qapi: Forbid 'any' inside an alternate

The whole point of an alternate is to allow some type-safety while
still accepting more than one JSON type.  Meanwhile, the 'any'
type exists to bypass type-safety altogether.  The two are
incompatible: you can't accept every type, and still tell which
branch of the alternate to use for the parse; fix this to give a
sane error instead of a Python stack trace.

Note that other types that can't be alternate members are caught
earlier, by check_type().

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1455778109-6278-4-git-send-email-eblake@redhat.com>
[Commit message tweaked]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
scripts/qapi.py
tests/Makefile
tests/qapi-schema/alternate-any.err [new file with mode: 0644]
tests/qapi-schema/alternate-any.exit [new file with mode: 0644]
tests/qapi-schema/alternate-any.json [new file with mode: 0644]
tests/qapi-schema/alternate-any.out [new file with mode: 0644]