Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(api): admit null to the proxyType enum

Yudhi Armyndharis1931ac21d93e
diff --git a/openapi.json b/openapi.json
index ef560b565..6f44144a6 100644
--- a/openapi.json
+++ b/openapi.json
@@ -10287,12 +10287,13 @@
},
"proxyType": {
"type": "string",
- "description": "Proxy protocol derived from the stored URL scheme",
+ "description": "Proxy protocol derived from the stored URL scheme; `null` when no proxy is set",
"enum": [
"http",
"https",
"socks4",
- "socks5"
+ "socks5",
+ null
],
"nullable": true,
"example": "http"
diff --git a/src/modules/session/dto/session-proxy.dto.ts b/src/modules/session/dto/session-proxy.dto.ts
index 4656597a6..f01d8afcb 100644
--- a/src/modules/session/dto/session-proxy.dto.ts
+++ b/src/modules/session/dto/session-proxy.dto.ts
@@ -20,8 +20,12 @@ export class SessionProxyResponseDto {
enabled!: boolean;
@ApiProperty({
- description: 'Proxy protocol derived from the stored URL scheme',
- enum: ['http', 'https', 'socks4', 'socks5'],
+ description: 'Proxy protocol derived from the stored URL scheme; `null` when no proxy is set',
+ // `null` is IN the enum on purpose. This is an OpenAPI 3.0 document, where `nullable: true`
+ // does not widen an enum: a strict validator checks the value against the list and rejects
+ // `null` for not being on it. Every session without a proxy answers exactly that, so the most
+ // ordinary response on this route contradicted its own schema.
+ enum: ['http', 'https', 'socks4', 'socks5', null],
nullable: true,
example: 'http',
})