diff --git a/lib/Controller/SignalingController.php b/lib/Controller/SignalingController.php index 9fd49958211..1c319c3f3b7 100644 --- a/lib/Controller/SignalingController.php +++ b/lib/Controller/SignalingController.php @@ -274,7 +274,7 @@ private function getFederationSettings(?Room $room): ?array { * * @param int $serverId ID of the signaling server * @psalm-param non-negative-int $serverId - * @return DataResponse, array{}>|DataResponse|DataResponse + * @return DataResponse}, array{}>|DataResponse|DataResponse * * 200: Welcome message returned * 404: Signaling server not found diff --git a/lib/ResponseDefinitions.php b/lib/ResponseDefinitions.php index 9f56cc2e48d..ed4c28a7847 100644 --- a/lib/ResponseDefinitions.php +++ b/lib/ResponseDefinitions.php @@ -441,8 +441,8 @@ * } * * @psalm-type TalkCapabilities = array{ - * features: list, - * features-local: list, + * features: non-empty-list, + * features-local: non-empty-list, * config: array{ * attachments: array{ * allowed: bool, @@ -498,7 +498,7 @@ * hello-v2-token-key?: string, * }, * }, - * config-local: array>, + * config-local: array>, * version: string, * } */ diff --git a/lib/Signaling/Manager.php b/lib/Signaling/Manager.php index 61e36cce656..4482723cd49 100644 --- a/lib/Signaling/Manager.php +++ b/lib/Signaling/Manager.php @@ -41,7 +41,7 @@ public function __construct( /** * @param int $serverId - * @return array{status: Http::STATUS_OK, data: array}|array{status: Http::STATUS_INTERNAL_SERVER_ERROR, data: array{error: string, version?: string}} + * @return array{status: Http::STATUS_OK, data: array{version: string, warning?: string, features?: non-empty-list}}|array{status: Http::STATUS_INTERNAL_SERVER_ERROR, data: array{error: string, version?: string}} * @throws \OutOfBoundsException When the serverId is not found */ public function checkServerCompatibility(int $serverId): array { @@ -144,7 +144,9 @@ public function checkServerCompatibility(int $serverId): array { return [ 'status' => Http::STATUS_OK, - 'data' => $data, + 'data' => [ + 'version' => $data['version'], + ], ]; } catch (ConnectException) { return [ @@ -175,6 +177,9 @@ public function isCompatibleSignalingServer(IResponse $response): bool { && in_array('switchto', $features, true); } + /** + * @return list + */ public function getSignalingServerMissingFeatures(IResponse $response): array { $featureHeader = $response->getHeader(self::FEATURE_HEADER); $features = explode(',', $featureHeader); diff --git a/openapi-administration.json b/openapi-administration.json index 296501409c5..a15b611f13b 100644 --- a/openapi-administration.json +++ b/openapi-administration.json @@ -101,13 +101,15 @@ "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 }, "features-local": { "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 }, "config": { "type": "object", @@ -356,7 +358,8 @@ "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 } }, "version": { @@ -1494,8 +1497,23 @@ }, "data": { "type": "object", - "additionalProperties": { - "type": "object" + "required": [ + "version" + ], + "properties": { + "version": { + "type": "string" + }, + "warning": { + "type": "string" + }, + "features": { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1 + } } } } diff --git a/openapi-backend-recording.json b/openapi-backend-recording.json index cd97ffcfa1b..4a87c1fc612 100644 --- a/openapi-backend-recording.json +++ b/openapi-backend-recording.json @@ -34,13 +34,15 @@ "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 }, "features-local": { "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 }, "config": { "type": "object", @@ -289,7 +291,8 @@ "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 } }, "version": { diff --git a/openapi-backend-signaling.json b/openapi-backend-signaling.json index fb36d826425..cb0fdc30804 100644 --- a/openapi-backend-signaling.json +++ b/openapi-backend-signaling.json @@ -34,13 +34,15 @@ "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 }, "features-local": { "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 }, "config": { "type": "object", @@ -289,7 +291,8 @@ "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 } }, "version": { diff --git a/openapi-backend-sipbridge.json b/openapi-backend-sipbridge.json index ba69df22e8f..f011dcd64bc 100644 --- a/openapi-backend-sipbridge.json +++ b/openapi-backend-sipbridge.json @@ -77,13 +77,15 @@ "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 }, "features-local": { "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 }, "config": { "type": "object", @@ -332,7 +334,8 @@ "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 } }, "version": { diff --git a/openapi-bots.json b/openapi-bots.json index ffe940004c1..5f9062ebfdf 100644 --- a/openapi-bots.json +++ b/openapi-bots.json @@ -34,13 +34,15 @@ "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 }, "features-local": { "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 }, "config": { "type": "object", @@ -289,7 +291,8 @@ "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 } }, "version": { diff --git a/openapi-federation.json b/openapi-federation.json index 47c3f03b57c..9828ec19c5d 100644 --- a/openapi-federation.json +++ b/openapi-federation.json @@ -77,13 +77,15 @@ "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 }, "features-local": { "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 }, "config": { "type": "object", @@ -332,7 +334,8 @@ "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 } }, "version": { diff --git a/openapi-full.json b/openapi-full.json index 87a86c34e20..fd9f8a407a7 100644 --- a/openapi-full.json +++ b/openapi-full.json @@ -235,13 +235,15 @@ "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 }, "features-local": { "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 }, "config": { "type": "object", @@ -490,7 +492,8 @@ "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 } }, "version": { @@ -23167,8 +23170,23 @@ }, "data": { "type": "object", - "additionalProperties": { - "type": "object" + "required": [ + "version" + ], + "properties": { + "version": { + "type": "string" + }, + "warning": { + "type": "string" + }, + "features": { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1 + } } } } diff --git a/openapi.json b/openapi.json index d6e075e7edd..cda328e506d 100644 --- a/openapi.json +++ b/openapi.json @@ -194,13 +194,15 @@ "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 }, "features-local": { "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 }, "config": { "type": "object", @@ -449,7 +451,8 @@ "type": "array", "items": { "type": "string" - } + }, + "minItems": 1 } }, "version": { diff --git a/src/types/openapi/openapi-administration.ts b/src/types/openapi/openapi-administration.ts index b3bd5849f2b..f07945cba82 100644 --- a/src/types/openapi/openapi-administration.ts +++ b/src/types/openapi/openapi-administration.ts @@ -751,7 +751,9 @@ export interface operations { ocs: { meta: components["schemas"]["OCSMeta"]; data: { - [key: string]: Record; + version: string; + warning?: string; + features?: string[]; }; }; }; diff --git a/src/types/openapi/openapi-full.ts b/src/types/openapi/openapi-full.ts index 733ff3a8cdc..e95af6dc34b 100644 --- a/src/types/openapi/openapi-full.ts +++ b/src/types/openapi/openapi-full.ts @@ -11148,7 +11148,9 @@ export interface operations { ocs: { meta: components["schemas"]["OCSMeta"]; data: { - [key: string]: Record; + version: string; + warning?: string; + features?: string[]; }; }; };