{# Any #} {% if is_any(schema) %} any {# Const #} {% elif schema.const or "const" in schema.__fields_set__ %} constant {% with value=schema.const %} = {% include "schema/_value.html" %} {% endwith %} {# Enum #} {% elif schema.enum %} enum {% if not minimalize %} [ {% for option in schema.enum %} {{ option }} {% if loop.index < len(schema.enum) %} , {% endif %} {% endfor %} ] {% endif %} {% elif schema.title and schema.type == "object" and schema.properties %} {{ schema.title }} {# Schema Type #} {% elif schema.type %} {% if schema.type == "null" %} {{ schema.type }} {% else %} {{ schema.type }} {% endif %} {% if schema.type == "array" %} {# Schema Prefix Items #} {% if schema.prefix_items %} [ {% for prefix_schema in schema.prefix_items %} {% with schema=prefix_schema, schema_id=schema_id + id(loop.index0) + "-prefix-items" %} {% include "schema/schema.html" %} {% endwith %} {% if loop.index < len(schema.prefix_items) %} , {% endif %} {% endfor %} ] {% endif %} {# Schema Items #} {% if schema.items %} {% with schema=schema.items, schema_id=schema_id + "-items" %} [{% include "schema/schema.html" %}] {% endwith %} {% endif %} {# Max/Min Items #} {% if not minimalize %} {% if "min_items" in schema.__fields_set__ and "max_items" in schema.__fields_set__ %} {% if schema.min_items == schema.max_items %} {{ schema.min_items }} {{ "item" if schema.max_items == 1 else "items" }} {% else %} {{ schema.min_items }}-{{ schema.max_items }} items {% endif %} {% elif "min_items" in schema.__fields_set__ %} >={{ schema.min_items }} items {% elif "max_items" in schema.__fields_set__ %} <={{ schema.max_items }} items {% endif %} {% endif %} {% endif %} {# Schema Additional Properties #} {% if schema.additional_properties %} {% with schema=schema.additional_properties, schema_id=schema_id + "additional-properties" %} [{% include "schema/schema.html" %}] {% endwith %} {% elif schema.type == "object" and not schema.properties %} {% with schema=None, schema_id=schema_id + "-properties" %} [{% include "schema/schema.html" %}] {% endwith %} {% endif %} {# Schema Format/Pattern/Unique #} {% if schema.format %} {{ schema.format }} {% endif %} {% if schema.pattern %} {{ schema.pattern }} {% endif %} {% if schema.unique_items %} unique {% endif %} {% if schema.pattern %} {{ schema.pattern }} {% endif %} {# Max/Min #} {% if "minimum" in schema.__fields_set__ %} >={{ schema.minimum }} {% endif %} {% if "maximum" in schema.__fields_set__ %} <={{ schema.maximum }} {% endif %} {% if "multiple_of" in schema.__fields_set__ %} % {{ schema.multiple_of }} == 0 {% endif %} {# Schema Any Of #} {% elif schema.any_of %} {% for any_of_schema in schema.any_of %} {% with schema=any_of_schema, schema_id=schema_id + id(loop.index0) + "-any" %} {% include "schema/schema.html" %} {% endwith %} {% if loop.index < len(schema.any_of) %} | {% endif %} {% endfor %} {# Schema All Of #} {% elif schema.all_of %} {% for any_of_schema in schema.all_of %} {% with schema=any_of_schema, schema_id=schema_id + id(loop.index0) + "-all" %} {% include "schema/schema.html" %} {% endwith %} {% if loop.index < len(schema.all_of) %} & {% endif %} {% endfor %} {% endif %} {# If ref is still populated that indicates recursive schema. #} {% if schema.ref and not minimalize%} (Recursive) {% endif %}