diff --git a/qodana.yaml b/qodana.yaml index 89a9f4fdd..8e42461fc 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -15,6 +15,7 @@ exclude: - translations - .php_cs.dist - doc + - templates - .github - .php-cs-fixer.dist.php - .qodana-profile.xml diff --git a/src/Attributes/Response/Content/OneOfAssetJson.php b/src/Attributes/Response/Content/OneOfAssetJson.php index e329ac72a..afaa0b80c 100644 --- a/src/Attributes/Response/Content/OneOfAssetJson.php +++ b/src/Attributes/Response/Content/OneOfAssetJson.php @@ -31,7 +31,7 @@ public function __construct() type: 'object', oneOf: array_map(static function ($class) { return new Schema(ref: $class); - }, Schemas::Assets), + }, Schemas::ASSETS), ); } } diff --git a/src/Attributes/Response/Error/BadRequestResponse.php b/src/Attributes/Response/Error/BadRequestResponse.php index b87344006..6140f9f25 100644 --- a/src/Attributes/Response/Error/BadRequestResponse.php +++ b/src/Attributes/Response/Error/BadRequestResponse.php @@ -33,7 +33,7 @@ public function __construct() content: new JsonContent( oneOf: array_map(static function ($class) { return new Schema(ref: $class); - }, Schemas::Errors), + }, Schemas::ERRORS), ) ); } diff --git a/src/Attributes/Response/Error/MethodNotAllowedResponse.php b/src/Attributes/Response/Error/MethodNotAllowedResponse.php index 4c7bd9c50..943828f99 100644 --- a/src/Attributes/Response/Error/MethodNotAllowedResponse.php +++ b/src/Attributes/Response/Error/MethodNotAllowedResponse.php @@ -33,7 +33,7 @@ public function __construct() content: new JsonContent( oneOf: array_map(static function ($class) { return new Schema(ref: $class); - }, Schemas::Errors), + }, Schemas::ERRORS), ) ); } diff --git a/src/Attributes/Response/Error/UnauthorizedResponse.php b/src/Attributes/Response/Error/UnauthorizedResponse.php index 8d85c42b7..dd25c2f46 100644 --- a/src/Attributes/Response/Error/UnauthorizedResponse.php +++ b/src/Attributes/Response/Error/UnauthorizedResponse.php @@ -33,7 +33,7 @@ public function __construct() content: new JsonContent( oneOf: array_map(static function ($class) { return new Schema(ref: $class); - }, Schemas::Errors), + }, Schemas::ERRORS), ) ); } diff --git a/src/Attributes/Response/Error/UnsupportedMediaTypeResponse.php b/src/Attributes/Response/Error/UnsupportedMediaTypeResponse.php index 27707479d..e96fd4d38 100644 --- a/src/Attributes/Response/Error/UnsupportedMediaTypeResponse.php +++ b/src/Attributes/Response/Error/UnsupportedMediaTypeResponse.php @@ -33,7 +33,7 @@ public function __construct() content: new JsonContent( oneOf: array_map(static function ($class) { return new Schema(ref: $class); - }, Schemas::Errors), + }, Schemas::ERRORS), ) ); } diff --git a/src/Attributes/Response/Property/AnyOfAsset.php b/src/Attributes/Response/Property/AnyOfAsset.php index 565962ed3..577fb6871 100644 --- a/src/Attributes/Response/Property/AnyOfAsset.php +++ b/src/Attributes/Response/Property/AnyOfAsset.php @@ -35,7 +35,7 @@ public function __construct() items: new Items( anyOf: array_map(static function ($class) { return new Schema(ref: $class); - }, Schemas::Assets) + }, Schemas::ASSETS) ) ); } diff --git a/src/Config/Tags.php b/src/Config/Tags.php index fd5f3915c..62c6c5add 100644 --- a/src/Config/Tags.php +++ b/src/Config/Tags.php @@ -21,10 +21,22 @@ /** * @internal */ -#[Tag(name: Tags::Assets->name, description: 'Asset operations to get/update/create/delete assets')] -#[Tag(name: Tags::Authorization->name, description: 'Login via username and password to get a token or refresh the token')] -#[Tag(name: Tags::DataObjects->name, description: 'DataObject operations to get/update/create/delete data objects')] -#[Tag(name: Tags::Translation->name, description: 'Get translations either for a single key or multiple keys')] +#[Tag( + name: Tags::Assets->name, + description: 'Asset operations to get/update/create/delete assets' +)] +#[Tag( + name: Tags::Authorization->name, + description: 'Login via username and password to get a token or refresh the token' +)] +#[Tag( + name: Tags::DataObjects->name, + description: 'DataObject operations to get/update/create/delete data objects' +)] +#[Tag( + name: Tags::Translation->name, + description: 'Get translations either for a single key or multiple keys' +)] enum Tags { case Assets; diff --git a/src/Controller/Api/TranslationController.php b/src/Controller/Api/TranslationController.php index 920702ae1..0cbf60c5d 100644 --- a/src/Controller/Api/TranslationController.php +++ b/src/Controller/Api/TranslationController.php @@ -37,7 +37,7 @@ */ final class TranslationController extends AbstractApiController { - private const PATH = '/translations'; + private const ROUTE = '/translations'; public function __construct( SerializerInterface $serializer, @@ -46,10 +46,10 @@ public function __construct( parent::__construct($serializer); } - #[Route(self::PATH, name: 'pimcore_studio_api_translations', methods: ['POST'])] + #[Route(self::ROUTE, name: 'pimcore_studio_api_translations', methods: ['POST'])] //#[IsGranted(self::VOTER_PUBLIC_STUDIO_API, 'translation')] #[POST( - path: self::API_PATH . self::PATH, + path: self::API_PATH . self::ROUTE, operationId: 'getTranslations', description: 'Get translations for given keys and locale', summary: 'Get translations', diff --git a/src/EventSubscriber/CorsSubscriber.php b/src/EventSubscriber/CorsSubscriber.php index bc27b5338..c24b0d7fa 100644 --- a/src/EventSubscriber/CorsSubscriber.php +++ b/src/EventSubscriber/CorsSubscriber.php @@ -62,7 +62,7 @@ public function onKernelRequest(RequestEvent $event): void } // perform preflight checks - if ('OPTIONS' === $request->getMethod()) { + if ($request->getMethod() === 'OPTIONS') { $response = new Response(); $response->headers->set('Access-Control-Allow-Credentials', 'true'); diff --git a/src/Exception/ClassDefinitionNotFoundException.php b/src/Exception/ClassDefinitionNotFoundException.php new file mode 100644 index 000000000..aabf081a3 --- /dev/null +++ b/src/Exception/ClassDefinitionNotFoundException.php @@ -0,0 +1,24 @@ +classDefinitionResolver->getByName($classDefinitionId); - + if($classDefinition === null) { + throw new ClassDefinitionNotFoundException(400, 'Class definition not found'); + } $this->search->setClassDefinition($classDefinition); return $this; diff --git a/src/Service/OpenApiServiceInterface.php b/src/Service/OpenApiServiceInterface.php index a05dd4abe..b0c6af025 100644 --- a/src/Service/OpenApiServiceInterface.php +++ b/src/Service/OpenApiServiceInterface.php @@ -1,4 +1,5 @@