github.com/Racer159/jackal@v0.32.7-0.20240401174413-0bd2339e4f2e/hack/.templates/jsonschemaforhumans/content.md (about) 1 {# 2 content is a template and not a macro in md 3 because macro parameters are not through context 4 when rendering a template from the macro and it caused 5 serious problems when using recursive calls 6 mandatory context parameters: 7 schema 8 #} 9 {# context parameters default values #} 10 {% set skip_headers = skip_headers or False %} 11 {# end context parameters #} 12 13 {% set keys = schema.keywords %} 14 {%- if not skip_headers %} 15 16 {% if schema.title and schema.title | length > 0 %} 17 **Title:** {{ schema.title }} 18 {% endif %} 19 20 {% set description = (schema | get_description) %} 21 {% include "section_description.md" %} 22 23 {{ schema | md_type_info_table | md_generate_table }} 24 25 {% endif %} 26 27 {% if schema.should_be_a_link(config) %} 28 {% elif schema.refers_to -%} 29 {%- with schema=schema.refers_to_merged, skip_headers=True -%} 30 {% include "content.md" %} 31 {% endwith %} 32 {% else %} 33 34 {# Combining: allOf, anyOf, oneOf, not #} 35 {% if schema.kw_all_of %} 36 {% with operator="allOf", title="All of(Requirement)", current_node=schema.kw_all_of, skip_required=True %} 37 {% include "tabbed_section.md" %} 38 {% endwith %} 39 {% endif %} 40 {% if schema.kw_any_of %} 41 {% with operator="anyOf", title="Any of(Option)", current_node=schema.kw_any_of, skip_required=True %} 42 {% include "tabbed_section.md" %} 43 {% endwith %} 44 {% endif %} 45 {% if schema.kw_one_of %} 46 {% with operator="oneOf", title="One of(Option)",current_node=schema.kw_one_of, skip_required=True %} 47 {% include "tabbed_section.md" %} 48 {% endwith %} 49 {% endif %} 50 {% if schema.kw_not %} 51 {% include "section_not.md" %} 52 {% endif %} 53 54 {# Enum and const #} 55 {% if schema.kw_enum -%} 56 {% include "section_one_of.md" %} 57 {%- endif %} 58 {%- if schema.kw_const -%} 59 Specific value: `{{ schema.kw_const.raw | python_to_json }}` 60 {%- endif -%} 61 62 {# Conditional subschema, or if-then-else section #} 63 {% if schema.has_conditional %} 64 {% with skip_headers=False %} 65 {% include "section_conditional_subschema.md" %} 66 {% endwith %} 67 {% endif %} 68 69 {# Required properties that are not defined under "properties". They will only be listed #} 70 {% include "section_undocumented_required_properties.md" %} 71 72 {# Show the requested type(s) #} 73 {{- schema | md_restrictions_table | md_generate_table -}} 74 75 {# Show array restrictions #} 76 {% if schema.type_name.startswith("array") %} 77 {% include "section_array.md" %} 78 {% endif %} 79 80 {# Display examples #} 81 {% set examples = schema.examples %} 82 {% if examples %} 83 {% include "section_examples.md" %} 84 {% endif %} 85 86 {# details of Properties, pattern properties, additional properties #} 87 {% if schema.type_name == "object" %} 88 {% with skip_required=False %} 89 {% include "section_properties_details.md" %} 90 {% endwith %} 91 {% endif %} 92 {% endif %}