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 <opensource@fthiessen.de>
pull/51622/head
Ferdinand Thiessen 2025-03-21 09:15:55 +07:00
parent 3d38a4bdde
commit b9f9190894
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
4 changed files with 4 additions and 5 deletions

@ -38,7 +38,7 @@ class Capabilities implements ICapability {
* apiVersion: '1.0-proposal1', * apiVersion: '1.0-proposal1',
* enabled: bool, * enabled: bool,
* endPoint: string, * endPoint: string,
* publicKey: array{ * publicKey?: array{
* keyId: string, * keyId: string,
* publicKeyPem: string, * publicKeyPem: string,
* }, * },

@ -46,7 +46,6 @@
"apiVersion", "apiVersion",
"enabled", "enabled",
"endPoint", "endPoint",
"publicKey",
"resourceTypes", "resourceTypes",
"version" "version"
], ],

@ -213,7 +213,7 @@ class OCMProvider implements IOCMProvider {
* enabled: bool, * enabled: bool,
* apiVersion: '1.0-proposal1', * apiVersion: '1.0-proposal1',
* endPoint: string, * endPoint: string,
* publicKey: array{ * publicKey?: array{
* keyId: string, * keyId: string,
* publicKeyPem: 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 'apiVersion' => '1.0-proposal1', // deprecated, but keep it to stay compatible with old version
'version' => $this->getApiVersion(), // informative but real version 'version' => $this->getApiVersion(), // informative but real version
'endPoint' => $this->getEndPoint(), 'endPoint' => $this->getEndPoint(),
'publicKey' => $this->getSignatory()->jsonSerialize(), 'publicKey' => $this->getSignatory()?->jsonSerialize(),
'resourceTypes' => $resourceTypes 'resourceTypes' => $resourceTypes
]; ];
} }

@ -151,7 +151,7 @@ interface IOCMProvider extends JsonSerializable {
* enabled: bool, * enabled: bool,
* apiVersion: '1.0-proposal1', * apiVersion: '1.0-proposal1',
* endPoint: string, * endPoint: string,
* publicKey: array{ * publicKey?: array{
* keyId: string, * keyId: string,
* publicKeyPem: string * publicKeyPem: string
* }, * },