mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
qapi: Check feature documentation against the schema
Commit f3ed93d545
"qapi: Allow documentation for features" neglected
to check documentation against the schema. Fix that: check them the
same way we check arguments.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191024110237.30963-20-armbru@redhat.com>
This commit is contained in:
parent
e4def78755
commit
e151941d1b
8 changed files with 27 additions and 51 deletions
|
@ -555,18 +555,31 @@ class QAPIDoc(object):
|
|||
self.args[member.name] = QAPIDoc.ArgSection(member.name)
|
||||
self.args[member.name].connect(member)
|
||||
|
||||
def connect_feature(self, feature):
|
||||
if feature.name not in self.features:
|
||||
raise QAPISemError(feature.info,
|
||||
"feature '%s' lacks documentation"
|
||||
% feature.name)
|
||||
self.features[feature.name] = QAPIDoc.ArgSection(feature.name)
|
||||
self.features[feature.name].connect(feature)
|
||||
|
||||
def check_expr(self, expr):
|
||||
if self.has_section('Returns') and 'command' not in expr:
|
||||
raise QAPISemError(self.info,
|
||||
"'Returns:' is only valid for commands")
|
||||
|
||||
def check(self):
|
||||
bogus = [name for name, section in self.args.items()
|
||||
if not section.member]
|
||||
if bogus:
|
||||
raise QAPISemError(
|
||||
self.info,
|
||||
"documented member%s '%s' %s not exist"
|
||||
% ("s" if len(bogus) > 1 else "",
|
||||
"', '".join(bogus),
|
||||
"do" if len(bogus) > 1 else "does"))
|
||||
|
||||
def check_args_section(args, info, what):
|
||||
bogus = [name for name, section in args.items()
|
||||
if not section.member]
|
||||
if bogus:
|
||||
raise QAPISemError(
|
||||
self.info,
|
||||
"documented member%s '%s' %s not exist"
|
||||
% ("s" if len(bogus) > 1 else "",
|
||||
"', '".join(bogus),
|
||||
"do" if len(bogus) > 1 else "does"))
|
||||
|
||||
check_args_section(self.args, self.info, 'members')
|
||||
check_args_section(self.features, self.info, 'features')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue