Skip to content

Commit 85eaef1

Browse files
committed
Distinguish live response verification
1 parent ab5a0e9 commit 85eaef1

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

site/assets/app.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ function confidenceLabel(value) {
198198
return CONFIDENCE_LABELS[value] ?? value;
199199
}
200200

201+
function operationConfidenceLabel(operation) {
202+
if (operation.response?.evidenceLevel === "live_response_confirmed") return "实测已确认";
203+
return confidenceLabel(operation.confidence);
204+
}
205+
201206
function operationResponseSchema(operation) {
202207
if (operation.response.schemaRef) return { $ref: `#/schemas/${operation.response.schemaRef}` };
203208
return operation.response.schema ?? { type: "object", additionalProperties: true };
@@ -467,7 +472,7 @@ function renderDoc(operation) {
467472
<div class="breadcrumbs"><span>WQ API</span><span>/</span><span>${escapeHtml(DOMAIN_LABELS[operation.domain] ?? operation.domain)}</span></div>
468473
<div class="operation-title">
469474
<h1>${escapeHtml(operation.summary)}</h1>
470-
<span class="confidence-stamp">${escapeHtml(confidenceLabel(operation.confidence))}</span>
475+
<span class="confidence-stamp">${escapeHtml(operationConfidenceLabel(operation))}</span>
471476
</div>
472477
<p class="operation-id">operationId: ${escapeHtml(operation.operationId)}</p>
473478
<div class="route-card">${methodBadge(operation.method)}<code>${escapeHtml(operation.path)}</code></div>
@@ -1223,4 +1228,4 @@ async function initialize() {
12231228

12241229
if (typeof document !== "undefined") initialize();
12251230

1226-
export { buildJavascript, buildPython, confidenceLabel, defaultOperationValues, evidenceLabel, expandSchemaRefs, helpTooltip, responseExampleBlock, responseExampleForOperation, sampleFromSchema, schemaBlock, schemaExampleBlock, sensitivityLabel, state, stripSchemaMetadata };
1231+
export { buildJavascript, buildPython, confidenceLabel, defaultOperationValues, evidenceLabel, expandSchemaRefs, helpTooltip, operationConfidenceLabel, responseExampleBlock, responseExampleForOperation, sampleFromSchema, schemaBlock, schemaExampleBlock, sensitivityLabel, state, stripSchemaMetadata };

site/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,6 @@ <h2 id="code-language-title">Python requests</h2>
107107

108108
<div id="toast" class="toast" role="status" aria-live="polite"></div>
109109
<noscript>此页面需要 JavaScript 才能读取接口目录并生成请求代码。</noscript>
110-
<script type="module" src="./assets/app.js?v=ec528b00345e"></script>
110+
<script type="module" src="./assets/app.js?v=70b2aab39536"></script>
111111
</body>
112112
</html>

tools/verify-site.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ check(
118118
&& css.includes(".schema-confidence")
119119
);
120120
const achievementsOperation = catalog.operations.find((operation) => operation.operationId === "getUserAchievements");
121+
const ordinaryHighConfidenceOperation = catalog.operations.find((operation) => operation.confidence === "high" && operation.response.evidenceLevel !== "live_response_confirmed");
121122
const achievementsExample = catalog.examples?.userAchievements;
122123
const achievementsExampleHtml = generator.responseExampleBlock(achievementsOperation?.response?.exampleRef);
123124
check(
@@ -167,6 +168,8 @@ check(
167168
&& generator.evidenceLabel("consumer_confirmed") === "消费代码确认"
168169
&& generator.sensitivityLabel("none") === "无额外敏感项"
169170
&& generator.sensitivityLabel("personal_data") === "个人数据"
171+
&& generator.operationConfidenceLabel(achievementsOperation) === "实测已确认"
172+
&& generator.operationConfidenceLabel(ordinaryHighConfidenceOperation) === "高可信度"
170173
&& !app.includes("operation.confidence)} confidence")
171174
&& !app.includes("example.evidenceLevel)}</strong>")
172175
);

0 commit comments

Comments
 (0)