From 3f906694a8a685c19ac0840af9899ad0768eb920 Mon Sep 17 00:00:00 2001 From: mattamon Date: Tue, 16 Apr 2024 18:47:02 +0200 Subject: [PATCH] Return array json content for collections --- src/Controller/Api/Assets/CollectionController.php | 3 ++- src/Controller/Api/DataObjects/CollectionController.php | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Controller/Api/Assets/CollectionController.php b/src/Controller/Api/Assets/CollectionController.php index 5d74819e2..a23f90a3c 100644 --- a/src/Controller/Api/Assets/CollectionController.php +++ b/src/Controller/Api/Assets/CollectionController.php @@ -17,6 +17,7 @@ namespace Pimcore\Bundle\StudioApiBundle\Controller\Api\Assets; use OpenApi\Attributes\Get; +use OpenApi\Attributes\Items; use OpenApi\Attributes\JsonContent; use Pimcore\Bundle\StudioApiBundle\Attributes\Parameters\Query\ExcludeFoldersParameter; use Pimcore\Bundle\StudioApiBundle\Attributes\Parameters\Query\IdSearchTermParameter; @@ -77,7 +78,7 @@ public function __construct( #[PathIncludeDescendantsParameter] #[SuccessResponse( description: 'Paginated assets with total count as header param', - content: new JsonContent(ref: Asset::class) + content: new JsonContent(type: 'array', items: new Items(ref: Asset::class)) )] #[UnauthorizedResponse] public function getAssets(#[MapQueryString] Parameters $parameters): JsonResponse diff --git a/src/Controller/Api/DataObjects/CollectionController.php b/src/Controller/Api/DataObjects/CollectionController.php index 1297a330d..780a12469 100644 --- a/src/Controller/Api/DataObjects/CollectionController.php +++ b/src/Controller/Api/DataObjects/CollectionController.php @@ -16,7 +16,9 @@ namespace Pimcore\Bundle\StudioApiBundle\Controller\Api\DataObjects; +use Google\Service\Analytics\Resource\Data; use OpenApi\Attributes\Get; +use OpenApi\Attributes\Items; use OpenApi\Attributes\JsonContent; use Pimcore\Bundle\StudioApiBundle\Attributes\Parameters\Query\ClassIdParameter; use Pimcore\Bundle\StudioApiBundle\Attributes\Parameters\Query\ExcludeFoldersParameter; @@ -79,7 +81,7 @@ public function __construct( #[ClassIdParameter] #[SuccessResponse( description: 'Paginated data objects with total count as header param', - content: new JsonContent(ref: DataObject::class) + content: new JsonContent(type: 'array', items: new Items(ref: DataObject::class)) )] #[UnauthorizedResponse] public function getDataObjects(#[MapQueryString] DataObjectParameters $parameters): JsonResponse