aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2024-06-11 09:53:56 +0200
committerCôme Chilliet <91878298+come-nc@users.noreply.github.com>2024-06-11 14:10:29 +0200
commitd5b53be449bb00f78232c7948c8cfbcb2303a38e (patch)
tree695421d107fb48c054e097f08afb870fdc302c4d
parentf09c7815db6511ea24b0b551316c8ba07732f6f1 (diff)
downloadnextcloud-server-d5b53be449bb00f78232c7948c8cfbcb2303a38e.tar.gz
nextcloud-server-d5b53be449bb00f78232c7948c8cfbcb2303a38e.zip
fix(webhooks): Fix openapi reponse definition
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r--apps/webhook_listeners/lib/Controller/WebhooksController.php10
-rw-r--r--apps/webhook_listeners/lib/ResponseDefinitions.php2
-rw-r--r--apps/webhook_listeners/openapi.json66
3 files changed, 39 insertions, 39 deletions
diff --git a/apps/webhook_listeners/lib/Controller/WebhooksController.php b/apps/webhook_listeners/lib/Controller/WebhooksController.php
index c09da53d5f2..42870825877 100644
--- a/apps/webhook_listeners/lib/Controller/WebhooksController.php
+++ b/apps/webhook_listeners/lib/Controller/WebhooksController.php
@@ -26,7 +26,7 @@ use OCP\ISession;
use Psr\Log\LoggerInterface;
/**
- * @psalm-import-type WebhooksListenerInfo from ResponseDefinitions
+ * @psalm-import-type WebhookListenersWebhookInfo from ResponseDefinitions
*/
#[OpenAPI(scope: OpenAPI::SCOPE_ADMINISTRATION)]
class WebhooksController extends OCSController {
@@ -44,7 +44,7 @@ class WebhooksController extends OCSController {
/**
* List registered webhooks
*
- * @return DataResponse<Http::STATUS_OK, WebhooksListenerInfo[], array{}>
+ * @return DataResponse<Http::STATUS_OK, WebhookListenersWebhookInfo[], array{}>
*
* 200: Webhook registrations returned
*/
@@ -61,7 +61,7 @@ class WebhooksController extends OCSController {
*
* @param int $id id of the webhook
*
- * @return DataResponse<Http::STATUS_OK, WebhooksListenerInfo, array{}>
+ * @return DataResponse<Http::STATUS_OK, WebhookListenersWebhookInfo, array{}>
*
* 200: Webhook registration returned
*/
@@ -82,7 +82,7 @@ class WebhooksController extends OCSController {
* @param "none"|"headers"|null $authMethod Authentication method to use
* @param ?array<string,mixed> $authData Array of data for authentication
*
- * @return DataResponse<Http::STATUS_OK, WebhooksListenerInfo, array{}>
+ * @return DataResponse<Http::STATUS_OK, WebhookListenersWebhookInfo, array{}>
*
* 200: Webhook registration returned
*
@@ -141,7 +141,7 @@ class WebhooksController extends OCSController {
* @param "none"|"headers"|null $authMethod Authentication method to use
* @param ?array<string,mixed> $authData Array of data for authentication
*
- * @return DataResponse<Http::STATUS_OK, WebhooksListenerInfo, array{}>
+ * @return DataResponse<Http::STATUS_OK, WebhookListenersWebhookInfo, array{}>
*
* 200: Webhook registration returned
*
diff --git a/apps/webhook_listeners/lib/ResponseDefinitions.php b/apps/webhook_listeners/lib/ResponseDefinitions.php
index 3b9965c20a3..cb33f93e8ff 100644
--- a/apps/webhook_listeners/lib/ResponseDefinitions.php
+++ b/apps/webhook_listeners/lib/ResponseDefinitions.php
@@ -10,7 +10,7 @@ declare(strict_types=1);
namespace OCA\WebhookListeners;
/**
- * @psalm-type WebhooksListenerInfo = array{
+ * @psalm-type WebhookListenersWebhookInfo = array{
* id: string,
* userId: string,
* httpMethod: string,
diff --git a/apps/webhook_listeners/openapi.json b/apps/webhook_listeners/openapi.json
index 6d8a10fcdea..308f0e8b11d 100644
--- a/apps/webhook_listeners/openapi.json
+++ b/apps/webhook_listeners/openapi.json
@@ -1,7 +1,7 @@
{
"openapi": "3.0.3",
"info": {
- "title": "webhooks",
+ "title": "webhook_listeners",
"version": "0.0.1",
"description": "Nextcloud webhook support",
"license": {
@@ -20,7 +20,31 @@
}
},
"schemas": {
- "ListenerInfo": {
+ "OCSMeta": {
+ "type": "object",
+ "required": [
+ "status",
+ "statuscode"
+ ],
+ "properties": {
+ "status": {
+ "type": "string"
+ },
+ "statuscode": {
+ "type": "integer"
+ },
+ "message": {
+ "type": "string"
+ },
+ "totalitems": {
+ "type": "string"
+ },
+ "itemsperpage": {
+ "type": "string"
+ }
+ }
+ },
+ "WebhookInfo": {
"type": "object",
"required": [
"id",
@@ -67,35 +91,11 @@
}
}
}
- },
- "OCSMeta": {
- "type": "object",
- "required": [
- "status",
- "statuscode"
- ],
- "properties": {
- "status": {
- "type": "string"
- },
- "statuscode": {
- "type": "integer"
- },
- "message": {
- "type": "string"
- },
- "totalitems": {
- "type": "string"
- },
- "itemsperpage": {
- "type": "string"
- }
- }
}
}
},
"paths": {
- "/ocs/v2.php/apps/webhooks/api/v1/webhooks": {
+ "/ocs/v2.php/apps/webhook_listeners/api/v1/webhooks": {
"get": {
"operationId": "webhooks-index",
"summary": "List registered webhooks",
@@ -147,7 +147,7 @@
"data": {
"type": "array",
"items": {
- "$ref": "#/components/schemas/ListenerInfo"
+ "$ref": "#/components/schemas/WebhookInfo"
}
}
}
@@ -275,7 +275,7 @@
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
- "$ref": "#/components/schemas/ListenerInfo"
+ "$ref": "#/components/schemas/WebhookInfo"
}
}
}
@@ -343,7 +343,7 @@
}
}
},
- "/ocs/v2.php/apps/webhooks/api/v1/webhooks/{id}": {
+ "/ocs/v2.php/apps/webhook_listeners/api/v1/webhooks/{id}": {
"get": {
"operationId": "webhooks-show",
"summary": "Get details on a registered webhook",
@@ -403,7 +403,7 @@
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
- "$ref": "#/components/schemas/ListenerInfo"
+ "$ref": "#/components/schemas/WebhookInfo"
}
}
}
@@ -540,7 +540,7 @@
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
- "$ref": "#/components/schemas/ListenerInfo"
+ "$ref": "#/components/schemas/WebhookInfo"
}
}
}
@@ -736,4 +736,4 @@
}
},
"tags": []
-}
+} \ No newline at end of file