Skip to content

Commit

Permalink
[Task] Missing http responses (#627)
Browse files Browse the repository at this point in the history
* add some missing internal error responses

* add some missing internal error responses

* Apply php-cs-fixer changes

---------

Co-authored-by: lukmzig <[email protected]>
  • Loading branch information
lukmzig and lukmzig authored Dec 10, 2024
1 parent 3996722 commit 9303249
Show file tree
Hide file tree
Showing 19 changed files with 27 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/Asset/Controller/GetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ public function __construct(
content: new OneOfAssetJson()
)]
#[DefaultResponses([
HttpResponseCodes::UNAUTHORIZED,
HttpResponseCodes::BAD_REQUEST,
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::UNAUTHORIZED,
])]
public function getAssetById(int $id): JsonResponse
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ public function __construct(
)
)]
#[DefaultResponses([
HttpResponseCodes::UNAUTHORIZED,
HttpResponseCodes::BAD_REQUEST,
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::UNAUTHORIZED,
])]
public function getAvailableAssetGridColumns(): JsonResponse
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ public function __construct(
content: new JsonContent(ref: DetailedConfiguration::class)
)]
#[DefaultResponses([
HttpResponseCodes::UNAUTHORIZED,
HttpResponseCodes::BAD_REQUEST,
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::UNAUTHORIZED,
])]
public function getAssetGridConfiguration(
int $folderId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function __construct(
content: new CollectionJson(new GenericCollection(Configuration::class))
)]
#[DefaultResponses([
HttpResponseCodes::BAD_REQUEST,
HttpResponseCodes::UNAUTHORIZED,
HttpResponseCodes::NOT_FOUND,
])]
Expand Down
3 changes: 2 additions & 1 deletion src/Asset/Controller/Image/ThumbnailDownloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ public function __construct(
headers: [new ContentDisposition()]
)]
#[DefaultResponses([
HttpResponseCodes::UNAUTHORIZED,
HttpResponseCodes::BAD_REQUEST,
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::UNAUTHORIZED,
])]
public function downloadImageByThumbnail(int $id, string $thumbnailName): BinaryFileResponse
{
Expand Down
3 changes: 2 additions & 1 deletion src/Asset/Controller/TreeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ public function __construct(
content: new CollectionJson(new AnyOfAsset())
)]
#[DefaultResponses([
HttpResponseCodes::UNAUTHORIZED,
HttpResponseCodes::BAD_REQUEST,
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::UNAUTHORIZED,
])]
public function getAssetTree(#[MapQueryString] ElementParameters $parameters): JsonResponse
{
Expand Down
1 change: 1 addition & 0 deletions src/Role/Controller/CloneController.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public function __construct(
)]
#[DefaultResponses([
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::INTERNAL_SERVER_ERROR,
])]
public function cloneRole(int $id, #[MapRequestPayload] RoleCloneParameter $roleClone): JsonResponse
{
Expand Down
1 change: 1 addition & 0 deletions src/Role/Controller/CreateFolderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function __construct(
)]
#[DefaultResponses([
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::INTERNAL_SERVER_ERROR,
])]
public function createRoleFolder(#[MapRequestPayload] CreateParameter $createParameter): JsonResponse
{
Expand Down
1 change: 1 addition & 0 deletions src/Role/Controller/CreateRoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function __construct(
)]
#[DefaultResponses([
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::INTERNAL_SERVER_ERROR,
])]
public function createRole(#[MapRequestPayload] CreateParameter $createParameter): JsonResponse
{
Expand Down
1 change: 1 addition & 0 deletions src/Role/Controller/DeleteFolderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function __construct(
#[IdParameter(type: 'folder')]
#[DefaultResponses([
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::INTERNAL_SERVER_ERROR,
])]
public function deleteRoleFolder(int $id): Response
{
Expand Down
1 change: 1 addition & 0 deletions src/Role/Controller/DeleteRoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function __construct(
#[IdParameter(type: 'role')]
#[DefaultResponses([
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::INTERNAL_SERVER_ERROR,
])]
public function deleteRole(int $id): Response
{
Expand Down
1 change: 1 addition & 0 deletions src/Role/Controller/GetRoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function __construct(
)]
#[DefaultResponses([
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::INTERNAL_SERVER_ERROR,
])]
public function getRoleById(int $id): JsonResponse
{
Expand Down
5 changes: 4 additions & 1 deletion src/Role/Controller/RoleTreeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Schema\TreeNode;
use Pimcore\Bundle\StudioBackendBundle\Role\Service\RoleServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\HttpResponseCodes;
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\UserPermissions;
use Pimcore\Bundle\StudioBackendBundle\Util\Trait\PaginatedResponseTrait;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -71,7 +72,9 @@ public function __construct(
description: 'role_get_tree_success_response',
content: new CollectionJson(new GenericCollection(TreeNode::class))
)]
#[DefaultResponses]
#[DefaultResponses([
HttpResponseCodes::INTERNAL_SERVER_ERROR,
])]
public function getRoleTree(#[MapQueryString] MappedParentIdParameter $roleTreeListingParameter): Response
{
$roles = $this->roleService->getRoleTreeCollection($roleTreeListingParameter);
Expand Down
1 change: 1 addition & 0 deletions src/Role/Controller/UpdateRoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function __construct(
)]
#[DefaultResponses([
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::INTERNAL_SERVER_ERROR,
])]
public function updateRoleById(int $id, #[MapRequestPayload] UpdateRoleParameter $roleUpdate): JsonResponse
{
Expand Down
1 change: 1 addition & 0 deletions src/User/Controller/CloneController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function __construct(
)]
#[DefaultResponses([
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::INTERNAL_SERVER_ERROR,
])]
public function cloneUser(int $id, #[MapRequestPayload] UserCloneParameter $userClone): JsonResponse
{
Expand Down
1 change: 1 addition & 0 deletions src/User/Controller/CreateUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function __construct(
)]
#[DefaultResponses([
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::INTERNAL_SERVER_ERROR,
])]
public function createUser(#[MapRequestPayload] CreateParameter $createParameter): JsonResponse
{
Expand Down
1 change: 1 addition & 0 deletions src/User/Controller/CreateUserFolderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function __construct(
)]
#[DefaultResponses([
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::INTERNAL_SERVER_ERROR,
])]
public function createUserFolder(#[MapRequestPayload] CreateParameter $createParameter): JsonResponse
{
Expand Down
1 change: 1 addition & 0 deletions src/User/Controller/DeleteUserFolderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public function __construct(
#[IdParameter(type: 'user-folder')]
#[DefaultResponses([
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::INTERNAL_SERVER_ERROR,
])]
public function deleteUserFolder(int $id): Response
{
Expand Down
1 change: 1 addition & 0 deletions src/User/Controller/UpdateUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public function __construct(
#[DefaultResponses([
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::FORBIDDEN,
HttpResponseCodes::INTERNAL_SERVER_ERROR,
])]
public function updateUsers(int $id, #[MapRequestPayload] UpdateUserParameter $userUpdate): JsonResponse
{
Expand Down

0 comments on commit 9303249

Please sign in to comment.