tools: ynl: render operations-level fixed-header in docs
Subsystems (4)
PATCH v2 1/1 tools: ynl: render operations-level fixed-header in docs
From: Hangbin Liu <[email protected]>
The doc generator only rendered keys on each operations list entry, so operations-level fixed-header (the family default) never showed up in the generated HTML. Add a fallback to emit the default_fixed_header on ops that do not set their own.
After update, rt-route, rt-addr, rt-rule, rt-nexthop and ovs_* all shows the fixed header correctly in generated html doc.
---
I rebuilt the HTML documentation, the fixed-header shows up correctly
for rt-addr.yaml, rt-route.yaml, rt-rule.yaml, rt-nexthop.yaml, ovs_*.yaml
---
Changes in v2:
- Fix the issue in doc_generator instead of specific yaml file
- Link to v1: https://patch.msgid.link/[email protected]
--- tools/net/ynl/pyynl/lib/doc_generator.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
tools/net/ynl/pyynl/lib/doc_generator.py +14 -4
@@ -17,7 +17,7 @@ 2) YAML Netlink (YNL) doc generator: Generate docs from YAML data """ -from typing import Any, Dict, List +from typing import Any, Dict, List, Optional import yaml LINE_STR = '__lineno__'
@@ -181,7 +181,8 @@ class YnlDocGenerator: return "\n".join(lines) - def parse_operations(self, operations: List[Dict[str, Any]], namespace: str) -> str: + def parse_operations(self, operations: List[Dict[str, Any]], namespace: str, + default_fixed_header: Optional[str] = None) -> str: """Parse operations block""" preprocessed = ["name", "doc", "title", "do", "dump", "flags", "event"] linkable = ["fixed-header", "attribute-set"]
@@ -206,6 +207,13 @@ class YnlDocGenerator: if key in linkable: value = self.fmt.rst_ref(namespace, key, value) lines.append(self.fmt.rst_fields(key, value, 0)) + + # Show the family-wide default when the op does not set its own + if default_fixed_header and "fixed-header" not in operation: + value = self.fmt.rst_ref(namespace, "fixed-header", + default_fixed_header) + lines.append(self.fmt.rst_fields("fixed-header", value, 0)) + if 'flags' in operation: lines.append(self.fmt.rst_fields('flags', self.fmt.rst_list_inline(operation['flags'])))
@@ -367,8 +375,10 @@ class YnlDocGenerator: # Operations if "operations" in obj: lines.append(self.fmt.rst_subtitle("Operations")) - lines.append(self.parse_operations(obj["operations"]["list"], - family)) + lines.append(self.parse_operations( + obj["operations"]["list"], + family, + obj["operations"].get("fixed-header"))) # Multicast groups if "mcast-groups" in obj:
---
base-commit: c88fd6989aea9237a60a4859139a265bfb7ddc0b
change-id: 20261112-ynl_fixed_header-2d7acfcb54f8
Best regards,
Signature · 1 line
Hangbin Liu <[email protected]>
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Tue, 17 Nov 2026 11:16:40 +0800 you wrote:
From: Hangbin Liu <[email protected]>
The doc generator only rendered keys on each operations list entry, so operations-level fixed-header (the family default) never showed up in the generated HTML. Add a fallback to emit the
default_fixed_headeron ops that do not set their own.[...]
Here is the summary with links:
- [net-next,v2] tools: ynl: render operations-level fixed-header in docs
https://git.kernel.org/netdev/net-next/c/95efd17739e0
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html