JairoDanielMT commited on
Commit
7b36b01
verified
1 Parent(s): cb369af

Update app/templates/RESTlet.html.j2

Browse files
Files changed (1) hide show
  1. app/templates/RESTlet.html.j2 +34 -39
app/templates/RESTlet.html.j2 CHANGED
@@ -4,39 +4,45 @@
4
  {% block content %}
5
 
6
  {# =========================
7
- VALIDACI脫N RA脥Z
8
  ========================= #}
9
- {% if not (doc and doc is mapping) %}
10
  <div class="alert alert-error">
11
- <strong>Error:</strong> El documento recibido no tiene una estructura v谩lida.
12
  </div>
13
  {% else %}
14
 
 
 
15
  <header class="doc-header">
16
  <h1>
17
- RESTlet 路 {{ doc.metadata.description if doc.metadata and doc.metadata.description else doc.metadata.script_type if doc.metadata else "Documento sin metadata" }}
 
 
 
 
 
18
  </h1>
19
  <p class="doc-header-meta">
20
- SuiteScript {{ doc.metadata.suitescript_version if doc.metadata else "N/D" }}
21
  </p>
22
  <p class="muted">Documentaci贸n t茅cnica del servicio RESTlet.</p>
23
  </header>
24
 
25
- {% if doc.metadata %}
26
- {{ ui.metadata_block(doc.metadata) }}
27
  {% else %}
28
  <p class="muted">No se proporcion贸 metadata.</p>
29
  {% endif %}
30
 
31
- {% if doc.summary %}
32
- {{ ui.summary_block(doc.summary) }}
33
  {% endif %}
34
 
35
  {# ============================================================
36
  ENDPOINTS
37
  ============================================================ #}
38
-
39
- {% set endpoints = doc.endpoints if doc.endpoints and doc.endpoints is mapping else {} %}
40
 
41
  <div class="section">
42
  <h2>Endpoints</h2>
@@ -44,13 +50,11 @@
44
  {% if endpoints|length == 0 %}
45
  <p class="muted">No se definieron endpoints.</p>
46
  {% else %}
47
-
48
  {% for method, definition in endpoints.items() %}
49
  <h3>{{ method|upper }}</h3>
50
 
51
  {% if not (definition and definition is mapping) %}
52
  <p class="muted">Definici贸n inv谩lida o no estructurada.</p>
53
- {% continue_if_false %} {# comentario l贸gico, no real #}
54
  {% else %}
55
 
56
  {% if definition.description %}
@@ -59,12 +63,10 @@
59
 
60
  {# ---------------- INPUTS ---------------- #}
61
  {% set inputs = definition.inputs if definition.inputs and definition.inputs is mapping else {} %}
62
-
63
  {% if inputs|length == 0 %}
64
  <p class="muted">No se definieron inputs.</p>
65
  {% else %}
66
-
67
- {% if inputs.url_params and inputs.url_params is sequence and inputs.url_params|length > 0 %}
68
  {{ ui.table_block("URL params", inputs.url_params, [
69
  {"field": "name", "title": "Nombre"},
70
  {"field": "description", "title": "Descripci贸n"},
@@ -72,7 +74,7 @@
72
  ]) }}
73
  {% endif %}
74
 
75
- {% if inputs.query_string and inputs.query_string is sequence and inputs.query_string|length > 0 %}
76
  {{ ui.table_block("Query string", inputs.query_string, [
77
  {"field": "name", "title": "Nombre"},
78
  {"field": "description", "title": "Descripci贸n"},
@@ -80,14 +82,13 @@
80
  ]) }}
81
  {% endif %}
82
 
83
- {% if inputs.body_fields and inputs.body_fields is sequence and inputs.body_fields|length > 0 %}
84
  {{ ui.table_block("Body", inputs.body_fields, [
85
  {"field": "name", "title": "Nombre"},
86
  {"field": "description", "title": "Descripci贸n"},
87
  {"field": "type", "title": "Tipo"}
88
  ]) }}
89
  {% endif %}
90
-
91
  {% endif %}
92
 
93
  {# ---------------- L脫GICA ---------------- #}
@@ -98,7 +99,7 @@
98
  {% endif %}
99
 
100
  {# ---------------- OPERACIONES ---------------- #}
101
- {% if definition.record_operations and definition.record_operations is sequence %}
102
  {{ ui.table_block("Operaciones sobre registros", definition.record_operations, [
103
  {"field": "type", "title": "Operaci贸n"},
104
  {"field": "recordType", "title": "Record"},
@@ -107,7 +108,7 @@
107
  {% endif %}
108
 
109
  {# ---------------- B脷SQUEDAS ---------------- #}
110
- {% if definition.searches and definition.searches is sequence and definition.searches|length > 0 %}
111
  {{ ui.table_block("B煤squedas", definition.searches, [
112
  {"field": "id", "title": "ID"},
113
  {"field": "filters", "title": "Filtros"},
@@ -123,43 +124,37 @@
123
  {% endif %}
124
 
125
  {# ---------------- VALIDACIONES ---------------- #}
126
- {% if definition.validations and definition.validations is sequence %}
127
  {{ ui.list_block("Validaciones", definition.validations) }}
128
  {% endif %}
129
 
130
  {# ---------------- SIDE EFFECTS ---------------- #}
131
- {% if definition.side_effects and definition.side_effects is sequence %}
132
  {{ ui.list_block("Side effects", definition.side_effects) }}
133
  {% endif %}
134
 
135
  {% endif %}
136
  {% endfor %}
137
-
138
  {% endif %}
139
  </div>
140
 
141
  {# ================= VALIDACIONES GLOBALES ================= #}
142
- {% if doc.validations and doc.validations is sequence %}
143
- {{ ui.list_block("Validaciones globales", doc.validations) }}
144
  {% endif %}
145
 
146
  {# ================= ERRORES ================= #}
147
- {% if doc.errors %}
148
- {% if doc.errors is sequence %}
149
- {{ ui.table_block("Errores", doc.errors, [
150
- {"field": "location", "title": "Ubicaci贸n"},
151
- {"field": "description", "title": "Descripci贸n"},
152
- {"field": "throws", "title": "Excepci贸n"}
153
- ]) }}
154
- {% elif doc.errors is mapping %}
155
- {{ ui.list_block("Errores detectados", doc.errors.explicit_checks or []) }}
156
- {{ ui.list_block("Manejo de excepciones", doc.errors.exception_handling or []) }}
157
- {% endif %}
158
  {% endif %}
159
 
160
  {# ================= SIDE EFFECTS GLOBALES ================= #}
161
- {% if doc.side_effects and doc.side_effects is sequence %}
162
- {{ ui.list_block("Side effects globales", doc.side_effects) }}
163
  {% endif %}
164
 
165
  {% endif %}
 
4
  {% block content %}
5
 
6
  {# =========================
7
+ VALIDACI脫N RA脥Z (WRAPPER)
8
  ========================= #}
9
+ {% if not (doc and doc is mapping and doc.doc and doc.doc is mapping) %}
10
  <div class="alert alert-error">
11
+ <strong>Error:</strong> El payload recibido no cumple la estructura esperada (doc, job_id, output).
12
  </div>
13
  {% else %}
14
 
15
+ {% set document = doc.doc %}
16
+
17
  <header class="doc-header">
18
  <h1>
19
+ RESTlet 路
20
+ {{ document.metadata.description
21
+ if document.metadata and document.metadata.description
22
+ else document.metadata.script_type
23
+ if document.metadata
24
+ else "Documento sin metadata" }}
25
  </h1>
26
  <p class="doc-header-meta">
27
+ SuiteScript {{ document.metadata.suitescript_version if document.metadata else "N/D" }}
28
  </p>
29
  <p class="muted">Documentaci贸n t茅cnica del servicio RESTlet.</p>
30
  </header>
31
 
32
+ {% if document.metadata %}
33
+ {{ ui.metadata_block(document.metadata) }}
34
  {% else %}
35
  <p class="muted">No se proporcion贸 metadata.</p>
36
  {% endif %}
37
 
38
+ {% if document.summary %}
39
+ {{ ui.summary_block(document.summary) }}
40
  {% endif %}
41
 
42
  {# ============================================================
43
  ENDPOINTS
44
  ============================================================ #}
45
+ {% set endpoints = document.endpoints if document.endpoints and document.endpoints is mapping else {} %}
 
46
 
47
  <div class="section">
48
  <h2>Endpoints</h2>
 
50
  {% if endpoints|length == 0 %}
51
  <p class="muted">No se definieron endpoints.</p>
52
  {% else %}
 
53
  {% for method, definition in endpoints.items() %}
54
  <h3>{{ method|upper }}</h3>
55
 
56
  {% if not (definition and definition is mapping) %}
57
  <p class="muted">Definici贸n inv谩lida o no estructurada.</p>
 
58
  {% else %}
59
 
60
  {% if definition.description %}
 
63
 
64
  {# ---------------- INPUTS ---------------- #}
65
  {% set inputs = definition.inputs if definition.inputs and definition.inputs is mapping else {} %}
 
66
  {% if inputs|length == 0 %}
67
  <p class="muted">No se definieron inputs.</p>
68
  {% else %}
69
+ {% if inputs.url_params %}
 
70
  {{ ui.table_block("URL params", inputs.url_params, [
71
  {"field": "name", "title": "Nombre"},
72
  {"field": "description", "title": "Descripci贸n"},
 
74
  ]) }}
75
  {% endif %}
76
 
77
+ {% if inputs.query_string %}
78
  {{ ui.table_block("Query string", inputs.query_string, [
79
  {"field": "name", "title": "Nombre"},
80
  {"field": "description", "title": "Descripci贸n"},
 
82
  ]) }}
83
  {% endif %}
84
 
85
+ {% if inputs.body_fields %}
86
  {{ ui.table_block("Body", inputs.body_fields, [
87
  {"field": "name", "title": "Nombre"},
88
  {"field": "description", "title": "Descripci贸n"},
89
  {"field": "type", "title": "Tipo"}
90
  ]) }}
91
  {% endif %}
 
92
  {% endif %}
93
 
94
  {# ---------------- L脫GICA ---------------- #}
 
99
  {% endif %}
100
 
101
  {# ---------------- OPERACIONES ---------------- #}
102
+ {% if definition.record_operations %}
103
  {{ ui.table_block("Operaciones sobre registros", definition.record_operations, [
104
  {"field": "type", "title": "Operaci贸n"},
105
  {"field": "recordType", "title": "Record"},
 
108
  {% endif %}
109
 
110
  {# ---------------- B脷SQUEDAS ---------------- #}
111
+ {% if definition.searches %}
112
  {{ ui.table_block("B煤squedas", definition.searches, [
113
  {"field": "id", "title": "ID"},
114
  {"field": "filters", "title": "Filtros"},
 
124
  {% endif %}
125
 
126
  {# ---------------- VALIDACIONES ---------------- #}
127
+ {% if definition.validations %}
128
  {{ ui.list_block("Validaciones", definition.validations) }}
129
  {% endif %}
130
 
131
  {# ---------------- SIDE EFFECTS ---------------- #}
132
+ {% if definition.side_effects %}
133
  {{ ui.list_block("Side effects", definition.side_effects) }}
134
  {% endif %}
135
 
136
  {% endif %}
137
  {% endfor %}
 
138
  {% endif %}
139
  </div>
140
 
141
  {# ================= VALIDACIONES GLOBALES ================= #}
142
+ {% if document.validations %}
143
+ {{ ui.list_block("Validaciones globales", document.validations) }}
144
  {% endif %}
145
 
146
  {# ================= ERRORES ================= #}
147
+ {% if document.errors %}
148
+ {{ ui.table_block("Errores", document.errors, [
149
+ {"field": "location", "title": "Ubicaci贸n"},
150
+ {"field": "description", "title": "Descripci贸n"},
151
+ {"field": "throws", "title": "Excepci贸n"}
152
+ ]) }}
 
 
 
 
 
153
  {% endif %}
154
 
155
  {# ================= SIDE EFFECTS GLOBALES ================= #}
156
+ {% if document.side_effects %}
157
+ {{ ui.list_block("Side effects globales", document.side_effects) }}
158
  {% endif %}
159
 
160
  {% endif %}