From f2fcc80c75f56d7c174d9dc43ce5670318316a84 Mon Sep 17 00:00:00 2001 From: Chad Smith Date: Thu, 25 Jul 2024 16:00:30 -0600 Subject: [PATCH] fix(doc): object type check if patternProperties or properties (#5562) Without this fix, rendered module documentation was not rendering the following text for some objects: Each object in **** list supports the following keys: See Rsyslog Config schema tab. --- doc/rtd/templates/module_property.tmpl | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/doc/rtd/templates/module_property.tmpl b/doc/rtd/templates/module_property.tmpl index f429203c8f81..895a89565817 100644 --- a/doc/rtd/templates/module_property.tmpl +++ b/doc/rtd/templates/module_property.tmpl @@ -6,7 +6,17 @@ {{prefix ~ ' '}}{{ line }} {% endfor -%} {%- endmacro -%} -{% if prop_cfg.get('items', {}).get('type') == 'object' %} -{% set description = description ~ " Each object in **" ~ name ~ "** list supports the following keys:" %} -{% endif %} -{{ print_prop(name, types, description, prefix ) }} +{% set ns = namespace(is_obj_type=false) -%} +{% 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 == 'oneOf' -%} + {% for oneOf in val -%} + {% if ('properties' in oneOf or 'patternProperties' in oneOf ) -%}{% set ns.is_obj_type = true -%}{% endif -%} + {% endfor -%} + {% endif -%} +{% endfor -%} +{% if ns.is_obj_type -%} +{% set description = description ~ " Each object in **" ~ name ~ "** list supports the following keys:" -%} +{% endif -%} +{{ print_prop(name, types, description, prefix ) -}}