|
| 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 | +{% set depth = depth or 0 %} |
| 12 | +{# end context parameters #} |
| 13 | + |
| 14 | +{% set keys = schema.keywords %} |
| 15 | +{%- if not skip_headers %} |
| 16 | + |
| 17 | +{% if schema.title and schema.title | length > 0 %} |
| 18 | +**Title:** {{ schema.title }} |
| 19 | +{% endif %} |
| 20 | + |
| 21 | +{% set description = (schema | get_description) %} |
| 22 | +{% include "section_description.md" %} |
| 23 | + |
| 24 | +{{ schema | md_type_info_table | md_generate_table }} |
| 25 | + |
| 26 | +{% endif %} |
| 27 | + |
| 28 | +{% if schema.should_be_a_link(config) %} |
| 29 | +{% elif schema.refers_to -%} |
| 30 | + {%- with schema=schema.refers_to_merged, skip_headers=True, depth=depth -%} |
| 31 | + {% include "content.md" %} |
| 32 | + {% endwith %} |
| 33 | +{% else %} |
| 34 | + |
| 35 | + {# Combining: allOf, anyOf, oneOf, not #} |
| 36 | + {% if schema.kw_all_of %} |
| 37 | + {% with operator="allOf", title="All of(Requirement)", current_node=schema.kw_all_of, skip_required=True %} |
| 38 | + {% include "tabbed_section.md" %} |
| 39 | + {% endwith %} |
| 40 | + {% endif %} |
| 41 | + {% if schema.kw_any_of %} |
| 42 | + {% with operator="anyOf", title="Any of(Option)", current_node=schema.kw_any_of, skip_required=True %} |
| 43 | + {% include "tabbed_section.md" %} |
| 44 | + {% endwith %} |
| 45 | + {% endif %} |
| 46 | + {% if schema.kw_one_of %} |
| 47 | + {% with operator="oneOf", title="One of(Option)",current_node=schema.kw_one_of, skip_required=True %} |
| 48 | + {% include "tabbed_section.md" %} |
| 49 | + {% endwith %} |
| 50 | + {% endif %} |
| 51 | + {% if schema.kw_not %} |
| 52 | + {% include "section_not.md" %} |
| 53 | + {% endif %} |
| 54 | + |
| 55 | + {# Enum and const #} |
| 56 | + {% if schema.kw_enum -%} |
| 57 | + {% include "section_one_of.md" %} |
| 58 | + {%- endif %} |
| 59 | + {%- if schema.kw_const -%} |
| 60 | + Specific value: `{{ schema.kw_const.raw | python_to_json }}` |
| 61 | + {%- endif -%} |
| 62 | + |
| 63 | + {# Conditional subschema, or if-then-else section #} |
| 64 | + {% if schema.has_conditional %} |
| 65 | + {% with skip_headers=False, depth=depth+1 %} |
| 66 | + {% include "section_conditional_subschema.md" %} |
| 67 | + {% endwith %} |
| 68 | + {% endif %} |
| 69 | + |
| 70 | + {# Required properties that are not defined under "properties". They will only be listed #} |
| 71 | + {% include "section_undocumented_required_properties.md" %} |
| 72 | + |
| 73 | + {# Show the requested type(s) #} |
| 74 | + {{- schema | md_restrictions_table | md_generate_table -}} |
| 75 | + |
| 76 | + {# Show array restrictions #} |
| 77 | + {% if schema.type_name.startswith("array") %} |
| 78 | + {% include "section_array.md" %} |
| 79 | + {% endif %} |
| 80 | + |
| 81 | + {# Display examples #} |
| 82 | + {% set examples = schema.examples %} |
| 83 | + {% if examples %} |
| 84 | + {% include "section_examples.md" %} |
| 85 | + {% endif %} |
| 86 | + |
| 87 | + {# details of Properties, pattern properties, additional properties #} |
| 88 | + {% if schema.type_name == "object" %} |
| 89 | + {% with skip_required=False %} |
| 90 | + {% include "section_properties_details.md" %} |
| 91 | + {% endwith %} |
| 92 | + {% endif %} |
| 93 | +{% endif %} |
0 commit comments