diff options
author | Eric Blake <eblake@redhat.com> | 2016-02-17 23:48:17 -0700 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2016-02-19 11:08:56 +0100 |
commit | 46534309e667fd860720f983c2c9aefe0354340d (patch) | |
tree | def73f0f34e3c1fd607c2624d350312e2a0a0791 /tests/qapi-schema/alternate-any.json | |
parent | 02a57ae32b08e8981b59979b80e682c9a153e94d (diff) | |
download | qemu-46534309e667fd860720f983c2c9aefe0354340d.zip |
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>
Diffstat (limited to 'tests/qapi-schema/alternate-any.json')
-rw-r--r-- | tests/qapi-schema/alternate-any.json | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/qapi-schema/alternate-any.json b/tests/qapi-schema/alternate-any.json new file mode 100644 index 0000000000..e47a73a116 --- /dev/null +++ b/tests/qapi-schema/alternate-any.json @@ -0,0 +1,4 @@ +# we do not allow the 'any' type as an alternate branch +{ 'alternate': 'Alt', + 'data': { 'one': 'any', + 'two': 'int' } } |