aboutsummaryrefslogtreecommitdiff
path: root/tests/qapi-schema
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2022-03-21 17:42:41 +0100
committerMarkus Armbruster <armbru@redhat.com>2022-04-21 10:11:25 +0200
commita58069494ded1282c36b7fca8d67bf487c160983 (patch)
treec6de12c9b556a9b22d3d2bad9d99c6057402daa5 /tests/qapi-schema
parent9c125d17e9402c232c46610802e5931b3639d77b (diff)
downloadqemu-a58069494ded1282c36b7fca8d67bf487c160983.zip
qemu-a58069494ded1282c36b7fca8d67bf487c160983.tar.gz
qemu-a58069494ded1282c36b7fca8d67bf487c160983.tar.bz2
qapi-schema: support alternates with array type
Detect array types as alternate branches, and turn the JSON list into a QAPISchemaArrayType. Array types in an alternate are represented with QTYPE_QLIST in the type field. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20220321164243.200569-2-pbonzini@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/qapi-schema')
-rw-r--r--tests/qapi-schema/alternate-array.err2
-rw-r--r--tests/qapi-schema/alternate-array.json2
-rw-r--r--tests/qapi-schema/alternate-array.out18
3 files changed, 18 insertions, 4 deletions
diff --git a/tests/qapi-schema/alternate-array.err b/tests/qapi-schema/alternate-array.err
index b1aa1f4..e69de29 100644
--- a/tests/qapi-schema/alternate-array.err
+++ b/tests/qapi-schema/alternate-array.err
@@ -1,2 +0,0 @@
-alternate-array.json: In alternate 'Alt':
-alternate-array.json:5: 'data' member 'two' cannot be an array
diff --git a/tests/qapi-schema/alternate-array.json b/tests/qapi-schema/alternate-array.json
index f241aac..b878a2d 100644
--- a/tests/qapi-schema/alternate-array.json
+++ b/tests/qapi-schema/alternate-array.json
@@ -1,5 +1,3 @@
-# we do not allow array branches in alternates
-# TODO: should we support this?
{ 'struct': 'One',
'data': { 'name': 'str' } }
{ 'alternate': 'Alt',
diff --git a/tests/qapi-schema/alternate-array.out b/tests/qapi-schema/alternate-array.out
index e69de29..a657d85 100644
--- a/tests/qapi-schema/alternate-array.out
+++ b/tests/qapi-schema/alternate-array.out
@@ -0,0 +1,18 @@
+module ./builtin
+object q_empty
+enum QType
+ prefix QTYPE
+ member none
+ member qnull
+ member qnum
+ member qstring
+ member qdict
+ member qlist
+ member qbool
+module alternate-array.json
+object One
+ member name: str optional=False
+alternate Alt
+ tag type
+ case one: One
+ case two: intList