diff --git a/composer.lock b/composer.lock index ac64991a1..c7231ebfd 100644 --- a/composer.lock +++ b/composer.lock @@ -70,12 +70,12 @@ "source": { "type": "git", "url": "https://github.com/nextcloud-deps/ocp.git", - "reference": "7c4c1330e127fbc926b5cd67f648dd5b6ad27e52" + "reference": "2c8c97deb75e5c911093603e24ece37d515713df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/7c4c1330e127fbc926b5cd67f648dd5b6ad27e52", - "reference": "7c4c1330e127fbc926b5cd67f648dd5b6ad27e52", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/2c8c97deb75e5c911093603e24ece37d515713df", + "reference": "2c8c97deb75e5c911093603e24ece37d515713df", "shasum": "" }, "require": { @@ -107,7 +107,7 @@ "issues": "https://github.com/nextcloud-deps/ocp/issues", "source": "https://github.com/nextcloud-deps/ocp/tree/master" }, - "time": "2024-11-09T00:41:31+00:00" + "time": "2024-11-11T14:47:22+00:00" }, { "name": "psr/clock", diff --git a/lib/Controller/APIController.php b/lib/Controller/APIController.php index 4c04ffe21..54d0731df 100644 --- a/lib/Controller/APIController.php +++ b/lib/Controller/APIController.php @@ -28,6 +28,7 @@ /** * @psalm-import-type NotificationsRichObjectParameter from ResponseDefinitions + * @psalm-import-type NotificationsRichObjectParameters from ResponseDefinitions */ class APIController extends OCSController { public function __construct( @@ -80,8 +81,8 @@ public function generateNotification(string $userId, string $shortMessage, strin * @param string $userId ID of the user * @param string $subject Subject of the notification * @param string $message Message of the notification - * @param array $subjectParameters Rich objects to fill the subject placeholders, {@see \OCP\RichObjectStrings\Definitions} - * @param array $messageParameters Rich objects to fill the message placeholders, {@see \OCP\RichObjectStrings\Definitions} + * @param NotificationsRichObjectParameters $subjectParameters Rich objects to fill the subject placeholders, {@see \OCP\RichObjectStrings\Definitions} + * @param NotificationsRichObjectParameters $messageParameters Rich objects to fill the message placeholders, {@see \OCP\RichObjectStrings\Definitions} * @return DataResponse|DataResponse * * 200: Notification generated successfully, returned id is the notification ID for future delete requests @@ -114,11 +115,9 @@ public function generateNotificationV3( try { if (!empty($subjectParameters)) { - /** @psalm-var array> $subjectParameters */ $this->richValidator->validate($subject, $subjectParameters); } if ($message !== '' && !empty($messageParameters)) { - /** @psalm-var array> $messageParameters */ $this->richValidator->validate($message, $messageParameters); } $notification->setApp('admin_notifications') diff --git a/lib/ResponseDefinitions.php b/lib/ResponseDefinitions.php index fabe09e48..e760aeced 100644 --- a/lib/ResponseDefinitions.php +++ b/lib/ResponseDefinitions.php @@ -40,6 +40,8 @@ * height?: string, * } * + * @psalm-type NotificationsRichObjectParameters = array + * * @psalm-type NotificationsNotificationAction = array{ * label: string, * link: string, @@ -59,9 +61,9 @@ * link: string, * actions: list, * subjectRich?: string, - * subjectRichParameters?: array, + * subjectRichParameters?: NotificationsRichObjectParameters, * messageRich?: string, - * messageRichParameters?: array, + * messageRichParameters?: NotificationsRichObjectParameters, * icon?: string, * shouldNotify?: bool, * } diff --git a/openapi-administration.json b/openapi-administration.json index dab9211d4..2423e0744 100644 --- a/openapi-administration.json +++ b/openapi-administration.json @@ -187,6 +187,12 @@ "type": "string" } } + }, + "RichObjectParameters": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/RichObjectParameter" + } } } }, @@ -422,20 +428,14 @@ "description": "Message of the notification" }, "subjectParameters": { - "type": "object", - "default": {}, - "description": "Rich objects to fill the subject placeholders, {@see \\OCP\\RichObjectStrings\\Definitions}", - "additionalProperties": { - "$ref": "#/components/schemas/RichObjectParameter" - } + "$ref": "#/components/schemas/RichObjectParameters", + "default": [], + "description": "Rich objects to fill the subject placeholders, {@see \\OCP\\RichObjectStrings\\Definitions}" }, "messageParameters": { - "type": "object", - "default": {}, - "description": "Rich objects to fill the message placeholders, {@see \\OCP\\RichObjectStrings\\Definitions}", - "additionalProperties": { - "$ref": "#/components/schemas/RichObjectParameter" - } + "$ref": "#/components/schemas/RichObjectParameters", + "default": [], + "description": "Rich objects to fill the message placeholders, {@see \\OCP\\RichObjectStrings\\Definitions}" } } } diff --git a/openapi-full.json b/openapi-full.json index 3875a3ee3..7dbc4dfe3 100644 --- a/openapi-full.json +++ b/openapi-full.json @@ -109,19 +109,13 @@ "type": "string" }, "subjectRichParameters": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/RichObjectParameter" - } + "$ref": "#/components/schemas/RichObjectParameters" }, "messageRich": { "type": "string" }, "messageRichParameters": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/RichObjectParameter" - } + "$ref": "#/components/schemas/RichObjectParameters" }, "icon": { "type": "string" @@ -304,6 +298,12 @@ "type": "string" } } + }, + "RichObjectParameters": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/RichObjectParameter" + } } } }, @@ -1226,20 +1226,14 @@ "description": "Message of the notification" }, "subjectParameters": { - "type": "object", - "default": {}, - "description": "Rich objects to fill the subject placeholders, {@see \\OCP\\RichObjectStrings\\Definitions}", - "additionalProperties": { - "$ref": "#/components/schemas/RichObjectParameter" - } + "$ref": "#/components/schemas/RichObjectParameters", + "default": [], + "description": "Rich objects to fill the subject placeholders, {@see \\OCP\\RichObjectStrings\\Definitions}" }, "messageParameters": { - "type": "object", - "default": {}, - "description": "Rich objects to fill the message placeholders, {@see \\OCP\\RichObjectStrings\\Definitions}", - "additionalProperties": { - "$ref": "#/components/schemas/RichObjectParameter" - } + "$ref": "#/components/schemas/RichObjectParameters", + "default": [], + "description": "Rich objects to fill the message placeholders, {@see \\OCP\\RichObjectStrings\\Definitions}" } } } diff --git a/openapi.json b/openapi.json index d8bbee675..de06f3b7a 100644 --- a/openapi.json +++ b/openapi.json @@ -109,19 +109,13 @@ "type": "string" }, "subjectRichParameters": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/RichObjectParameter" - } + "$ref": "#/components/schemas/RichObjectParameters" }, "messageRich": { "type": "string" }, "messageRichParameters": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/RichObjectParameter" - } + "$ref": "#/components/schemas/RichObjectParameters" }, "icon": { "type": "string" @@ -285,6 +279,12 @@ "type": "string" } } + }, + "RichObjectParameters": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/RichObjectParameter" + } } } }, diff --git a/vendor-bin/openapi-extractor/composer.json b/vendor-bin/openapi-extractor/composer.json index 544449b4b..f67356548 100644 --- a/vendor-bin/openapi-extractor/composer.json +++ b/vendor-bin/openapi-extractor/composer.json @@ -6,6 +6,6 @@ "sort-packages": true }, "require-dev": { - "nextcloud/openapi-extractor": "^1.0" + "nextcloud/openapi-extractor": "^1.2.1" } } diff --git a/vendor-bin/openapi-extractor/composer.lock b/vendor-bin/openapi-extractor/composer.lock index 8fe0ee470..1dda3205b 100644 --- a/vendor-bin/openapi-extractor/composer.lock +++ b/vendor-bin/openapi-extractor/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d03935a0d6d5307f9346ca73775692b0", + "content-hash": "22b76e65543ffbdb4bb2381632f99301", "packages": [], "packages-dev": [ { @@ -79,16 +79,16 @@ }, { "name": "nextcloud/openapi-extractor", - "version": "v1.1.0", + "version": "v1.2.1", "source": { "type": "git", "url": "https://github.com/nextcloud-releases/openapi-extractor.git", - "reference": "d7c135e819d2297e7e9414a3f80464d68f164c94" + "reference": "2587f18b1e50230cc44210863247bbb37da34401" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud-releases/openapi-extractor/zipball/d7c135e819d2297e7e9414a3f80464d68f164c94", - "reference": "d7c135e819d2297e7e9414a3f80464d68f164c94", + "url": "https://api.github.com/repos/nextcloud-releases/openapi-extractor/zipball/2587f18b1e50230cc44210863247bbb37da34401", + "reference": "2587f18b1e50230cc44210863247bbb37da34401", "shasum": "" }, "require": { @@ -119,9 +119,9 @@ "description": "A tool for extracting OpenAPI specifications from Nextcloud source code", "support": { "issues": "https://github.com/nextcloud-releases/openapi-extractor/issues", - "source": "https://github.com/nextcloud-releases/openapi-extractor/tree/v1.1.0" + "source": "https://github.com/nextcloud-releases/openapi-extractor/tree/v1.2.1" }, - "time": "2024-11-06T11:50:20+00:00" + "time": "2024-11-12T08:00:02+00:00" }, { "name": "nikic/php-parser", @@ -231,11 +231,11 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, - "platform": [], - "platform-dev": [], + "platform": {}, + "platform-dev": {}, "platform-overrides": { "php": "8.1" },