summaryrefslogtreecommitdiff
path: root/tests/qapi-schema/qapi-schema-test.json
diff options
context:
space:
mode:
authorAnton Nefedov <anton.nefedov@virtuozzo.com>2018-06-18 11:40:05 +0300
committerMarkus Armbruster <armbru@redhat.com>2018-06-22 16:33:46 +0200
commit800877bb1639d38ffaebe312a37b61c66bb10c83 (patch)
tree766371f9d2bb317d702ed6c4317d9ae75a0bd67f /tests/qapi-schema/qapi-schema-test.json
parentfe170d8bfaa12d63117cad8707ac18c3b2f3bb8e (diff)
downloadqemu-800877bb1639d38ffaebe312a37b61c66bb10c83.zip
qapi: allow empty branches in flat unions
It often happens that just a few discriminator values imply extra data in a flat union. Existing checks did not make possible to leave other values uncovered. Such cases had to be worked around by either stating a dummy (empty) type or introducing another (subset) discriminator enumeration. Both options create redundant entities in qapi files for little profit. With this patch it is not necessary anymore to add designated union fields for every possible value of a discriminator enumeration. Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> Message-Id: <1529311206-76847-2-git-send-email-anton.nefedov@virtuozzo.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/qapi-schema/qapi-schema-test.json')
-rw-r--r--tests/qapi-schema/qapi-schema-test.json6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qapi-schema-test.json
index 46c7282945..7b59817f04 100644
--- a/tests/qapi-schema/qapi-schema-test.json
+++ b/tests/qapi-schema/qapi-schema-test.json
@@ -39,7 +39,7 @@
'*enum1': 'EnumOne' } } # intentional forward reference
{ 'enum': 'EnumOne',
- 'data': [ 'value1', 'value2', 'value3' ] }
+ 'data': [ 'value1', 'value2', 'value3', 'value4' ] }
{ 'struct': 'UserDefZero',
'data': { 'integer': 'int' } }
@@ -76,7 +76,9 @@
'discriminator': 'enum1',
'data': { 'value1' : 'UserDefA',
'value2' : 'UserDefB',
- 'value3' : 'UserDefB' } }
+ 'value3' : 'UserDefB'
+ # 'value4' defaults to empty
+ } }
{ 'struct': 'UserDefUnionBase',
'base': 'UserDefZero',