Skip to content

Commit

Permalink
Return array json content for collections
Browse files Browse the repository at this point in the history
  • Loading branch information
mattamon committed Apr 16, 2024
1 parent 94928ff commit 3f90669
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Controller/Api/Assets/CollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/Controller/Api/DataObjects/CollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3f90669

Please sign in to comment.