Marc-André Lureau <marcandre.lur...@redhat.com> writes: > check_type() will now accept a DICT { 'type': TYPENAME, 'if': ... } > instead of a TYPENAME. This is the case in various situations where > implicit object types are allowed such as commands/events arguments > and return type, base and branches of union & alternate.
Uh, do you mean where implicit object type are *not* allowed? > Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> > --- > scripts/qapi.py | 20 ++++++++++++++++---- > tests/qapi-schema/qapi-schema-test.json | 12 +++++++++--- > tests/qapi-schema/qapi-schema-test.out | 4 +++- > 3 files changed, 28 insertions(+), 8 deletions(-) > > diff --git a/scripts/qapi.py b/scripts/qapi.py > index df2a304e8f..15711f96fa 100644 > --- a/scripts/qapi.py > +++ b/scripts/qapi.py > @@ -696,7 +696,15 @@ def check_type(info, source, value, allow_array=False, > return > > if not allow_dict: > - raise QAPISemError(info, "%s should be a type name" % source) > + if isinstance(value, dict) and 'type' in value: > + check_type(info, source, value['type'], allow_array, > + allow_dict, allow_optional, allow_metas) > + if 'if' in value: > + check_if(value, info) > + check_unknown_keys(info, value, {'type', 'if'}) > + return > + else: > + raise QAPISemError(info, "%s should be a type name" % source) @allow_dict becomes a misnomer: dictionaries are now always allowed, but they have different meaning (implicit type vs. named type with additional attributes). Rename to @allow_implicit? > > if not isinstance(value, OrderedDict): > raise QAPISemError(info, [...]