-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2592 from tarlepp/feat/open-api-annotations-to-at…
…tributes Feat - Use Open API attributes instead of annotations
- Loading branch information
Showing
27 changed files
with
817 additions
and
754 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
use App\Resource\ApiKeyResource; | ||
use App\Rest\Controller; | ||
use App\Rest\Traits\Actions; | ||
use OpenApi\Annotations as OA; | ||
use OpenApi\Attributes as OA; | ||
use Symfony\Component\HttpKernel\Attribute\AsController; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter; | ||
|
@@ -23,8 +23,6 @@ | |
/** | ||
* Class ApiKeyController | ||
* | ||
* @OA\Tag(name="ApiKey Management") | ||
* | ||
* @package App\Controller | ||
* @author TLe, Tarmo Leppänen <[email protected]> | ||
* | ||
|
@@ -35,6 +33,7 @@ | |
path: '/v1/api_key', | ||
)] | ||
#[IsGranted(AuthenticatedVoter::IS_AUTHENTICATED_FULLY)] | ||
#[OA\Tag(name: 'ApiKey Management')] | ||
class ApiKeyController extends Controller | ||
{ | ||
use Actions\Root\CountAction; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,8 @@ | |
namespace App\Controller\v1\Localization; | ||
|
||
use App\Service\Localization; | ||
use OpenApi\Annotations as OA; | ||
use OpenApi\Attributes as OA; | ||
use OpenApi\Attributes\JsonContent; | ||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpKernel\Attribute\AsController; | ||
|
@@ -18,12 +19,11 @@ | |
/** | ||
* Class LanguageController | ||
* | ||
* @OA\Tag(name="Localization") | ||
* | ||
* @package App\Controller\v1\Localization | ||
* @author TLe, Tarmo Leppänen <[email protected]> | ||
*/ | ||
#[AsController] | ||
#[OA\Tag(name: 'Localization')] | ||
class LanguageController | ||
{ | ||
public function __construct( | ||
|
@@ -34,21 +34,23 @@ public function __construct( | |
/** | ||
* Endpoint action to get supported languages. This is for use to choose | ||
* what language your frontend application can use within its translations. | ||
* | ||
* @OA\Response( | ||
* response=200, | ||
* description="List of language strings.", | ||
* @OA\Schema( | ||
* type="array", | ||
* example={"en","fi"}, | ||
* @OA\Items(type="string"), | ||
* ), | ||
* ) | ||
*/ | ||
#[Route( | ||
path: '/v1/localization/language', | ||
methods: [Request::METHOD_GET], | ||
)] | ||
#[OA\Response( | ||
response: 200, | ||
description: 'List of language strings.', | ||
content: new JsonContent( | ||
type: 'array', | ||
items: new OA\Items( | ||
type: 'string', | ||
example: 'en', | ||
), | ||
example: ['en', 'fi'], | ||
), | ||
)] | ||
public function __invoke(): JsonResponse | ||
{ | ||
return new JsonResponse($this->localization->getLanguages()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,8 @@ | |
namespace App\Controller\v1\Localization; | ||
|
||
use App\Service\Localization; | ||
use OpenApi\Annotations as OA; | ||
use OpenApi\Attributes as OA; | ||
use OpenApi\Attributes\JsonContent; | ||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpKernel\Attribute\AsController; | ||
|
@@ -18,12 +19,11 @@ | |
/** | ||
* Class LocaleController | ||
* | ||
* @OA\Tag(name="Localization") | ||
* | ||
* @package App\Controller\v1\Localization | ||
* @author TLe, Tarmo Leppänen <[email protected]> | ||
*/ | ||
#[AsController] | ||
#[OA\Tag(name: 'Localization')] | ||
class LocaleController | ||
{ | ||
public function __construct( | ||
|
@@ -35,21 +35,23 @@ public function __construct( | |
* Endpoint action to get supported locales. This is for use to choose what | ||
* locale your frontend application can use within its number, time, date, | ||
* datetime, etc. formatting. | ||
* | ||
* @OA\Response( | ||
* response=200, | ||
* description="List of locale strings.", | ||
* @OA\Schema( | ||
* type="array", | ||
* example={"en","fi"}, | ||
* @OA\Items(type="string"), | ||
* ), | ||
* ) | ||
*/ | ||
#[Route( | ||
path: '/v1/localization/locale', | ||
methods: [Request::METHOD_GET], | ||
)] | ||
#[OA\Response( | ||
response: 200, | ||
description: 'List of locale strings.', | ||
content: new JsonContent( | ||
type: 'array', | ||
items: new OA\Items( | ||
type: 'string', | ||
example: 'en', | ||
), | ||
example: ['en', 'fi'], | ||
), | ||
)] | ||
public function __invoke(): JsonResponse | ||
{ | ||
return new JsonResponse($this->localization->getLocales()); | ||
|
Oops, something went wrong.