Browse Source

fix(webhooks): Fix openapi reponse definition

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/45475/head
Côme Chilliet 1 year ago
committed by Côme Chilliet
parent
commit
d5b53be449
  1. 10
      apps/webhook_listeners/lib/Controller/WebhooksController.php
  2. 2
      apps/webhook_listeners/lib/ResponseDefinitions.php
  3. 66
      apps/webhook_listeners/openapi.json

10
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
*

2
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,

66
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": []
}
}
Loading…
Cancel
Save