[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/20] qapi/parser: add undocumented stub members to all_sections
From: |
John Snow |
Subject: |
[PATCH 09/20] qapi/parser: add undocumented stub members to all_sections |
Date: |
Tue, 14 May 2024 17:57:28 -0400 |
This helps simplify the doc generator if it doesn't have to check for
undocumented members.
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/qapi/parser.py | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index b1794f71e12..3cd8e7ee295 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -740,8 +740,24 @@ def connect_member(self, member: 'QAPISchemaMember') ->
None:
raise QAPISemError(member.info,
"%s '%s' lacks documentation"
% (member.role, member.name))
- self.args[member.name] = QAPIDoc.ArgSection(
- self.info, '@' + member.name, 'member')
+
+ # Insert stub documentation section for missing member docs.
+ section = QAPIDoc.ArgSection(
+ self.info, f"@{member.name}", "member")
+ self.args[member.name] = section
+
+ # Determine where to insert stub doc.
+ index = 0
+ for i, sect in enumerate(self.all_sections):
+ # insert after these:
+ if sect.kind in ('intro-paragraph', 'member'):
+ index = i + 1
+ # but before these:
+ elif sect.kind in ('tagged', 'feature', 'outro-paragraph'):
+ index = i
+ break
+ self.all_sections.insert(index, section)
+
self.args[member.name].connect(member)
def connect_feature(self, feature: 'QAPISchemaFeature') -> None:
--
2.44.0
[PATCH 11/20] qapi/schema: add doc_visible property to QAPISchemaDefinition, John Snow, 2024/05/14
[PATCH 15/20] qapi: remove developer factoring comments from QAPI doc blocks, John Snow, 2024/05/14
[PATCH 12/20] qapi/source: allow multi-line QAPISourceInfo advancing, John Snow, 2024/05/14
[PATCH 16/20] qapi: rewrite StatsFilter comment, John Snow, 2024/05/14
[PATCH 14/20] qapi: fix non-compliant JSON examples, John Snow, 2024/05/14