{%- macro restriction(inner_text, css_class_name, current_path, schema_path, span_id) -%} {%- set current_path = current_path ~ "/number" -%} {%- set _none = current_path | record_path_id(schema_path, span_id) -%} {%- set span_id = span_id -%}
{{ inner_text }}
{%- endmacro -%} {%- macro tabbed_section(operator, property, property_path, current_id, current_path) -%}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" -%} {{ add_description(property, current_id) }} {{ 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" -%} {{ add_description(property, current_id) }} {{ 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 -%} {{ add_description(property, current_id) }} {# 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 -%}
{%- if "if" in property and "then" in property -%}
{%- set has_else = "else" in property -%}
If the conditions in the "If" tab are respected, then the conditions in the "Then" tab should be respected. Otherwise, the conditions in the "Else" tab should be respected.
" ~ property.minLength ~ "
characters long", "min-length", current_path, property_path, current_id ~ "_minLength") }}
{%- endif -%}
{%- if "maxLength" in property -%}
{{ restriction("Must be at most " ~ property.maxLength ~ "
characters long", "max-length", current_path, property_path, current_id ~ "_maxLength") }}
{%- endif -%}
{%- endif -%}
{%- if type in ["integer", "number"] -%}
{%- set restriction_text = (property | get_numeric_restrictions_text("", "
")) -%}
{%- if restriction_text -%}
{{ restriction(property | get_numeric_restrictions_text("", "
"), "numeric", current_path, property_path, current_id ~ "_number") }}
{%- endif -%}
{%- endif -%}
{%- if type.startswith("array") -%}
{%- set current_path = current_path ~ "/array" -%}
{%- set array_id = current_id ~ "_array" -%}
{%- set _none = current_path | record_path_id(property_path, array_id) -%}
{%- if "minItems" in property -%}
{{ restriction("Must contain a minimum of " ~ property.minItems ~ "
items", "min-items", current_path, property_path, current_id ~ "_minItems") }}
{%- endif -%}
{%- if "maxItems" in property -%}
{{ restriction("Must contain a maximum of " ~ property.maxItems ~ "
items", "max-items", current_path, property_path, current_id ~ "_maxItems") }}
{%- endif -%}
{%- if "uniqueItems" in property and property.uniqueItems == True -%}
{{ restriction("All items must be unique", "unique-items", current_path, property_path, current_id ~ "_uniqueItems") }}
{%- endif -%}
{%- if "items" in property and property["items"] is mapping and property["items"] != {} -%}
{{ example | to_pretty_json }}