From b9f919089417af9821255200f388b18f0f00b2cb Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Fri, 21 Mar 2025 09:15:55 +0100 Subject: fix(ocm): `publicKey` can be disabled so capabilities do not match When the public key feature is disabled null is returned for `publicKey`. So in this case we need to adjust the capabilities and return type of `jsonSerialize()`. Signed-off-by: Ferdinand Thiessen --- apps/cloud_federation_api/lib/Capabilities.php | 2 +- apps/cloud_federation_api/openapi.json | 1 - lib/private/OCM/Model/OCMProvider.php | 4 ++-- lib/public/OCM/IOCMProvider.php | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/cloud_federation_api/lib/Capabilities.php b/apps/cloud_federation_api/lib/Capabilities.php index deca7fe1733..8957fb8b9d8 100644 --- a/apps/cloud_federation_api/lib/Capabilities.php +++ b/apps/cloud_federation_api/lib/Capabilities.php @@ -38,7 +38,7 @@ class Capabilities implements ICapability { * apiVersion: '1.0-proposal1', * enabled: bool, * endPoint: string, - * publicKey: array{ + * publicKey?: array{ * keyId: string, * publicKeyPem: string, * }, diff --git a/apps/cloud_federation_api/openapi.json b/apps/cloud_federation_api/openapi.json index 1c69ea2d083..730af73628f 100644 --- a/apps/cloud_federation_api/openapi.json +++ b/apps/cloud_federation_api/openapi.json @@ -46,7 +46,6 @@ "apiVersion", "enabled", "endPoint", - "publicKey", "resourceTypes", "version" ], diff --git a/lib/private/OCM/Model/OCMProvider.php b/lib/private/OCM/Model/OCMProvider.php index 99a3770faef..f4b0ac584de 100644 --- a/lib/private/OCM/Model/OCMProvider.php +++ b/lib/private/OCM/Model/OCMProvider.php @@ -213,7 +213,7 @@ class OCMProvider implements IOCMProvider { * enabled: bool, * apiVersion: '1.0-proposal1', * endPoint: string, - * publicKey: array{ + * publicKey?: array{ * keyId: string, * publicKeyPem: string * }, @@ -236,7 +236,7 @@ class OCMProvider implements IOCMProvider { 'apiVersion' => '1.0-proposal1', // deprecated, but keep it to stay compatible with old version 'version' => $this->getApiVersion(), // informative but real version 'endPoint' => $this->getEndPoint(), - 'publicKey' => $this->getSignatory()->jsonSerialize(), + 'publicKey' => $this->getSignatory()?->jsonSerialize(), 'resourceTypes' => $resourceTypes ]; } diff --git a/lib/public/OCM/IOCMProvider.php b/lib/public/OCM/IOCMProvider.php index a588d869655..a267abc52d2 100644 --- a/lib/public/OCM/IOCMProvider.php +++ b/lib/public/OCM/IOCMProvider.php @@ -151,7 +151,7 @@ interface IOCMProvider extends JsonSerializable { * enabled: bool, * apiVersion: '1.0-proposal1', * endPoint: string, - * publicKey: array{ + * publicKey?: array{ * keyId: string, * publicKeyPem: string * }, -- cgit v1.2.3