{% from "macro_restriction.html" import restriction with context %} {%- macro tabbed_section(operator, current_node) -%} {% include "tabbed_section.html" %} {%- endmacro -%} {%- macro content(schema, description="") -%} {% set keys = schema.keywords %} {%- set description = (schema | get_description) if not description else description -%} {%- if schema.should_be_a_link(config) -%} {# There can be a description next to $ref, so let's display it. Fallback to description of referenced element #} {% include "section_description.html" %} Same definition as {{ schema.refers_to.link_name }} {%- elif schema.refers_to -%} {{ content(schema.refers_to_merged, description) }} {%- else -%} {# Handle having oneOf or allOf with only one condition #} {%- if schema.kw_all_of and (schema.kw_all_of.array_items | length) == 1 -%} {% include "section_description.html" %} {{ content(schema.kw_all_of.array_items[0]) }} {%- elif schema.kw_any_of and (schema.kw_any_of.array_items | length) == 1 -%} {% include "section_description.html" %} {{ content(schema.kw_any_of.array_items[0]) }} {%- else -%} {# Resolve type #} {%- set type_name = schema | get_type_name -%} {# Display type #} {%- if not schema is combining -%} Type: {{ type_name }} {%- endif -%} {%- set default_value = schema | get_default -%} {%- if default_value -%} {{ " " }}Default: {{ default_value }} {%- endif -%} {%- if schema.kw_additional_properties and schema.kw_additional_properties.literal == False -%} {{ " " }}No Additional Properties {%- endif -%} {% include "section_description.html" %} {# Combining: allOf, anyOf, oneOf, not #} {%- if schema.kw_all_of -%}
{{ schema.kw_const.literal | python_to_json }}
{%- endif -%}
{# Pattern (Regular Expression) #}
{%- if schema.kw_pattern -%}
Must match regular expression: {{ schema.kw_pattern.literal | escape }}
{%- endif -%}
{# Conditional subschema, or if-then-else section #}
{%- if schema.has_conditional -%}
{% include "section_conditional_subschema.html" %}
{%- endif -%}
{# Required properties that are not defined under "properties". They will only be listed #}
{% include "section_undocumented_required_properties.html" %}
{# Show the requested type(s) #}
{% include "badge_type.html" %}
{# Show array restrictions #}
{%- if type_name.startswith("array") -%}
{% include "section_array.html" %}
{%- endif -%}
{# Display examples #}
{%- set examples = schema.examples -%}
{%- if examples -%}
{% include "section_examples.html" %}
{%- endif -%}
{# Properties, pattern properties, additional properties #}
{%- for sub_property in schema.iterate_properties -%}
{% include "section_properties.html" %}
{%- endfor -%}
{%- endif -%}
{%- endif -%}
{%- endmacro -%}