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

Update Swagger definition in order to be compatible with string identifiers #1198

Merged
merged 1 commit into from
Sep 2, 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
18 changes: 9 additions & 9 deletions src/Controller/Api/GroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function getGroupsAction(ParamFetcherInterface $paramFetcher)
*
* @ApiDoc(
* requirements={
* {"name"="id", "dataType"="integer", "requirement"="\d+", "description"="group id"}
* {"name"="id", "dataType"="string", "description"="Group identifier"}
* },
* output={"class"="FOS\UserBundle\Model\GroupInterface", "groups"={"sonata_api_read"}},
* statusCodes={
Expand All @@ -111,7 +111,7 @@ public function getGroupsAction(ParamFetcherInterface $paramFetcher)
*
* @View(serializerGroups={"sonata_api_read"}, serializerEnableMaxDepthChecks=true)
*
* @param $id
* @param string $id
wbloszyk marked this conversation as resolved.
Show resolved Hide resolved
*
* @return GroupInterface
*/
Expand Down Expand Up @@ -148,7 +148,7 @@ public function postGroupAction(Request $request)
*
* @ApiDoc(
* requirements={
* {"name"="id", "dataType"="integer", "requirement"="\d+", "description"="group identifier"}
* {"name"="id", "dataType"="string", "description"="Group identifier"}
* },
* input={"class"="sonata_user_api_form_group", "name"="", "groups"={"sonata_api_write"}},
* output={"class"="Sonata\UserBundle\Model\Group", "groups"={"sonata_api_read"}},
Expand All @@ -159,7 +159,7 @@ public function postGroupAction(Request $request)
* }
* )
*
* @param int $id Group identifier
* @param string $id Group identifier
* @param Request $request A Symfony request
phansys marked this conversation as resolved.
Show resolved Hide resolved
*
* @throws NotFoundHttpException
Expand All @@ -176,7 +176,7 @@ public function putGroupAction($id, Request $request)
*
* @ApiDoc(
* requirements={
* {"name"="id", "dataType"="integer", "requirement"="\d+", "description"="group identifier"}
* {"name"="id", "dataType"="string", "description"="Group identifier"}
* },
* statusCodes={
* 200="Returned when group is successfully deleted",
Expand All @@ -185,7 +185,7 @@ public function putGroupAction($id, Request $request)
* }
* )
*
* @param int $id A Group identifier
* @param string $id A Group identifier
*
* @throws NotFoundHttpException
*
Expand All @@ -203,8 +203,8 @@ public function deleteGroupAction($id)
/**
* Write a Group, this method is used by both POST and PUT action methods.
*
* @param Request $request Symfony request
* @param int|null $id A Group identifier
* @param Request $request Symfony request
* @param string|null $id A Group identifier
*
* @return FormInterface
*/
Expand Down Expand Up @@ -239,7 +239,7 @@ protected function handleWriteGroup($request, $id = null)
/**
* Retrieves group with id $id or throws an exception if it doesn't exist.
*
* @param $id
* @param string $id
*
* @throws NotFoundHttpException
*
Expand Down
36 changes: 18 additions & 18 deletions src/Controller/Api/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function getUsersAction(ParamFetcherInterface $paramFetcher)
*
* @ApiDoc(
* requirements={
* {"name"="id", "dataType"="integer", "requirement"="\d+", "description"="user id"}
* {"name"="id", "dataType"="string", "description"="User identifier"}
* },
* output={"class"="Sonata\UserBundle\Model\UserInterface", "groups"={"sonata_api_read"}},
* statusCodes={
Expand All @@ -115,7 +115,7 @@ public function getUsersAction(ParamFetcherInterface $paramFetcher)
*
* @View(serializerGroups={"sonata_api_read"}, serializerEnableMaxDepthChecks=true)
*
* @param $id
* @param string $id
*
* @return UserInterface
*/
Expand Down Expand Up @@ -152,7 +152,7 @@ public function postUserAction(Request $request)
*
* @ApiDoc(
* requirements={
* {"name"="id", "dataType"="integer", "requirement"="\d+", "description"="user identifier"}
* {"name"="id", "dataType"="string", "description"="User identifier"}
* },
* input={"class"="sonata_user_api_form_user", "name"="", "groups"={"sonata_api_write"}},
* output={"class"="Sonata\UserBundle\Model\User", "groups"={"sonata_api_read"}},
Expand All @@ -163,7 +163,7 @@ public function postUserAction(Request $request)
* }
* )
*
* @param int $id User id
* @param string $id User id
* @param Request $request A Symfony request
*
* @throws NotFoundHttpException
Expand All @@ -180,7 +180,7 @@ public function putUserAction($id, Request $request)
*
* @ApiDoc(
* requirements={
* {"name"="id", "dataType"="integer", "requirement"="\d+", "description"="user identifier"}
* {"name"="id", "dataType"="string", "description"="User identifier"}
* },
* statusCodes={
* 200="Returned when user is successfully deleted",
Expand All @@ -189,7 +189,7 @@ public function putUserAction($id, Request $request)
* }
* )
*
* @param int $id An User identifier
* @param string $id An User identifier
*
* @throws NotFoundHttpException
*
Expand All @@ -209,8 +209,8 @@ public function deleteUserAction($id)
*
* @ApiDoc(
* requirements={
* {"name"="userId", "dataType"="integer", "requirement"="\d+", "description"="user identifier"},
* {"name"="groupId", "dataType"="integer", "requirement"="\d+", "description"="group identifier"}
* {"name"="userId", "dataType"="string", "description"="User identifier"},
* {"name"="groupId", "dataType"="string", "description"="Group identifier"}
* },
* output={"class"="Sonata\UserBundle\Model\User", "groups"={"sonata_api_read"}},
* statusCodes={
Expand All @@ -220,8 +220,8 @@ public function deleteUserAction($id)
* }
* )
*
* @param int $userId A User identifier
* @param int $groupId A Group identifier
* @param string $userId A User identifier
* @param string $groupId A Group identifier
*
* @throws NotFoundHttpException
* @throws \RuntimeException
Expand Down Expand Up @@ -250,8 +250,8 @@ public function postUserGroupAction($userId, $groupId)
*
* @ApiDoc(
* requirements={
* {"name"="userId", "dataType"="integer", "requirement"="\d+", "description"="user identifier"},
* {"name"="groupId", "dataType"="integer", "requirement"="\d+", "description"="group identifier"}
* {"name"="userId", "dataType"="string", "description"="User identifier"},
* {"name"="groupId", "dataType"="string", "description"="Group identifier"}
* },
* output={"class"="Sonata\UserBundle\Model\User", "groups"={"sonata_api_read"}},
* statusCodes={
Expand All @@ -261,8 +261,8 @@ public function postUserGroupAction($userId, $groupId)
* }
* )
*
* @param int $userId A User identifier
* @param int $groupId A Group identifier
* @param string $userId A User identifier
* @param string $groupId A Group identifier
*
* @throws NotFoundHttpException
* @throws \RuntimeException
Expand All @@ -289,7 +289,7 @@ public function deleteUserGroupAction($userId, $groupId)
/**
* Retrieves user with id $id or throws an exception if it doesn't exist.
*
* @param $id
* @param string $id
*
* @throws NotFoundHttpException
*
Expand All @@ -309,7 +309,7 @@ protected function getUser($id)
/**
* Retrieves user with id $id or throws an exception if it doesn't exist.
*
* @param $id
* @param string $id
*
* @throws NotFoundHttpException
*
Expand All @@ -329,8 +329,8 @@ protected function getGroup($id)
/**
* Write an User, this method is used by both POST and PUT action methods.
*
* @param Request $request Symfony request
* @param int|null $id An User identifier
* @param Request $request Symfony request
* @param string|null $id An User identifier
*
* @return FormInterface
*/
Expand Down