From a0601f240a64881761ab0ee9a06e557b0331708b Mon Sep 17 00:00:00 2001 From: sundeep8967 Date: Thu, 27 Aug 2026 13:25:21 +0530 Subject: [PATCH] docs: fix module schema property description for object types When rendering schema property documentation, module_property.tmpl previously appended 'Each object in list supports the following keys:' to all properties with nested properties, regardless of whether the property was an array of items or a single object. Fix module_property.tmpl to distinguish between list types (items) and single object types (properties/patternProperties directly), rendering 'The object supports the following keys:' for object properties. Fixes GH-7046 --- doc/rtd/templates/module_property.tmpl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/rtd/templates/module_property.tmpl b/doc/rtd/templates/module_property.tmpl index 50875a968f9..d5e1c46127b 100644 --- a/doc/rtd/templates/module_property.tmpl +++ b/doc/rtd/templates/module_property.tmpl @@ -14,20 +14,22 @@ {{prefix ~ ' '}}{{ line }} {% endfor -%} {%- endmacro -%} -{% set ns = namespace(is_obj_type=false) -%} +{% set ns = namespace(is_obj_type=false, is_list_type=false) -%} {% for alt_schema in prop_cfg.get("oneOf", []) -%} {% if ('properties' in alt_schema or 'patternProperties' in alt_schema) %}{% set ns.is_obj_type = true -%}{% endif -%} {% endfor -%} {% if ('properties' in prop_cfg or 'patternProperties' in prop_cfg) %}{% set ns.is_obj_type = true -%}{% endif -%} {% for key, val in prop_cfg.get('items', {}).items() -%} - {% if key in ('properties', 'patternProperties') -%}{% set ns.is_obj_type = true -%}{% endif -%} + {% if key in ('properties', 'patternProperties') -%}{% set ns.is_obj_type = true -%}{% set ns.is_list_type = true -%}{% endif -%} {% if key == 'oneOf' -%} {% for oneOf in val -%} - {% if ('properties' in oneOf or 'patternProperties' in oneOf ) -%}{% set ns.is_obj_type = true -%}{% endif -%} + {% if ('properties' in oneOf or 'patternProperties' in oneOf ) -%}{% set ns.is_obj_type = true -%}{% set ns.is_list_type = true -%}{% endif -%} {% endfor -%} {% endif -%} {% endfor -%} -{% if ns.is_obj_type -%} +{% if ns.is_list_type -%} {% set description = description ~ " Each object in **" ~ name ~ "** list supports the following keys:" -%} +{% elif ns.is_obj_type -%} +{% set description = description ~ " The **" ~ name ~ "** object supports the following keys:" -%} {% endif -%} {{ print_prop(name, types, description, deprecated, changed, prefix ) -}}