1+ {% from "macro_restriction.html" import restriction with context %}
2+
3+ {%- macro tabbed_section(operator, current_node) -%}
4+ {% include "tabbed_section.html" %}
5+ {%- endmacro -%}
6+
7+ {%- macro content(schema, skip_headers=False) -%}
8+ {% set keys = schema.keywords %}
9+
10+ {# Resolve type #}
11+ {%- set type_name = schema.type_name -%}
12+
13+ {% if not skip_headers %}
14+ {%- if config.show_breadcrumbs -%}
15+ {%- include "breadcrumbs.html" -%}
16+ {%- endif -%}
17+
18+ {# Display type #}
19+ {%- if not schema is combining -%}
20+ < span class ="badge value-type "> Type: {{ type_name }}</ span >
21+ {%- endif -%}
22+
23+ {# Display default #}
24+ {%- set default_value = schema.default_value -%}
25+ {%- if default_value -%}
26+ {{ " " }}< span class ="badge default-value "> Default: {{ default_value }}</ span >
27+ {%- endif -%}
28+ < br />
29+
30+ {%- set description = (schema | get_description) -%}
31+ {%- include "section_description.html" -%}
32+ {%- endif -%}
33+
34+
35+ {%- if schema.should_be_a_link(config) -%}
36+ < a href ="#{{ schema.links_to.html_id }} " onclick ="anchorLink('{{ schema.links_to.html_id }}') " class ="ref-link "> Same definition as {{ schema.links_to.link_name }}</ a >
37+ {%- elif schema.refers_to -%}
38+ {{ content(schema.refers_to_merged, True) }}
39+ {%- else -%}
40+ {# Handle having oneOf or allOf with only one condition #}
41+ {%- if schema.kw_all_of and (schema.kw_all_of.array_items | length) == 1 -%}
42+ {{ content(schema.kw_all_of.array_items[0]) }}
43+ {%- elif schema.kw_any_of and (schema.kw_any_of.array_items | length) == 1 -%}
44+ {{ content(schema.kw_any_of.array_items[0]) }}
45+ {%- else -%}
46+ {%- if schema.explicit_no_additional_properties -%}
47+ {{ " " }}< span class ="badge no-additional "> No Additional Properties</ span >
48+ {%- endif -%}
49+
50+ {# Combining: allOf, anyOf, oneOf, not #}
51+ {%- if schema.kw_all_of -%}
52+ < div class ="all-of-value " id ="{{ schema.kw_all_of.html_id }} "> {{ tabbed_section("allOf", schema.kw_all_of) }}</ div >
53+ {%- endif -%}
54+ {%- if schema.kw_any_of -%}
55+ < div class ="any-of-value " id ="{{ schema.kw_any_of.html_id }} "> {{ tabbed_section("anyOf", schema.kw_any_of) }}</ div >
56+ {%- endif -%}
57+ {%- if schema.kw_one_of -%}
58+ < div class ="one-of-value " id ="{{ schema.kw_one_of.html_id }} "> {{ tabbed_section("oneOf", schema.kw_one_of) }}</ div >
59+ {%- endif -%}
60+ {%- if schema.kw_not -%}
61+ {% include "section_not.html" %}
62+ {%- endif -%}
63+
64+ {# Enum and const #}
65+ {%- if schema.kw_enum -%}
66+ < div class ="enum-value " id ="{{ schema.kw_enum.html_id }} ">
67+ < h4 > Must be one of:</ h4 >
68+ < ul class ="list-group ">
69+ {%- for enum_choice in schema.kw_enum.array_items -%}
70+ < li class ="list-group-item enum-item "> {{ enum_choice.literal | python_to_json }}</ li >
71+ {%- endfor -%}
72+ </ ul >
73+ </ div >
74+ {%- endif -%}
75+ {%- if schema.kw_const -%}
76+ < span class ="const-value " id ="{{ schema.kw_const.html_id }} "> Specific value: < code > {{ schema.kw_const.raw | python_to_json }}</ code > </ span >
77+ {%- endif -%}
78+
79+ {# Pattern (Regular Expression) #}
80+ {%- if schema.kw_pattern -%}
81+ < span class ="pattern-value " id ="{{ schema.kw_pattern.html_id }} "> Must match regular expression: < code > {{ schema.kw_pattern.literal | escape }}</ code > </ span >
82+ {%- endif -%}
83+
84+ {# Conditional subschema, or if-then-else section #}
85+ {%- if schema.has_conditional -%}
86+ {% include "section_conditional_subschema.html" %}
87+ {%- endif -%}
88+
89+ {# Required properties that are not defined under "properties". They will only be listed #}
90+ {% include "section_undocumented_required_properties.html" %}
91+
92+ {# Show the requested type(s) #}
93+ {% include "badge_type.html" %}
94+
95+ {# Show array restrictions #}
96+ {%- if type_name.startswith("array") -%}
97+ {% include "section_array.html" %}
98+ {%- endif -%}
99+
100+ {# Display examples #}
101+ {%- set examples = schema.examples -%}
102+ {%- if examples -%}
103+ {% include "section_examples.html" %}
104+ {%- endif -%}
105+
106+ {# Properties, pattern properties, additional properties #}
107+ {%- for sub_property in schema.iterate_properties -%}
108+ {# Custom modification to remove $ properties from documentation #}
109+ {%- if not sub_property.property_display_name.startswith("$") -%}
110+ {% include "section_properties.html" %}
111+ {%- endif -%}
112+ {%- endfor -%}
113+
114+ {%- endif -%}
115+ {%- endif -%}
116+ {%- endmacro -%}
0 commit comments