Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(openapi): complete the published contract metadata

Yudhi Armyndharis3f1ec61732e8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ec3a1ed80..1c73adfda 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
**Migration.** `addParticipants`/`removeParticipants`/`promoteParticipants`/`demoteParticipants` now return `ParticipantsResult` — a superset of the old type, so existing reads of `success`/`message` keep compiling. `ContactRecord.pushname` becomes `pushName` and `isBusiness` is gone; both were always empty. `sendProduct` returns `ProductMessageResponse { id }`.
- **A webhook a smart filter drops now leaves a trace** — a condition on a field the event's payload does not carry cannot match, so a `sender` filter suppressed every `message.ack`, `message.failed` and `message.reaction` while the dispatch logged nothing, emitted no metric and recorded nothing in the delivery-failure table, which only tracks deliveries that were attempted; suppression is now logged at debug with the payload fields that were actually available, and the interaction is documented.
- **Two webhook payload descriptions did not match what is sent** — `session.qr` was documented as carrying the raw QR string when both engines render it to a PNG data URL before the event is dispatched, and the filter field list did not say that its fields exist on only some message events.
+- **Ten gaps where the published contract described less than the API actually accepts or returns** — eleven operations carried a path template with no parameter to fill it, the plugin upload published no request body at all so the file it exists for was invisible, the statistics window selector was undocumented, the archived-media download and the config-UI route published a `200` with no media type while every sibling binary route declares one, five plugin operations returned a `PluginDto` the contract never named, and six nullable properties published as `type: object` — which also made the ranges declared beside two of them inert, since JSON Schema ignores `minimum`/`maximum` on a non-numeric type.
## [0.14.5] - 2026-08-08
diff --git a/openapi.json b/openapi.json
index cde44950d..6372e80c0 100644
--- a/openapi.json
+++ b/openapi.json
@@ -1674,7 +1674,17 @@
],
"responses": {
"200": {
- "description": "Rules in evaluation order: creation time, id as the same-second tiebreak."
+ "description": "Rules in evaluation order: creation time, id as the same-second tiebreak.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AutomationRuleResponseDto"
+ }
+ }
+ }
+ }
}
},
"summary": "List the session’s autoreply rules",
@@ -2647,7 +2657,15 @@
],
"responses": {
"200": {
- "description": "The archived media bytes, served as an attachment."
+ "description": "The archived media bytes, served as an attachment.",
+ "content": {
+ "application/octet-stream": {
+ "schema": {
+ "type": "string",
+ "format": "binary"
+ }
+ }
+ }
},
"404": {
"description": "Nothing archived for this message — archiving was off when it arrived, the message carries no media, the media was above the archive cap, retention has since cleared it, or the message was sent BY this account (only inbound media is archived)."
@@ -6132,7 +6150,23 @@
"/api/stats/messages": {
"get": {
"operationId": "StatsController_getMessageStats",
- "parameters": [],
+ "parameters": [
+ {
+ "name": "period",
+ "required": false,
+ "in": "query",
+ "description": "Time window for the returned series.",
+ "schema": {
+ "default": "24h",
+ "type": "string",
+ "enum": [
+ "24h",
+ "7d",
+ "30d"
+ ]
+ }
+ }
+ ],
"responses": {
"200": {
"description": "Message statistics with a time series for the requested period.",
@@ -6555,7 +6589,15 @@
"/api/sessions/{sessionId}/media/convert": {
"get": {
"operationId": "MediaController_conversionStatus",
- "parameters": [],
+ "parameters": [
+ {
+ "name": "sessionId",
+ "required": true,
+ "in": "path",
+ "description": "Session ID the API key must be authorized for",
+ "schema": {}
+ }
+ ],
"responses": {
"200": {
"description": "Reports whether conversion is switched on AND the ffmpeg binary can be run, so a client can decide between converting here and converting before it sends.",
@@ -6577,7 +6619,15 @@
"/api/sessions/{sessionId}/media/convert/voice": {
"post": {
"operationId": "MediaController_convertVoice",
- "parameters": [],
+ "parameters": [
+ {
+ "name": "sessionId",
+ "required": true,
+ "in": "path",
+ "description": "Session ID the API key must be authorized for",
+ "schema": {}
+ }
+ ],
"requestBody": {
"required": true,
"content": {
@@ -6618,7 +6668,15 @@
"/api/sessions/{sessionId}/media/convert/video": {
"post": {
"operationId": "MediaController_convertVideo",
- "parameters": [],
+ "parameters": [
+ {
+ "name": "sessionId",
+ "required": true,
+ "in": "path",
+ "description": "Session ID the API key must be authorized for",
+ "schema": {}
+ }
+ ],
"requestBody": {
"required": true,
"content": {
@@ -6890,7 +6948,17 @@
"parameters": [],
"responses": {
"200": {
- "description": "List of all plugins"
+ "description": "List of all plugins",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PluginDto"
+ }
+ }
+ }
+ }
}
},
"summary": "List all plugins",
@@ -6903,9 +6971,36 @@
"post": {
"operationId": "PluginsController_install",
"parameters": [],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "type": "object",
+ "required": [
+ "file"
+ ],
+ "properties": {
+ "file": {
+ "type": "string",
+ "format": "binary",
+ "description": "The plugin .zip package"
+ }
+ }
+ }
+ }
+ }
+ },
"responses": {
"201": {
- "description": "Plugin installed"
+ "description": "Plugin installed",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PluginDto"
+ }
+ }
+ }
},
"400": {
"description": "Invalid package"
@@ -6936,7 +7031,14 @@
},
"responses": {
"201": {
- "description": "Plugin installed"
+ "description": "Plugin installed",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PluginDto"
+ }
+ }
+ }
},
"400": {
"description": "Invalid URL, download failed, or invalid package"
@@ -6984,7 +7086,14 @@
],
"responses": {
"200": {
- "description": "Plugin details"
+ "description": "Plugin details",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PluginDto"
+ }
+ }
+ }
},
"404": {
"description": "Plugin not found"
@@ -7121,7 +7230,14 @@
],
"responses": {
"200": {
- "description": "Config UI HTML"
+ "description": "Config UI HTML",
+ "content": {
+ "text/html": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
},
"404": {
"description": "Plugin not found or has no config UI"
@@ -7256,7 +7372,14 @@
},
"responses": {
"201": {
- "description": "Plugin updated"
+ "description": "Plugin updated",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PluginDto"
+ }
+ }
+ }
},
"400": {
"description": "Invalid URL/package, id mismatch, or built-in"
@@ -7314,6 +7437,15 @@
"schema": {
"type": "string"
}
+ },
+ {
+ "name": "path",
+ "required": true,
+ "in": "path",
+ "description": "Provider-defined trailing path the plugin claims (may contain slashes).",
+ "schema": {
+ "example": "events/message"
+ }
}
],
"responses": {
@@ -7362,6 +7494,15 @@
"schema": {
"type": "string"
}
+ },
+ {
+ "name": "path",
+ "required": true,
+ "in": "path",
+ "description": "Provider-defined trailing path the plugin claims (may contain slashes).",
+ "schema": {
+ "example": "events/message"
+ }
}
],
"responses": {
@@ -7410,6 +7551,15 @@
"schema": {
"type": "string"
}
+ },
+ {
+ "name": "path",
+ "required": true,
+ "in": "path",
+ "description": "Provider-defined trailing path the plugin claims (may contain slashes).",
+ "schema": {
+ "example": "events/message"
+ }
}
],
"responses": {
@@ -7458,6 +7608,15 @@
"schema": {
"type": "string"
}
+ },
+ {
+ "name": "path",
+ "required": true,
+ "in": "path",
+ "description": "Provider-defined trailing path the plugin claims (may contain slashes).",
+ "schema": {
+ "example": "events/message"
+ }
}
],
"responses": {
@@ -7506,6 +7665,15 @@
"schema": {
"type": "string"
}
+ },
+ {
+ "name": "path",
+ "required": true,
+ "in": "path",
+ "description": "Provider-defined trailing path the plugin claims (may contain slashes).",
+ "schema": {
+ "example": "events/message"
+ }
}
],
"responses": {
@@ -7554,6 +7722,15 @@
"schema": {
"type": "string"
}
+ },
+ {
+ "name": "path",
+ "required": true,
+ "in": "path",
+ "description": "Provider-defined trailing path the plugin claims (may contain slashes).",
+ "schema": {
+ "example": "events/message"
+ }
}
],
"responses": {
@@ -7602,6 +7779,15 @@
"schema": {
"type": "string"
}
+ },
+ {
+ "name": "path",
+ "required": true,
+ "in": "path",
+ "description": "Provider-defined trailing path the plugin claims (may contain slashes).",
+ "schema": {
+ "example": "events/message"
+ }
}
],
"responses": {
@@ -8639,7 +8825,7 @@
"example": false
},
"maxReconnectAttempts": {
- "type": "object",
+ "type": "number",
"description": "Reconnect attempt cap; `null` means unlimited",
"example": 5,
"nullable": true
@@ -8660,13 +8846,13 @@
"type": "object",
"properties": {
"autoRejectCalls": {
- "type": "object",
+ "type": "boolean",
"description": "Auto-reject every incoming call as soon as it rings. The call.received event is still emitted first, so a webhook consumer sees the call regardless. Takes effect on the next incoming call — the session is not restarted.",
"example": true,
"nullable": true
},
"maxReconnectAttempts": {
- "type": "object",
+ "type": "number",
"description": "Cap on consecutive reconnect attempts (`0` disables reconnect entirely). Send `null` for unlimited, which is the default. Applies on the next session start, not to a reconnect sequence already in flight.",
"minimum": 0,
"maximum": 20,
@@ -8674,7 +8860,7 @@
"nullable": true
},
"reconnectBaseDelay": {
- "type": "object",
+ "type": "number",
"description": "Base delay of the reconnect backoff in milliseconds. Applies on the next session start, not to a reconnect sequence already in flight.",
"minimum": 1000,
"maximum": 300000,
@@ -9168,7 +9354,10 @@
},
"retryCount": {
"type": "number",
- "description": "Retry count"
+ "description": "Delivery attempts before the webhook is parked. Same range the create route enforces.",
+ "example": 3,
+ "minimum": 0,
+ "maximum": 5
}
}
},
@@ -9890,8 +10079,10 @@
"properties": {
"delayBetweenMessages": {
"type": "number",
- "description": "Delay between messages in ms (min: 1000, default: 3000)",
- "default": 3000
+ "description": "Delay between messages in ms.",
+ "default": 3000,
+ "minimum": 1000,
+ "maximum": 60000
},
"randomizeDelay": {
"type": "boolean",
@@ -13282,48 +13473,6 @@
"chatId"
]
},
- "InstallFromUrlDto": {
- "type": "object",
- "properties": {
- "url": {
- "type": "string",
- "description": "HTTPS URL of the plugin .zip to download and install. Plain http:// is rejected: the package is executable code, so it must be integrity-protected in transit (hosts on private networks remain subject to the SSRF guard). Optional content pinning: append `#sha256=<64 hex>` (fragment — never sent to the server; query params are ignored) to require the downloaded archive to match that digest; a mismatch fails the install."
- }
- },
- "required": [
- "url"
- ]
- },
- "PluginConfigDto": {
- "type": "object",
- "properties": {
- "config": {
- "type": "object",
- "description": "Plugin configuration object"
- }
- },
- "required": [
- "config"
- ]
- },
- "PluginSessionsDto": {
- "type": "object",
- "properties": {
- "sessions": {
- "description": "Sessions to activate the plugin for; ['*'] = all numbers, [] = none",
- "example": [
- "*"
- ],
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- },
- "required": [
- "sessions"
- ]
- },
"PluginDto": {
"type": "object",
"properties": {
@@ -13441,6 +13590,48 @@
"activeSessions"
]
},
+ "InstallFromUrlDto": {
+ "type": "object",
+ "properties": {
+ "url": {
+ "type": "string",
+ "description": "HTTPS URL of the plugin .zip to download and install. Plain http:// is rejected: the package is executable code, so it must be integrity-protected in transit (hosts on private networks remain subject to the SSRF guard). Optional content pinning: append `#sha256=<64 hex>` (fragment — never sent to the server; query params are ignored) to require the downloaded archive to match that digest; a mismatch fails the install."
+ }
+ },
+ "required": [
+ "url"
+ ]
+ },
+ "PluginConfigDto": {
+ "type": "object",
+ "properties": {
+ "config": {
+ "type": "object",
+ "description": "Plugin configuration object"
+ }
+ },
+ "required": [
+ "config"
+ ]
+ },
+ "PluginSessionsDto": {
+ "type": "object",
+ "properties": {
+ "sessions": {
+ "description": "Sessions to activate the plugin for; ['*'] = all numbers, [] = none",
+ "example": [
+ "*"
+ ],
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required": [
+ "sessions"
+ ]
+ },
"CreateInstanceDto": {
"type": "object",
"properties": {
@@ -13511,7 +13702,7 @@
"description": "Operator-chosen instance id (unique within the plugin)."
},
"sessionScope": {
- "type": "object",
+ "type": "string",
"description": "Session id the instance is scoped to, or null for all sessions.",
"nullable": true
},
@@ -13520,7 +13711,7 @@
"description": "Ingress HMAC secret. Masked ('***') on every read; plaintext returned only once on create/regenerate-secret."
},
"verifyToken": {
- "type": "object",
+ "type": "string",
"description": "Provider verify-token. Masked ('***') on reads when set; plaintext on create/regenerate-secret.",
"nullable": true
},
diff --git a/src/config/openapi-contract.spec.ts b/src/config/openapi-contract.spec.ts
new file mode 100644
index 000000000..19a1db487
--- /dev/null
+++ b/src/config/openapi-contract.spec.ts
@@ -0,0 +1,63 @@
+import * as fs from 'fs';
+import * as path from 'path';
+import type { OpenAPIObject } from '@nestjs/swagger';
+
+/**
+ * Structural invariants of the committed snapshot.
+ *
+ * `openapi:check` proves the file matches a fresh export; it cannot say whether either is correct.
+ * These assert properties the specification requires, so a regression fails here rather than in a
+ * consumer's generator.
+ */
+
+const OPERATION_KEYS = new Set(['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']);
+
+const snapshot = (): OpenAPIObject =>
+ JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'openapi.json'), 'utf8')) as OpenAPIObject;
+
+describe('openapi.json structural invariants', () => {
+ // OpenAPI 3.0 requires every template expression in a path to resolve to a declared path parameter,
+ // on the path item or on the operation. A route whose handler never binds the parameter — a
+ // class-level prefix nothing reads, or a wildcard read off the request — publishes the template with
+ // nothing to fill it, and a generated client has no argument for that segment.
+ it('every path template variable is declared as a path parameter', () => {
+ const doc = snapshot();
+ const undeclared: string[] = [];
+
+ for (const [route, item] of Object.entries(doc.paths)) {
+ const templated = [...route.matchAll(/\{([^}]+)\}/g)].map(match => match[1]);
+ if (!templated.length) continue;
+
+ const itemLevel = (item.parameters ?? [])
+ .filter(p => 'in' in p && p.in === 'path')
+ .map(p => ('name' in p ? p.name : ''));
+
+ for (const [method, operation] of Object.entries(item)) {
+ if (!OPERATION_KEYS.has(method)) continue;
+ const declared = new Set([
+ ...itemLevel,
+ ...((operation as { parameters?: { in?: string; name?: string }[] }).parameters ?? [])
+ .filter(p => p.in === 'path')
+ .map(p => p.name ?? ''),
+ ]);
+ for (const variable of templated) {
+ if (!declared.has(variable)) undeclared.push(`${method.toUpperCase()} ${route} → {${variable}}`);
+ }
+ }
+ }
+
+ expect(undeclared).toEqual([]);
+ });
+
+ it('every operation declares at least one response', () => {
+ const doc = snapshot();
+ const silent = Object.entries(doc.paths).flatMap(([route, item]) =>
+ Object.entries(item)
+ .filter(([method]) => OPERATION_KEYS.has(method))
+ .filter(([, operation]) => !Object.keys((operation as { responses?: object }).responses ?? {}).length)
+ .map(([method]) => `${method.toUpperCase()} ${route}`),
+ );
+
+ expect(silent).toEqual([]);
+ });
+});
diff --git a/src/modules/automation/automation-rule.controller.ts b/src/modules/automation/automation-rule.controller.ts
index 00dad5a55..70503aed5 100644
--- a/src/modules/automation/automation-rule.controller.ts
+++ b/src/modules/automation/automation-rule.controller.ts
@@ -30,6 +30,8 @@ export class AutomationRuleController {
@ApiResponse({
status: 200,
description: 'Rules in evaluation order: creation time, id as the same-second tiebreak.',
+ type: AutomationRuleResponseDto,
+ isArray: true,
})
async findAll(@Param('sessionId') sessionId: string): Promise<AutomationRuleResponseDto[]> {
return (await this.automationRules.findAll(sessionId)).map(rule => AutomationRuleResponseDto.fromEntity(rule));
diff --git a/src/modules/integration/dto/instance.dto.ts b/src/modules/integration/dto/instance.dto.ts
index 2667faf62..74f775973 100644
--- a/src/modules/integration/dto/instance.dto.ts
+++ b/src/modules/integration/dto/instance.dto.ts
@@ -97,6 +97,8 @@ export class InstanceView {
@ApiPropertyOptional({
description: 'Session id the instance is scoped to, or null for all sessions.',
nullable: true,
+ // `string | null` reduces to `Object` under emitDecoratorMetadata; declare the real type.
+ type: String,
})
sessionScope!: string | null;
@@ -109,6 +111,7 @@ export class InstanceView {
@ApiPropertyOptional({
description: "Provider verify-token. Masked ('***') on reads when set; plaintext on create/regenerate-secret.",
nullable: true,
+ type: String,
})
verifyToken!: string | null;
diff --git a/src/modules/integration/ingress.controller.ts b/src/modules/integration/ingress.controller.ts
index 61329fb7b..2612a088e 100644
--- a/src/modules/integration/ingress.controller.ts
+++ b/src/modules/integration/ingress.controller.ts
@@ -1,5 +1,5 @@
import { All, Controller, Param, Query, Req, Res, UseGuards } from '@nestjs/common';
-import { ApiTags, ApiOkResponse, ApiResponse } from '@nestjs/swagger';
+import { ApiTags, ApiOkResponse, ApiParam, ApiResponse } from '@nestjs/swagger';
import type { Request, Response } from 'express';
import { Public } from '../auth/decorators/auth.decorators';
import { IngressService } from './ingress.service';
@@ -28,6 +28,14 @@ export class IngressController {
// InstanceThrottlerGuard's onModuleInit for how it keeps its tier fully independent.
@UseGuards(InstanceThrottlerGuard)
@All(':pluginId/:instanceId/*path')
+ // The wildcard segment is part of the published path template, so it needs a parameter of its own —
+ // the handler reads it off the request rather than binding it, which leaves the document with a
+ // `{path}` placeholder nothing declares. Awkward to express, not impossible.
+ @ApiParam({
+ name: 'path',
+ description: 'Provider-defined trailing path the plugin claims (may contain slashes).',
+ example: 'events/message',
+ })
@ApiOkResponse({
description:
'GET verification challenge echo, or a duplicate delivery already persisted (idempotent re-delivery). Not the primary success path — see 202.',
diff --git a/src/modules/media/media.controller.ts b/src/modules/media/media.controller.ts
index 18a28a51e..d525ce4df 100644
--- a/src/modules/media/media.controller.ts
+++ b/src/modules/media/media.controller.ts
@@ -1,5 +1,5 @@
import { Body, Controller, Get, HttpCode, HttpStatus, Post } from '@nestjs/common';
-import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
+import { ApiOperation, ApiParam, ApiResponse, ApiTags } from '@nestjs/swagger';
import { ConversionStatusResponseDto, ConvertedMediaResponseDto } from './dto/media-response.dto';
import { MediaConversionService } from './media-conversion.service';
import { ConvertMediaDto } from './dto/convert-media.dto';
@@ -15,6 +15,10 @@ import { ApiKeyRole } from '../auth/entities/api-key.entity';
* unscoped, which would shut session-restricted keys out of a feature they need in order to send.
*/
@ApiTags('media')
+// Declared on the class because no handler binds the parameter — conversion needs no session id, only
+// the guard does (see above). Without this the published paths carry a `{sessionId}` template with no
+// parameter to fill it, which OpenAPI 3.0 does not allow and a generated client cannot satisfy.
+@ApiParam({ name: 'sessionId', description: 'Session ID the API key must be authorized for' })
@Controller('sessions/:sessionId/media')
export class MediaController {
constructor(private readonly mediaConversion: MediaConversionService) {}
diff --git a/src/modules/message/dto/bulk-message.dto.ts b/src/modules/message/dto/bulk-message.dto.ts
index 790c4259a..e0e88105a 100644
--- a/src/modules/message/dto/bulk-message.dto.ts
+++ b/src/modules/message/dto/bulk-message.dto.ts
@@ -106,7 +106,12 @@ class BulkMessageItemDto {
}
class BulkMessageOptionsDto {
- @ApiPropertyOptional({ description: 'Delay between messages in ms (min: 1000, default: 3000)', default: 3000 })
+ @ApiPropertyOptional({
+ description: 'Delay between messages in ms.',
+ default: 3000,
+ minimum: 1000,
+ maximum: 60000,
+ })
@IsOptional()
@IsNumber()
@Min(1000)
diff --git a/src/modules/message/message.controller.ts b/src/modules/message/message.controller.ts
index 2d3e362c3..71c2f8bf1 100644
--- a/src/modules/message/message.controller.ts
+++ b/src/modules/message/message.controller.ts
@@ -381,7 +381,11 @@ export class MessageController {
@ApiParam({ name: 'sessionId', description: 'Session ID' })
@ApiParam({ name: 'chatId', description: 'Chat ID containing the message' })
@ApiParam({ name: 'messageId', description: 'WhatsApp message ID whose media to download' })
- @ApiResponse({ status: 200, description: 'The archived media bytes, served as an attachment.' })
+ @ApiResponse({
+ status: 200,
+ description: 'The archived media bytes, served as an attachment.',
+ content: { 'application/octet-stream': { schema: { type: 'string', format: 'binary' } } },
+ })
@ApiResponse({
status: 404,
description:
diff --git a/src/modules/plugins/plugins.controller.ts b/src/modules/plugins/plugins.controller.ts
index 3ec8d2440..fab29eb0b 100644
--- a/src/modules/plugins/plugins.controller.ts
+++ b/src/modules/plugins/plugins.controller.ts
@@ -13,7 +13,7 @@ import {
UploadedFile,
} from '@nestjs/common';
import { FileInterceptor } from '@nestjs/platform-express';
-import { ApiTags, ApiOperation, ApiResponse, ApiConsumes } from '@nestjs/swagger';
+import { ApiTags, ApiOperation, ApiResponse, ApiConsumes, ApiBody } from '@nestjs/swagger';
import { PluginsService } from './plugins.service';
import { PluginDto, PluginConfigDto, PluginSessionsDto, InstallFromUrlDto } from './dto/plugin.dto';
import type { CatalogPlugin } from './catalog';
@@ -38,7 +38,7 @@ export class PluginsController {
@RequireRole(ApiKeyRole.ADMIN)
@RequireUnscopedKey()
@ApiOperation({ summary: 'List all plugins' })
- @ApiResponse({ status: 200, description: 'List of all plugins' })
+ @ApiResponse({ status: 200, description: 'List of all plugins', type: PluginDto, isArray: true })
findAll(): PluginDto[] {
return this.pluginsService.findAll();
}
@@ -48,8 +48,18 @@ export class PluginsController {
@RequireUnscopedKey()
@UseInterceptors(FileInterceptor('file', { limits: { fileSize: MAX_PLUGIN_UPLOAD_BYTES } }))
@ApiConsumes('multipart/form-data')
+ // @ApiConsumes only names the media type; without a body schema the upload this route exists for is
+ // invisible in the contract, and a generated client has no parameter to attach the file to.
+ @ApiBody({
+ required: true,
+ schema: {
+ type: 'object',
+ required: ['file'],
+ properties: { file: { type: 'string', format: 'binary', description: 'The plugin .zip package' } },
+ },
+ })
@ApiOperation({ summary: 'Install a plugin from an uploaded .zip package' })
- @ApiResponse({ status: 201, description: 'Plugin installed' })
+ @ApiResponse({ status: 201, description: 'Plugin installed', type: PluginDto })
@ApiResponse({ status: 400, description: 'Invalid package' })
@ApiResponse({ status: 409, description: 'Plugin already installed' })
install(@UploadedFile() file: { buffer?: Buffer }): PluginDto {
@@ -60,7 +70,7 @@ export class PluginsController {
@RequireRole(ApiKeyRole.ADMIN)
@RequireUnscopedKey()
@ApiOperation({ summary: 'Install a plugin by downloading its .zip from a URL (SSRF-guarded)' })
- @ApiResponse({ status: 201, description: 'Plugin installed' })
+ @ApiResponse({ status: 201, description: 'Plugin installed', type: PluginDto })
@ApiResponse({ status: 400, description: 'Invalid URL, download failed, or invalid package' })
@ApiResponse({ status: 409, description: 'Plugin already installed' })
async installFromUrl(@Body() dto: InstallFromUrlDto): Promise<PluginDto> {
@@ -82,7 +92,7 @@ export class PluginsController {
@RequireRole(ApiKeyRole.ADMIN)
@RequireUnscopedKey()
@ApiOperation({ summary: 'Get plugin by ID' })
- @ApiResponse({ status: 200, description: 'Plugin details' })
+ @ApiResponse({ status: 200, description: 'Plugin details', type: PluginDto })
@ApiResponse({ status: 404, description: 'Plugin not found' })
findOne(@Param('id') id: string): PluginDto {
return this.pluginsService.findOne(id);
@@ -127,7 +137,13 @@ export class PluginsController {
@Header('Content-Security-Policy', 'sandbox')
@Header('X-Content-Type-Options', 'nosniff')
@ApiOperation({ summary: "Serve a plugin's sandboxed config-UI entry HTML (for an iframe srcdoc)" })
- @ApiResponse({ status: 200, description: 'Config UI HTML' })
+ // The handler pins the media type with @Header, which the document cannot see — declare it, or the
+ // only HTML route in the API publishes a 200 a client would decode as JSON.
+ @ApiResponse({
+ status: 200,
+ description: 'Config UI HTML',
+ content: { 'text/html': { schema: { type: 'string' } } },
+ })
@ApiResponse({ status: 404, description: 'Plugin not found or has no config UI' })
getConfigUi(@Param('id') id: string): string {
return this.pluginsService.getConfigUiHtml(id);
@@ -170,7 +186,7 @@ export class PluginsController {
@RequireRole(ApiKeyRole.ADMIN)
@RequireUnscopedKey()
@ApiOperation({ summary: 'Update an installed plugin in place from a URL (preserves config + enabled state)' })
- @ApiResponse({ status: 201, description: 'Plugin updated' })
+ @ApiResponse({ status: 201, description: 'Plugin updated', type: PluginDto })
@ApiResponse({ status: 400, description: 'Invalid URL/package, id mismatch, or built-in' })
@ApiResponse({ status: 404, description: 'Plugin not found' })
async update(@Param('id') id: string, @Body() dto: InstallFromUrlDto): Promise<PluginDto> {
diff --git a/src/modules/session/dto/session-config.dto.ts b/src/modules/session/dto/session-config.dto.ts
index 8237bc08a..3fa5306c0 100644
--- a/src/modules/session/dto/session-config.dto.ts
+++ b/src/modules/session/dto/session-config.dto.ts
@@ -23,6 +23,9 @@ export class UpdateSessionConfigDto {
'incoming call — the session is not restarted.',
example: true,
nullable: true,
+ // Explicit because the TypeScript type is a union: emitDecoratorMetadata reduces `boolean | null`
+ // to `Object`, so without this the property publishes as `type: object`.
+ type: Boolean,
})
@ToStrictBoolean()
@IsOptional()
@@ -38,6 +41,9 @@ export class UpdateSessionConfigDto {
maximum: 20,
example: 5,
nullable: true,
+ // Without an explicit type the union publishes as `type: object`, and JSON Schema ignores
+ // minimum/maximum on a non-numeric type — so the range above would be inert as well as wrong.
+ type: Number,
})
@ToStrictNumber()
@IsOptional()
@@ -54,6 +60,7 @@ export class UpdateSessionConfigDto {
maximum: 300000,
example: 5000,
nullable: true,
+ type: Number,
})
@ToStrictNumber()
@IsOptional()
@@ -80,6 +87,7 @@ export class SessionConfigResponseDto {
description: 'Reconnect attempt cap; `null` means unlimited',
example: 5,
nullable: true,
+ type: Number,
})
maxReconnectAttempts!: number | null;
diff --git a/src/modules/stats/dto/stats-query.dto.ts b/src/modules/stats/dto/stats-query.dto.ts
index 68771ab83..ef65b6db2 100644
--- a/src/modules/stats/dto/stats-query.dto.ts
+++ b/src/modules/stats/dto/stats-query.dto.ts
@@ -1,6 +1,15 @@
import { IsOptional, IsIn } from 'class-validator';
+import { ApiPropertyOptional } from '@nestjs/swagger';
export class StatsQueryDto {
+ // The Nest swagger CLI plugin is not enabled for this project, so a class-validator decorator alone
+ // publishes nothing: without @ApiPropertyOptional the operation ships `parameters: []` and the window
+ // selector is invisible to every client reading the contract.
+ @ApiPropertyOptional({
+ description: 'Time window for the returned series.',
+ enum: ['24h', '7d', '30d'],
+ default: '24h',
+ })
@IsOptional()
@IsIn(['24h', '7d', '30d'])
period?: '24h' | '7d' | '30d' = '24h';
diff --git a/src/modules/webhook/dto/webhook.dto.ts b/src/modules/webhook/dto/webhook.dto.ts
index f84675d7a..955e68e91 100644
--- a/src/modules/webhook/dto/webhook.dto.ts
+++ b/src/modules/webhook/dto/webhook.dto.ts
@@ -164,7 +164,12 @@ export class UpdateWebhookDto {
@IsBoolean()
active?: boolean;
- @ApiPropertyOptional({ description: 'Retry count' })
+ @ApiPropertyOptional({
+ description: 'Delivery attempts before the webhook is parked. Same range the create route enforces.',
+ example: 3,
+ minimum: 0,
+ maximum: 5,
+ })
@ToStrictNumber()
@IsOptional()
@IsInt()