{% from "base/schema/json/macro_restriction.jinja2" import restriction with context %} {% from "base/macros.jinja2" import badge %} {% macro tabbed_section(operator, current_node) %} {% include "base/schema/json/tabbed_section.jinja2" %} {% endmacro %} {% macro content(schema, skip_headers=False) %} {% set keys = schema.keywords %} {# Resolve type #} {% set type_name = schema.type_name %} {% if not skip_headers %} {% if config.show_breadcrumbs %} {% include "base/schema/json/breadcrumbs.jinja2" %} {% endif %} {# Display type #} {% if not schema is combining %}
{{ badge("secondary", "Type: " + type_name) }}
{% endif %} {# Display default #} {% set default_value = schema.default_value %} {% if default_value %}
{{ badge("secondary", "Default: " + default_value) }}
{% endif %}
{% set description = (schema | get_description) %} {% include "base/schema/json/section_description.jinja2" %} {% endif %} {% if schema.should_be_a_link(config) %} Same definition as {{ schema.links_to.link_name }} {% elif schema.refers_to %} {{ content(schema.refers_to_merged, True) }} {% else %} {# Handle having oneOf or allOf with only one condition #} {% if schema.kw_all_of and (schema.kw_all_of.array_items | length) == 1 %} {{ content(schema.kw_all_of.array_items[0]) }} {% elif schema.kw_any_of and (schema.kw_any_of.array_items | length) == 1 %} {{ content(schema.kw_any_of.array_items[0]) }} {% else %} {% if schema.explicit_no_additional_properties %} {{ badge("info", "No Additional Properties") }} {% endif %} {# Combining: allOf, anyOf, oneOf, not #} {% if schema.kw_all_of %}
{{ tabbed_section("allOf", schema.kw_all_of) }}
{% endif %} {% if schema.kw_any_of %}
{{ tabbed_section("anyOf", schema.kw_any_of) }}
{% endif %} {% if schema.kw_one_of %}
{{ tabbed_section("oneOf", schema.kw_one_of) }}
{% endif %} {% if schema.kw_not %} {% include "base/schema/json/section_not.jinja2" %} {% endif %} {# Enum and const #} {% if schema.kw_enum %}

Must be one of:

{% endif %} {% if schema.kw_const %} Specific value: {{ schema.kw_const.raw | 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 "base/schema/json/section_conditional_subschema.jinja2" %} {% endif %} {# Required properties that are not defined under "properties". They will only be listed #} {% include "base/schema/json/section_undocumented_required_properties.jinja2" %} {# Show the requested type(s) #} {% include "base/schema/json/badge_type.jinja2" %} {# Show array restrictions #} {% if type_name.startswith("array") %} {% include "base/schema/json/section_array.jinja2" %} {% endif %} {# Display examples #} {% set examples = schema.examples %} {% if examples %} {% include "base/schema/json/section_examples.jinja2" %} {% endif %} {# Properties, pattern properties, additional properties #} {% for sub_property in schema.iterate_properties %} {% include "base/schema/json/section_properties.jinja2" %} {% endfor %} {% endif %} {% endif %} {% endmacro %}