summaryrefslogtreecommitdiff
path: root/scripts/qapi.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/qapi.py')
-rw-r--r--scripts/qapi.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 2b43ad2f1b..bd00d01c0f 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -239,6 +239,11 @@ def check_union(expr, expr_info):
"type '%s'"
% (discriminator, base))
enum_define = find_enum(discriminator_type)
+ # Do not allow string discriminator
+ if not enum_define:
+ raise QAPIExprError(expr_info,
+ "Discriminator '%s' must be of enumeration "
+ "type" % discriminator)
# Check every branch
for (key, value) in members.items():