Generate "empty" returns sections for undocumented returns values in the
inliner: the transmogrifier will pick these up and document them
specially.

Signed-off-by: John Snow <js...@redhat.com>
---
 docs/sphinx/qapidoc.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py
index b9fe2f476cb..5c65f3a8025 100644
--- a/docs/sphinx/qapidoc.py
+++ b/docs/sphinx/qapidoc.py
@@ -243,6 +243,14 @@ def _get_inline_target(
 
     # FIXME: Branches should be handled about here O:-)
 
+    # Generated "returns" statement.
+    if isinstance(ent, QAPISchemaCommand) and not any(
+        s.kind == QAPIDoc.Kind.RETURNS
+        for s in sections.partitions[DocRegion.OTHER]
+    ):
+        sect = QAPIDoc.Section(ent.info, QAPIDoc.Kind.RETURNS)
+        sections.partitions[DocRegion.OTHER].append(sect)
+
     # Return the combined list of sections.
     return list(sections)
 
-- 
2.48.1


Reply via email to