JairoDanielMT's picture
templates actualizados y blindados
0324409
{% extends "base.html.j2" %}
{% import "components.html.j2" as ui %}
{% block content %}
<header class="doc-header">
<h1>RESTlet 路 {{ doc.metadata.description or doc.metadata.script_type }}</h1>
<p class="doc-header-meta">
SuiteScript {{ doc.metadata.suitescript_version or "N/D" }}
</p>
<p class="muted">Documentaci贸n t茅cnica del servicio RESTlet.</p>
</header>
{{ ui.metadata_block(doc.metadata) }}
{{ ui.summary_block(doc.summary) }}
{# ============================================================
ENDPOINTS (GET, POST, PUT, DELETE...)
============================================================ #}
{% set endpoints = doc.endpoints or {} %}
{% if endpoints and endpoints is mapping %}
<div class="section">
<h2>Endpoints</h2>
{% for method, definition in endpoints.items() %}
{# Saltar si la IA devolvi贸 algo no v谩lido #}
{% if not (definition and definition is mapping) %}
<h3>{{ method|upper }}</h3>
<p>No se pudo interpretar la definici贸n de este endpoint.</p>
{% continue %}
{% endif %}
<h3>{{ method|upper }}</h3>
{% if definition.description %}
<p>{{ definition.description }}</p>
{% endif %}
{# ---------------------- INPUTS ---------------------- #}
{% set inputs = definition.inputs or {} %}
{% if inputs is mapping %}
{% if inputs.url_params %}
{{ ui.table_block("URL params", inputs.url_params, [
{"field": "name", "title": "Nombre"},
{"field": "description", "title": "Descripci贸n"},
{"field": "type", "title": "Tipo"}
]) }}
{% endif %}
{% if inputs.query_string %}
{{ ui.table_block("Query string", inputs.query_string, [
{"field": "name", "title": "Nombre"},
{"field": "description", "title": "Descripci贸n"},
{"field": "type", "title": "Tipo"}
]) }}
{% endif %}
{% if inputs.body_fields %}
{{ ui.table_block("Body", inputs.body_fields, [
{"field": "name", "title": "Nombre"},
{"field": "description", "title": "Descripci贸n"},
{"field": "type", "title": "Tipo"}
]) }}
{% endif %}
{% else %}
<p class="muted">Inputs no estructurados o no disponibles.</p>
{% endif %}
{# ---------------------- L脫GICA ---------------------- #}
{% if definition.logic %}
{{ ui.logic_block("L贸gica", definition.logic) }}
{% endif %}
{# ---------------------- OPERACIONES ---------------------- #}
{% if definition.record_operations %}
{{ ui.table_block("Operaciones sobre registros", definition.record_operations, [
{"field": "type", "title": "Operaci贸n"},
{"field": "recordType", "title": "Record"},
{"field": "details", "title": "Detalles"}
]) }}
{% endif %}
{% if definition.searches %}
{{ ui.table_block("B煤squedas", definition.searches, [
{"field": "id", "title": "ID"},
{"field": "filters", "title": "Filtros"},
{"field": "columns", "title": "Columnas"}
]) }}
{% endif %}
{# ---------------------- OUTPUT ---------------------- #}
{% if definition.output %}
{{ ui.logic_block("Salida", definition.output) }}
{% endif %}
{# ---------------------- VALIDACIONES ---------------------- #}
{% if definition.validations %}
{{ ui.list_block("Validaciones", definition.validations) }}
{% endif %}
{# ---------------------- SIDE EFFECTS ---------------------- #}
{% if definition.side_effects %}
{{ ui.list_block("Side effects", definition.side_effects) }}
{% endif %}
{% endfor %}
</div>
{% endif %}
{# VALIDACIONES GLOBALES #}
{% if doc.validations %}
{{ ui.list_block("Validaciones globales", doc.validations) }}
{% endif %}
{# ERRORES #}
{% if doc.errors %}
{% if doc.errors is mapping %}
{{ ui.list_block("Errores detectados", doc.errors.explicit_checks or []) }}
{{ ui.list_block("Manejo de excepciones", doc.errors.exception_handling or []) }}
{% else %}
{{ ui.table_block("Errores", doc.errors, [
{"field": "location", "title": "Ubicaci贸n"},
{"field": "description", "title": "Descripci贸n"},
{"field": "throws", "title": "Excepci贸n"}
]) }}
{% endif %}
{% endif %}
{# SIDE EFFECTS GLOBALES #}
{% if doc.side_effects %}
{{ ui.list_block("Side effects globales", doc.side_effects) }}
{% endif %}
{% endblock %}