diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2024-11-06 08:56:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-06 08:56:30 +0100 |
commit | d53fde8eef13d408fcf035ea8a95e6345df9b99b (patch) | |
tree | 60f6b612d967a9a264589cdd6cc0c6d008e1bf05 /core/Controller/TaskProcessingApiController.php | |
parent | 8fab143aa486904f7a17c4f1c2f6364cd43bf9d9 (diff) | |
parent | 77114fb3277742fc69ddcf2432311ecb263af97e (diff) | |
download | nextcloud-server-d53fde8eef13d408fcf035ea8a95e6345df9b99b.tar.gz nextcloud-server-d53fde8eef13d408fcf035ea8a95e6345df9b99b.zip |
Merge pull request #49015 from nextcloud/fix/openapi/array-syntax
Diffstat (limited to 'core/Controller/TaskProcessingApiController.php')
-rw-r--r-- | core/Controller/TaskProcessingApiController.php | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index 7ee5e7068af..e41c178f44d 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -68,30 +68,30 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { #[ApiRoute(verb: 'GET', url: '/tasktypes', root: '/taskprocessing')] public function taskTypes(): DataResponse { $taskTypes = array_map(function (array $tt) { - $tt['inputShape'] = array_map(function ($descriptor) { + $tt['inputShape'] = array_values(array_map(function ($descriptor) { return $descriptor->jsonSerialize(); - }, $tt['inputShape']); - $tt['outputShape'] = array_map(function ($descriptor) { + }, $tt['inputShape'])); + $tt['outputShape'] = array_values(array_map(function ($descriptor) { return $descriptor->jsonSerialize(); - }, $tt['outputShape']); - $tt['optionalInputShape'] = array_map(function ($descriptor) { + }, $tt['outputShape'])); + $tt['optionalInputShape'] = array_values(array_map(function ($descriptor) { return $descriptor->jsonSerialize(); - }, $tt['optionalInputShape']); - $tt['optionalOutputShape'] = array_map(function ($descriptor) { + }, $tt['optionalInputShape'])); + $tt['optionalOutputShape'] = array_values(array_map(function ($descriptor) { return $descriptor->jsonSerialize(); - }, $tt['optionalOutputShape']); - $tt['inputShapeEnumValues'] = array_map(function (array $enumValues) { - return array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues); - }, $tt['inputShapeEnumValues']); - $tt['optionalInputShapeEnumValues'] = array_map(function (array $enumValues) { - return array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues); - }, $tt['optionalInputShapeEnumValues']); - $tt['outputShapeEnumValues'] = array_map(function (array $enumValues) { - return array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues); - }, $tt['outputShapeEnumValues']); - $tt['optionalOutputShapeEnumValues'] = array_map(function (array $enumValues) { - return array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues); - }, $tt['optionalOutputShapeEnumValues']); + }, $tt['optionalOutputShape'])); + $tt['inputShapeEnumValues'] = array_values(array_map(function (array $enumValues) { + return array_values(array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues)); + }, $tt['inputShapeEnumValues'])); + $tt['optionalInputShapeEnumValues'] = array_values(array_map(function (array $enumValues) { + return array_values(array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues)); + }, $tt['optionalInputShapeEnumValues'])); + $tt['outputShapeEnumValues'] = array_values(array_map(function (array $enumValues) { + return array_values(array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues)); + }, $tt['outputShapeEnumValues'])); + $tt['optionalOutputShapeEnumValues'] = array_values(array_map(function (array $enumValues) { + return array_values(array_map(fn (ShapeEnumValue $enumValue) => $enumValue->jsonSerialize(), $enumValues)); + }, $tt['optionalOutputShapeEnumValues'])); return $tt; }, $this->taskProcessingManager->getAvailableTaskTypes()); return new DataResponse([ @@ -208,7 +208,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * * @param string $appId ID of the app * @param string|null $customId An arbitrary identifier for the task - * @return DataResponse<Http::STATUS_OK, array{tasks: CoreTaskProcessingTask[]}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> + * @return DataResponse<Http::STATUS_OK, array{tasks: list<CoreTaskProcessingTask>}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> * * 200: Tasks returned */ @@ -217,7 +217,6 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { public function listTasksByApp(string $appId, ?string $customId = null): DataResponse { try { $tasks = $this->taskProcessingManager->getUserTasksByApp($this->userId, $appId, $customId); - /** @var CoreTaskProcessingTask[] $json */ $json = array_map(static function (Task $task) { return $task->jsonSerialize(); }, $tasks); @@ -235,7 +234,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * * @param string|null $taskType The task type to filter by * @param string|null $customId An arbitrary identifier for the task - * @return DataResponse<Http::STATUS_OK, array{tasks: CoreTaskProcessingTask[]}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> + * @return DataResponse<Http::STATUS_OK, array{tasks: list<CoreTaskProcessingTask>}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, array{message: string}, array{}> * * 200: Tasks returned */ @@ -244,7 +243,6 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { public function listTasks(?string $taskType, ?string $customId = null): DataResponse { try { $tasks = $this->taskProcessingManager->getUserTasks($this->userId, $taskType, $customId); - /** @var CoreTaskProcessingTask[] $json */ $json = array_map(static function (Task $task) { return $task->jsonSerialize(); }, $tasks); |