{# Bengal OpenAPI Endpoint Page (Hero Template) ============================================= Full endpoint documentation with three-column explorer layout. The primary template for individual REST API endpoints. Context: - element: DocElement with OpenAPIEndpointMetadata - page: Page object - section: Section for navigation - site: Site instance - config: Config instance Kida Features: - {% match %} for HTTP method and status code styling - {% with %} for nil-resilient optional sections - {% cache %} for expensive response rendering - {% spaceless %} for compact badge output - Optional chaining (?.) and null coalescing (??) #} {% extends 'autodoc/openapi/layouts/explorer.html' %} {% from 'autodoc/openapi/_components.html' import endpoint_header, param_row, request_body as request_body_component, responses as responses_component, code_samples %} {% let meta = element?.typed_metadata ?? element?.metadata ?? {} %} {% let raw_meta = element?.metadata ?? {} %} {% let http_method = meta?.method ?? 'GET' %} {% let endpoint_path = meta?.path ?? '/' %} {% let operation_id = meta?.operation_id %} {% let summary = meta?.summary ?? element?.description ?? '' %} {% let is_deprecated = meta?.deprecated ?? false %} {% let parameters = meta?.parameters ?? () %} {% let request_body = meta?.request_body %} {% let sample_request_body = raw_meta?.request_body ?? request_body %} {% let responses = meta?.responses ?? () %} {% let raw_responses = raw_meta?.responses ?? responses %} {% let security = meta?.security ?? () %} {% let tags = meta?.tags ?? () %} {# Group parameters by location #} {% let path_params = parameters |> where('location', 'path') %} {% let query_params = parameters |> where('location', 'query') %} {% let header_params = parameters |> where('location', 'header') %} {% let cookie_params = parameters |> where('location', 'cookie') %} {% block api_left %} {# Cross-endpoint sidebar (epic criterion 4): render the full API navigation grouped by tag with the current endpoint highlighted. sidebar-nav.html reads `section` (for subsection tag groups) and `current_page` (for active state) from context, so capture the endpoint's own tag section first, then shadow `section` with the API root (which carries all tag subsections) for the include. IMPORTANT: Kida {% let %} reassignment at block level leaks across sibling blocks (api_header reuses `section`), so restore `section` to the tag section immediately after the include. #} {% let tag_section = section %} {% let current_page = page %} {% let section = section?.parent ?? section %} {% include 'autodoc/openapi/partials/sidebar-nav.html' %} {% let section = tag_section %} {# In-page navigation for the current endpoint's sections. #} {% end %} {% block api_header %}
{{ endpoint_path | highlight_path_params | safe }}