This commit is contained in:
seb
2026-10-09 19:02:15 +02:00
parent cd6879f3b7
commit ac10840fb6
42 changed files with 467 additions and 49 deletions

View File

@@ -361,7 +361,7 @@ function renderOperation(apiPath, method, operation) {
}
const sseEvents = operation['x-sse-events'];
if (Array.isArray(sseEvents) && sseEvents.length) {
if (apiPath !== '/events' && Array.isArray(sseEvents) && sseEvents.length) {
lines.push('## SSE Events');
lines.push('');
lines.push('The response is a `text/event-stream`. Events are emitted in order until the stream closes.');
@@ -773,12 +773,23 @@ function renderRoutesOverview(operations, title = 'Dash API Routes Overview') {
for (const op of operations) {
const params = summarizeOperationParams(op.operation, aliases);
const returns = summarizeOperationReturns(op.operation, aliases);
const hasSseResponse = Object.values(op.operation.responses || {}).some((response) =>
Object.hasOwn(response.content || {}, 'text/event-stream'),
);
const method = op.method.toUpperCase();
const summary = (op.summary || '').replace(/[\r\n]+/g, ' ').trim();
const heading = summary ? `${summary} — \`${method} ${op.path}\`` : `\`${method} ${op.path}\``;
lines.push(`#### ${heading}`);
lines.push(params === '—' ? '_none_' : `- Params: \`${params}\``);
lines.push(returns === '—' ? '_no response body_' : `- Returns: \`${returns}\``);
const sseEvents = op.operation['x-sse-events'];
if (hasSseResponse && Array.isArray(sseEvents) && sseEvents.length) {
lines.push('');
lines.push('- Events:');
for (const event of sseEvents) {
lines.push(` - \`${event.name}\`: \`${event.payload || '{}'}\``);
}
}
}
lines.push('');
return lines.join('\n');