{# partials/body_accordion.html — Collapsible API CONFIG / TEST DATA accordion Context variables: api_config (str) — JSON string of API configuration original_test_data (str) — JSON string of test data test_type (str) — 'api' | 'ui' | 'data' | 'mixed' Filters: format_data — renders JSON/XML string as syntax-highlighted block format_json_viewer — renders interactive JSON viewer HTML from_json_safe — safely parses a JSON string to dict #} {% if test_type == "ui" %} {# empty: no accordion for UI tests #} {% else %} {# ---- Compute badge counts ---- #} {% set api_config_dict = api_config | default('{}', true) %} {% set test_data_dict = original_test_data | default('{}', true) %} {% if api_config_dict is string %} {% set api_config_dict = api_config_dict | from_json_safe({}) %} {% endif %} {% if test_data_dict is string %} {% set test_data_dict = test_data_dict | from_json_safe({}) %} {% endif %} {% set api_endpoints_count = (api_config_dict.get('api_endpoints', {}) | length) if api_config_dict is mapping else 0 %} {% set test_cases_count = (test_data_dict.get('TEST_CASES', []) | length) if test_data_dict is mapping else 0 %} {% set show_api = (test_type in ["api", "mixed"]) or (api_endpoints_count > 0) %} {% set show_test = (test_type in ["api", "data", "mixed"]) or (test_cases_count > 0) %} {% if show_api or show_test %}