Message ID | 20171002152552.27999-10-armbru@redhat.com |
---|---|
State | New |
Headers | show |
Series | Command line QAPIfication | expand |
On Mon, Oct 2, 2017 at 5:25 PM, Markus Armbruster <armbru@redhat.com> wrote: > Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> > --- > scripts/qapi.py | 13 +++++-------- > 1 file changed, 5 insertions(+), 8 deletions(-) > > diff --git a/scripts/qapi.py b/scripts/qapi.py > index 208010c241..8f9c5666bd 100644 > --- a/scripts/qapi.py > +++ b/scripts/qapi.py > @@ -629,8 +629,7 @@ def add_name(name, info, meta, implicit=False): > all_names[name] = meta > > > -def check_type(info, source, value, allow_array=False, > - allow_dict=False, allow_optional=False, > +def check_type(info, source, value, allow_array=False, allow_dict=False, > allow_metas=[]): > global all_names > > @@ -686,7 +685,7 @@ def check_command(expr, info): > if boxed: > args_meta += ['union', 'alternate'] > check_type(info, "'data' for command '%s'" % name, > - expr.get('data'), allow_dict=not boxed, allow_optional=True, > + expr.get('data'), allow_dict=not boxed, > allow_metas=args_meta) > returns_meta = ['union', 'struct'] > if name in returns_whitelist: > @@ -704,8 +703,7 @@ def check_event(expr, info): > if boxed: > meta += ['union', 'alternate'] > check_type(info, "'data' for event '%s'" % name, > - expr.get('data'), allow_dict=not boxed, allow_optional=True, > - allow_metas=meta) > + expr.get('data'), allow_dict=not boxed, allow_metas=meta) > > > def check_union(expr, info): > @@ -728,8 +726,7 @@ def check_union(expr, info): > else: > # The object must have a string or dictionary 'base'. > check_type(info, "'base' for union '%s'" % name, > - base, allow_dict=True, allow_optional=True, > - allow_metas=['struct']) > + base, allow_dict=True, allow_metas=['struct']) > if not base: > raise QAPISemError(info, "Flat union '%s' must have a base" > % name) > @@ -843,7 +840,7 @@ def check_struct(expr, info): > members = expr['data'] > > check_type(info, "'data' for struct '%s'" % name, members, > - allow_dict=True, allow_optional=True) > + allow_dict=True) > check_type(info, "'base' for struct '%s'" % name, expr.get('base'), > allow_metas=['struct']) > > -- > 2.13.6 > >
diff --git a/scripts/qapi.py b/scripts/qapi.py index 208010c241..8f9c5666bd 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -629,8 +629,7 @@ def add_name(name, info, meta, implicit=False): all_names[name] = meta -def check_type(info, source, value, allow_array=False, - allow_dict=False, allow_optional=False, +def check_type(info, source, value, allow_array=False, allow_dict=False, allow_metas=[]): global all_names @@ -686,7 +685,7 @@ def check_command(expr, info): if boxed: args_meta += ['union', 'alternate'] check_type(info, "'data' for command '%s'" % name, - expr.get('data'), allow_dict=not boxed, allow_optional=True, + expr.get('data'), allow_dict=not boxed, allow_metas=args_meta) returns_meta = ['union', 'struct'] if name in returns_whitelist: @@ -704,8 +703,7 @@ def check_event(expr, info): if boxed: meta += ['union', 'alternate'] check_type(info, "'data' for event '%s'" % name, - expr.get('data'), allow_dict=not boxed, allow_optional=True, - allow_metas=meta) + expr.get('data'), allow_dict=not boxed, allow_metas=meta) def check_union(expr, info): @@ -728,8 +726,7 @@ def check_union(expr, info): else: # The object must have a string or dictionary 'base'. check_type(info, "'base' for union '%s'" % name, - base, allow_dict=True, allow_optional=True, - allow_metas=['struct']) + base, allow_dict=True, allow_metas=['struct']) if not base: raise QAPISemError(info, "Flat union '%s' must have a base" % name) @@ -843,7 +840,7 @@ def check_struct(expr, info): members = expr['data'] check_type(info, "'data' for struct '%s'" % name, members, - allow_dict=True, allow_optional=True) + allow_dict=True) check_type(info, "'base' for struct '%s'" % name, expr.get('base'), allow_metas=['struct'])
Signed-off-by: Markus Armbruster <armbru@redhat.com> --- scripts/qapi.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)