Skip to content

Commit

Permalink
replace deprecated RestRoute attribute with SF native one
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpapst committed Jan 2, 2024
1 parent 830925f commit 25a741f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions API/DemoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use OpenApi\Attributes as OA;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;

#[Route(path: '/demos')]
Expand All @@ -37,7 +37,7 @@ public function __construct(private ViewHandlerInterface $viewHandler)
*/
#[OA\Response(response: 200, description: 'Returns a collection of demo entities', content: new OA\JsonContent(type: 'array', items: new OA\Items(ref: '#/components/schemas/DemoEntity')))]
#[Rest\QueryParam(name: 'counter', requirements: '\d+', strict: true, nullable: true, description: 'The counter to be included in the answer (default: 1)')]
#[Rest\Get]
#[Route(methods: ['GET'])]
#[ApiSecurity(name: 'apiUser')]
#[ApiSecurity(name: 'apiToken')]
public function cgetAction(ParamFetcherInterface $paramFetcher): Response
Expand All @@ -60,7 +60,7 @@ public function cgetAction(ParamFetcherInterface $paramFetcher): Response
*/
#[OA\Response(response: 200, description: 'Returns one demo entity (if you pass id = 0, a NotFoundException will be thrown)', content: new OA\JsonContent(ref: '#/components/schemas/DemoEntity'))]
#[OA\Parameter(name: 'id', in: 'path', description: 'Demo ID to fetch', required: true)]
#[Rest\Get(path: '/{id}')]
#[Route(methods: ['GET'], path: '/{id}')]
#[ApiSecurity(name: 'apiUser')]
#[ApiSecurity(name: 'apiToken')]
public function getAction(int $id): Response
Expand Down

0 comments on commit 25a741f

Please sign in to comment.