Skip to content

Commit

Permalink
fix(doc): object type check if patternProperties or properties (canon…
Browse files Browse the repository at this point in the history
…ical#5562)

Without this fix, rendered module documentation was not rendering the
following text for some objects:

Each object in **<key_name>** list supports the following keys:

See Rsyslog Config schema tab.
  • Loading branch information
blackboxsw committed Aug 2, 2024
1 parent 01aed71 commit f219b5b
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions doc/rtd/templates/module_property.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) -}}

0 comments on commit f219b5b

Please sign in to comment.