{% from "macro_restriction.html" import restriction with context %} {%- macro tabbed_section(operator, property, property_path, current_id, current_path) -%} {% include "tabbed_section.html" %} {%- endmacro -%} {%- macro subsection(expanded, current_id, parent, property_name, property, required_properties, property_path, current_path, named_property) -%} {% include "subsection.html" %} {%- endmacro -%} {%- macro content(current_id, property_name, property, property_path, current_path, named_property) -%} {%- set property, property_path, current_path, recursive_id = (property | resolve_ref(schema, property_path, current_path, link_to_reused_ref)) -%} {%- if recursive_id -%} {# There can be a description next to $ref, so let's display it #} {% include "section_description.html" %} {%- if recursive_id != current_path -%} Same definition as {{ recursive_id }} {%- else -%}
Recursive definition, see #/{{ recursive_id }}
{%- endif -%} {%- else -%} {# Handle having oneOf or allOf with only one condition #} {%- if "allOf" in property and (property["allOf"] | length) == 1 -%} {%- set current_path = current_path ~ "/allOf/0" -%} {% include "section_description.html" %} {{ content(current_id, property_name, property["allOf"][0], property_path, current_path, True) }} {%- elif "anyOf" in property and (property["anyOf"] | length) == 1 -%} {%- set current_path = current_path ~ "/anyOf/0" -%} {% include "section_description.html" %} {{ content(current_id, property_name, property["anyOf"][0], property_path, current_path, True) }} {%- else -%} {# Resolve type #} {%- set default, has_default = property | get_default -%} {%- set type = property | get_type_name -%} {# Display type #} {%- if not property is combining -%} Type: {{ type }} {%- endif -%} {%- if has_default -%} {{ " " }}Default: {{ default | python_to_json }} {%- endif -%} {% include "section_description.html" %} {# Handle actual requirement #} {%- if "allOf" in property -%} {%- set current_path = current_path ~ "/allOf" -%} {%- set tab_section_id = current_id ~ "_allOf" -%} {%- set _none = current_path | record_path_id(property_path, tab_section_id) -%}{{ property.const | python_to_json }}
{%- endif -%}
{%- if "pattern" in property -%}
{%- set current_path = current_path ~ "/pattern" -%}
{%- set pattern_id = current_id ~ "_pattern" -%}
{%- set _none = current_path | record_path_id(property_path, pattern_id) -%}
Must match regular expression: {{ property.pattern | escape }}
{%- endif -%}
{%- if not named_property -%}
Property name must match regular expression: {{ property_name | escape }}
{%- endif -%}
{# Conditional subschema, or if-then-else section #}
{%- if "if" in property and "then" in property -%}
{% include "section_conditional_subschema.html" %}
{%- endif -%}
{# Required properties that do not have a subsection. They will only be listed #}
{% include "section_undocumented_required_properties.html" %}
{# Show the requested type(s) #}
{% include "badge_type.html" %}
{# Display examples #}
{%- set examples = (property.get("examples") or []) -%}
{%- if examples -%}
{% include "section_examples.html" %}
{%- endif -%}
{% include "section_properties.html" %}
{%- endif -%}
{%- endif -%}
{%- endmacro -%}