1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-09-15 18:57:05 +00:00

ApiDoc: Add response description to UserRestController

This commit is contained in:
Casper Meijn 2023-07-02 08:27:07 +02:00
parent 0a6826cb4c
commit 4c797162bf
3 changed files with 86 additions and 8 deletions

View file

@ -8,6 +8,8 @@ use FOS\UserBundle\Model\User as BaseUser;
use JMS\Serializer\Annotation\Accessor;
use JMS\Serializer\Annotation\Groups;
use JMS\Serializer\Annotation\XmlRoot;
use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Annotations as OA;
use Scheb\TwoFactorBundle\Model\BackupCodeInterface;
use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface as EmailTwoFactorInterface;
use Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface as GoogleTwoFactorInterface;
@ -40,6 +42,12 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*
* @OA\Property(
* description="The unique numeric id of the user",
* type="int",
* example=12,
* )
*
* @Groups({"user_api", "user_api_with_client"})
*/
protected $id;
@ -49,6 +57,12 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
*
* @ORM\Column(name="name", type="text", nullable=true)
*
* @OA\Property(
* description="The personal Name of the user",
* type="string",
* example="Walla Baggger",
* )
*
* @Groups({"user_api", "user_api_with_client"})
*/
protected $name;
@ -56,6 +70,12 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
/**
* @var string
*
* @OA\Property(
* description="The unique username of the user",
* type="string",
* example="wallabag",
* )
*
* @Groups({"user_api", "user_api_with_client"})
*/
protected $username;
@ -63,6 +83,12 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
/**
* @var string
*
* @OA\Property(
* description="E-mail address of the user",
* type="string",
* example="wallabag@wallabag.io",
* )
*
* @Groups({"user_api", "user_api_with_client"})
*/
protected $email;
@ -72,6 +98,12 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
*
* @ORM\Column(name="created_at", type="datetime")
*
* @OA\Property(
* description="Creation date of the user account. (In ISO 8601 format)",
* type="string",
* example="2023-06-27T19:25:44+0000",
* )
*
* @Groups({"user_api", "user_api_with_client"})
*/
protected $createdAt;
@ -81,6 +113,12 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
*
* @ORM\Column(name="updated_at", type="datetime")
*
* @OA\Property(
* description="Update date of the user account. (In ISO 8601 format)",
* type="string",
* example="2023-06-27T19:37:30+0000",
* )
*
* @Groups({"user_api", "user_api_with_client"})
*/
protected $updatedAt;
@ -112,6 +150,11 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
/**
* @see getFirstClient() below
*
* @OA\Property(
* description="Default client created during user registration. Used for further authorization",
* ref=@Model(type=Client::class, groups={"user_api_with_client"})
* )
*
* @Groups({"user_api_with_client"})
* @Accessor(getter="getFirstClient")
*/