diff --git a/src/OpenApi/Schema/UserInformation.php b/src/OpenApi/Schema/UserInformation.php index c9257417..ad335dd2 100644 --- a/src/OpenApi/Schema/UserInformation.php +++ b/src/OpenApi/Schema/UserInformation.php @@ -28,7 +28,7 @@ #[Schema( title: 'User Information', description: 'Information about the user', - required: ['username', 'permissions', 'isAdmin'], + required: ['id', 'username', 'permissions', 'isAdmin'], type: 'object' )] final class UserInformation implements AdditionalAttributesInterface @@ -36,6 +36,8 @@ final class UserInformation implements AdditionalAttributesInterface use AdditionalAttributesTrait; public function __construct( + #[Property(description: 'User ID', type: 'integer', example: 1)] + private readonly int $id, #[Property(description: 'Username', type: 'string', example: 'admin')] private readonly string $username, #[Property( @@ -49,6 +51,11 @@ public function __construct( ) { } + public function getId(): int + { + return $this->id; + } + public function getPermissions(): array { return $this->permissions; @@ -59,7 +66,7 @@ public function getUsername(): string return $this->username; } - public function hasIsAdmin(): bool + public function getIsAdmin(): bool { return $this->isAdmin; } diff --git a/src/User/Hydrator/UserInformationHydrator.php b/src/User/Hydrator/UserInformationHydrator.php index 0570a95b..ab11d92c 100644 --- a/src/User/Hydrator/UserInformationHydrator.php +++ b/src/User/Hydrator/UserInformationHydrator.php @@ -27,6 +27,7 @@ final class UserInformationHydrator implements UserInformationHydratorInterface public function hydrate(UserInterface $user): UserInformation { return new UserInformation( + $user->getId(), $user->getUsername(), $user->getPermissions(), $user->isAdmin()