qapi: add a dictionary form with 'name' key for enum members

Desugar the enum NAME form to { 'name': NAME }. This will allow to add
new enum members, such as 'if' in the following patch.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20181213123724.4866-7-marcandre.lureau@redhat.com>
Message-Id: <20181213123724.4866-8-marcandre.lureau@redhat.com>
Message-Id: <20181213123724.4866-9-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Harmless accidental move backed out, long line wrapped, patches
squashed]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Marc-André Lureau authored and Markus Armbruster committed 2018-12-13 19:20:11 +01:00
1 parent 7e80d48001
commit ea738b2168
12 files changed
+36 -14

No files matched your search

+1
View File
@@ -0,0 +1 @@
tests/qapi-schema/enum-bad-member.json:2: Member of enum 'MyEnum' requires a string name
+2
View File
@@ -0,0 +1,2 @@
# we reject any enum member that is not a string
{ 'enum': 'MyEnum', 'data': [ [ ] ] }
File renamed without changes.
@@ -0,0 +1,2 @@
tests/qapi-schema/enum-dict-member-unknown.json:2: Unknown key 'bad-key' in dictionary member of enum 'MyEnum'
Valid keys are 'name'.
@@ -0,0 +1 @@
1
@@ -0,0 +1,2 @@
# we reject any enum member that is not a string or a dict with 'name'
{ 'enum': 'MyEnum', 'data': [ { 'name': 'foo', 'bad-key': 'str' } ] }
Whitespace-only changes.
-1
View File
@@ -1 +0,0 @@
tests/qapi-schema/enum-dict-member.json:2: Member of enum 'MyEnum' requires a string name
-2
View File
@@ -1,2 +0,0 @@
# we reject any enum member that is not a string
{ 'enum': 'MyEnum', 'data': [ { 'value': 'str' } ] }