Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix API route names #1194

Merged
merged 1 commit into from
Jul 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Controller/Api/GroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function __construct(GroupManagerInterface $groupManager, FormFactoryInte
* output={"class"="Sonata\DatagridBundle\Pager\PagerInterface", "groups"={"sonata_api_read"}}
* )
*
* @Get("/groups")
* @Get("/groups", name="get_groups")
*
* @QueryParam(name="page", requirements="\d+", default="1", description="Page for groups list pagination (1-indexed)")
* @QueryParam(name="count", requirements="\d+", default="10", description="Number of groups by page")
Expand Down Expand Up @@ -115,7 +115,7 @@ public function getGroupsAction(ParamFetcherInterface $paramFetcher)
* }
* )
*
* @Get("/group/{id}")
* @Get("/group/{id}", name="get_group")
*
* @View(serializerGroups={"sonata_api_read"}, serializerEnableMaxDepthChecks=true)
*
Expand All @@ -140,7 +140,7 @@ public function getGroupAction($id)
* }
* )
*
* @Post("/group")
* @Post("/group", name="post_group")
*
* @param Request $request A Symfony request
*
Expand Down Expand Up @@ -169,7 +169,7 @@ public function postGroupAction(Request $request)
* }
* )
*
* @Put("/group/{id}")
* @Put("/group/{id}", name="put_group")
*
* @param int $id Group identifier
* @param Request $request A Symfony request
Expand Down Expand Up @@ -197,7 +197,7 @@ public function putGroupAction($id, Request $request)
* }
* )
*
* @Delete("/group/{id}")
* @Delete("/group/{id}", name="delete_group")
*
* @param int $id A Group identifier
*
Expand Down
14 changes: 7 additions & 7 deletions src/Controller/Api/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct(UserManagerInterface $userManager, GroupManagerInter
* output={"class"="Sonata\DatagridBundle\Pager\PagerInterface", "groups"={"sonata_api_read"}}
* )
*
* @Get("/users")
* @Get("/users", name="get_users")
*
* @QueryParam(name="page", requirements="\d+", default="1", description="Page for users list pagination (1-indexed)")
* @QueryParam(name="count", requirements="\d+", default="10", description="Number of users by page")
Expand Down Expand Up @@ -119,7 +119,7 @@ public function getUsersAction(ParamFetcherInterface $paramFetcher)
* }
* )
*
* @Get("/user/(id}")
* @Get("/user/(id}", name="get_user")
*
* @View(serializerGroups={"sonata_api_read"}, serializerEnableMaxDepthChecks=true)
*
Expand All @@ -144,7 +144,7 @@ public function getUserAction($id)
* }
* )
*
* @Post("/user")
* @Post("/user", name="post_user")
*
* @param Request $request A Symfony request
*
Expand Down Expand Up @@ -173,7 +173,7 @@ public function postUserAction(Request $request)
* }
* )
*
* @Put("/user/(id}")
* @Put("/user/(id}", name="put_user")
*
* @param int $id User id
* @param Request $request A Symfony request
Expand Down Expand Up @@ -201,7 +201,7 @@ public function putUserAction($id, Request $request)
* }
* )
*
* @Delete("/user/(id}")
* @Delete("/user/(id}", name="delete_user")
*
* @param int $id An User identifier
*
Expand Down Expand Up @@ -234,7 +234,7 @@ public function deleteUserAction($id)
* }
* )
*
* @Post("/user/(userId}/{groupId}")
* @Post("/user/(userId}/{groupId}", name="post_user_group")
*
* @param int $userId A User identifier
* @param int $groupId A Group identifier
Expand Down Expand Up @@ -277,7 +277,7 @@ public function postUserGroupAction($userId, $groupId)
* }
* )
*
* @Delete("/user/(userId}/{groupId}")
* @Delete("/user/(userId}/{groupId}", name="delete_user_group")
*
* @param int $userId A User identifier
* @param int $groupId A Group identifier
Expand Down
24 changes: 12 additions & 12 deletions tests/Functional/Routing/RoutingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ public function testRoutes(string $name, string $path, array $methods): void
public function getRoutes(): iterable
{
yield ['nelmio_api_doc_index', '/api/doc/{view}', ['GET']];
yield ['sonata_api_user_user_sonata_user_api_user_getusers', '/api/user/users', ['GET']];
yield ['sonata_api_user_user_sonata_user_api_user_getuser', '/api/user/user/(id}', ['GET']];
yield ['sonata_api_user_user_sonata_user_api_user_postuser', '/api/user/user', ['POST']];
yield ['sonata_api_user_user_sonata_user_api_user_putuser', '/api/user/user/(id}', ['PUT']];
yield ['sonata_api_user_user_sonata_user_api_user_deleteuser', '/api/user/user/(id}', ['DELETE']];
yield ['sonata_api_user_user_sonata_user_api_user_postusergroup', '/api/user/user/(userId}/{groupId}', ['POST']];
yield ['sonata_api_user_user_sonata_user_api_user_deleteusergroup', '/api/user/user/(userId}/{groupId}', ['DELETE']];
yield ['sonata_api_user_group_sonata_user_api_group_getgroups', '/api/user/groups', ['GET']];
yield ['sonata_api_user_group_sonata_user_api_group_getgroup', '/api/user/group/{id}', ['GET']];
yield ['sonata_api_user_group_sonata_user_api_group_postgroup', '/api/user/group', ['POST']];
yield ['sonata_api_user_group_sonata_user_api_group_putgroup', '/api/user/group/{id}', ['PUT']];
yield ['sonata_api_user_group_sonata_user_api_group_deletegroup', '/api/user/group/{id}', ['DELETE']];
yield ['sonata_api_user_user_get_users', '/api/user/users', ['GET']];
yield ['sonata_api_user_user_get_user', '/api/user/user/(id}', ['GET']];
yield ['sonata_api_user_user_post_user', '/api/user/user', ['POST']];
yield ['sonata_api_user_user_put_user', '/api/user/user/(id}', ['PUT']];
yield ['sonata_api_user_user_delete_user', '/api/user/user/(id}', ['DELETE']];
yield ['sonata_api_user_user_post_user_group', '/api/user/user/(userId}/{groupId}', ['POST']];
yield ['sonata_api_user_user_delete_user_group', '/api/user/user/(userId}/{groupId}', ['DELETE']];
yield ['sonata_api_user_group_get_groups', '/api/user/groups', ['GET']];
yield ['sonata_api_user_group_get_group', '/api/user/group/{id}', ['GET']];
yield ['sonata_api_user_group_post_group', '/api/user/group', ['POST']];
yield ['sonata_api_user_group_put_group', '/api/user/group/{id}', ['PUT']];
yield ['sonata_api_user_group_delete_group', '/api/user/group/{id}', ['DELETE']];
}

protected static function getKernelClass(): string
Expand Down