{# Structured values are laid out as nested lists, and the texts in them are rendered as Markdown. #}
{% macro render_value(value) -%}
{% if value is mapping %}
{% for key, item in value.items() %}
{{ key }}:
{{ render_value(item) }}
{% endfor %}
{% elif value is sequence and value is not string %}
{% for item in value %}
{{ render_value(item) }}
{% endfor %}
{% elif value is sameas true %}true
{% elif value is sameas false %}false
{% elif value is none %}
{% else %}
{{ value }}
{%- endif %}
{%- endmacro %}
{% set custom_props = datacontract.customProperties if datacontract.customProperties is defined and datacontract.customProperties is not callable else [] %}
{% if custom_props is mapping %}
{% set custom_props = custom_props.items() | list %}
{% set is_mapping = true %}
{% else %}
{% set is_mapping = false %}
{% endif %}
{% set has_props = (is_mapping and custom_props|length > 0) or (not is_mapping and custom_props is sequence and custom_props is not string and custom_props|length > 0) %}
{% if has_props %}
Custom Properties
This section covers other properties you may find in a data contract.
{% if is_mapping %}
{% for key, value in custom_props %}
{{ key }}
{{ render_value(value) }}
{% endfor %}
{% else %}
{% for prop in custom_props %}
{% if prop.property is defined %}
{{ prop.property }}
{% if prop.vendor is defined and prop.vendor %}
{{ prop.vendor }}
{% endif %}
{% if prop.description is defined and prop.description %}
ⓘ
{% endif %}
{% if prop.value is defined %}{{ render_value(prop.value) }}{% endif %}