From 48eba8a01b840d9ed2eacfbb4744852ba72bc4c7 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 2 Oct 2025 12:22:57 -0300 Subject: [PATCH 1/7] feat: Extend Swagger Coverage for controller Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php --- ...SpeakerOrganizationalRoleApiController.php | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php index 9df3d807a..838f467af 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php @@ -18,6 +18,7 @@ use models\exceptions\ValidationException; use utils\PagingResponse; use Illuminate\Support\Facades\Request; +use OpenApi\Attributes as OA; /** * Class OAuth2SpeakerOrganizationalRoleApiController * @package App\Http\Controllers @@ -40,6 +41,32 @@ public function __construct $this->repository = $repository; } + #[OA\Get( + path: '/api/v1/speakers/organizational-roles', + summary: 'Get all default speaker organizational roles', + description: 'Retrieves a list of default organizational roles for speakers. These are predefined role types that speakers can select to describe their position or role within an organization (e.g., "Developer", "Manager", "Architect", "Executive"). Public endpoint accessible without authentication.', + operationId: 'getAllSpeakerOrganizationalRoles', + tags: ['Speakers'], + parameters: [ + new OA\Parameter( + name: 'expand', + in: 'query', + required: false, + description: 'Comma-separated list of related resources to expand', + schema: new OA\Schema(type: 'string', example: '') + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Organizational roles retrieved successfully', + content: new OA\JsonContent(ref: '#/components/schemas/SpeakerOrganizationalRolesResponse') + ), + new OA\Response(response: 404, ref: '#/components/responses/404'), + new OA\Response(response: 412, ref: '#/components/responses/412'), + new OA\Response(response: 500, ref: '#/components/responses/500'), + ] + )] /** * @return mixed */ @@ -68,4 +95,4 @@ public function getAll() return $this->error500($ex); } } -} \ No newline at end of file +} From 376bdde2fa4e5eb09fcbcc2a9c4a86bdd26426bb Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Wed, 8 Oct 2025 18:56:55 -0300 Subject: [PATCH 2/7] fix: incorrect types and descriptions for errors --- .../OAuth2SpeakerOrganizationalRoleApiController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php index 838f467af..6c17646ef 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php @@ -16,6 +16,7 @@ use Illuminate\Support\Facades\Log; use models\exceptions\EntityNotFoundException; use models\exceptions\ValidationException; +use Symfony\Component\HttpFoundation\Response; use utils\PagingResponse; use Illuminate\Support\Facades\Request; use OpenApi\Attributes as OA; @@ -62,9 +63,9 @@ public function __construct description: 'Organizational roles retrieved successfully', content: new OA\JsonContent(ref: '#/components/schemas/SpeakerOrganizationalRolesResponse') ), - new OA\Response(response: 404, ref: '#/components/responses/404'), - new OA\Response(response: 412, ref: '#/components/responses/412'), - new OA\Response(response: 500, ref: '#/components/responses/500'), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "not found"), + new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"), + new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), ] )] /** From 40662f5c795c5513e3a4250a6451cdff857d7b48 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Wed, 8 Oct 2025 18:58:32 -0300 Subject: [PATCH 3/7] fix: Move schema to the new file --- app/Swagger/SummitSpeakersSchemas.php | 44 +++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/app/Swagger/SummitSpeakersSchemas.php b/app/Swagger/SummitSpeakersSchemas.php index 6cd22d65a..5a1a0deac 100644 --- a/app/Swagger/SummitSpeakersSchemas.php +++ b/app/Swagger/SummitSpeakersSchemas.php @@ -4,6 +4,8 @@ use OpenApi\Attributes as OA; +// + #[OA\Schema( schema: 'SpeakerActiveInvolvement', type: 'object', @@ -15,7 +17,9 @@ new OA\Property(property: 'is_default', type: 'boolean', example: true), ] )] -class SpeakerActiveInvolvementSchema {} +class SpeakerActiveInvolvementSchema +{ +} #[OA\Schema( schema: 'SpeakerActiveInvolvementsResponse', @@ -32,4 +36,40 @@ class SpeakerActiveInvolvementSchema {} ), ] )] -class SpeakerActiveInvolvementsResponseSchema {} +class SpeakerActiveInvolvementsResponseSchema +{ +} + +#[OA\Schema( + schema: 'SpeakerOrganizationalRole', + type: 'object', + properties: [ + new OA\Property(property: 'id', type: 'integer', example: 1), + new OA\Property(property: 'created', type: 'integer', format: 'int64', example: 1633024800), + new OA\Property(property: 'last_edited', type: 'integer', format: 'int64', example: 1633024800), + new OA\Property(property: 'role', type: 'string', example: 'Developer'), + new OA\Property(property: 'is_default', type: 'boolean', example: true), + ] +)] +class SpeakerOrganizationalRoleSchema +{ +} + +#[OA\Schema( + schema: 'SpeakerOrganizationalRolesResponse', + type: 'object', + properties: [ + new OA\Property(property: 'total', type: 'integer', example: 8), + new OA\Property(property: 'per_page', type: 'integer', example: 8), + new OA\Property(property: 'current_page', type: 'integer', example: 1), + new OA\Property(property: 'last_page', type: 'integer', example: 1), + new OA\Property( + property: 'data', + type: 'array', + items: new OA\Items(ref: '#/components/schemas/SpeakerOrganizationalRole') + ), + ] +)] +class SpeakerOrganizationalRolesResponseSchema +{ +} \ No newline at end of file From f855c418d5352370854c76dac2429a73e7d13e77 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 31 Oct 2025 15:14:55 -0300 Subject: [PATCH 4/7] fix: add the right security schema --- .../Summit/OAuth2SpeakerOrganizationalRoleApiController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php index 6c17646ef..3466d2f78 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php @@ -45,8 +45,12 @@ public function __construct #[OA\Get( path: '/api/v1/speakers/organizational-roles', summary: 'Get all default speaker organizational roles', - description: 'Retrieves a list of default organizational roles for speakers. These are predefined role types that speakers can select to describe their position or role within an organization (e.g., "Developer", "Manager", "Architect", "Executive"). Public endpoint accessible without authentication.', + description: 'Retrieves a list of default organizational roles for speakers. These are predefined role types that speakers can select to describe their position or role within an organization (e.g., "Developer", "Manager", "Architect", "Executive").', operationId: 'getAllSpeakerOrganizationalRoles', + security: [['summit_rsvp_oauth2' => [ + SummitScopes::ReadSummitData, + SummitScopes::ReadAllSummitData + ]]], tags: ['Speakers'], parameters: [ new OA\Parameter( From add2f0d507ca99e91ed6e6d370a9dc30c575292a Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 7 Nov 2025 20:59:40 +0000 Subject: [PATCH 5/7] fix: security scopes --- .../Summit/OAuth2SpeakerOrganizationalRoleApiController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php index 3466d2f78..ce7be46a0 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php @@ -47,7 +47,7 @@ public function __construct summary: 'Get all default speaker organizational roles', description: 'Retrieves a list of default organizational roles for speakers. These are predefined role types that speakers can select to describe their position or role within an organization (e.g., "Developer", "Manager", "Architect", "Executive").', operationId: 'getAllSpeakerOrganizationalRoles', - security: [['summit_rsvp_oauth2' => [ + security: [['oauth2_scopes' => [ SummitScopes::ReadSummitData, SummitScopes::ReadAllSummitData ]]], From 6c97f6b46d0d47e9a194dad492d7581acab039ff Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Tue, 11 Nov 2025 21:44:15 +0000 Subject: [PATCH 6/7] fix: Security schema --- ...SpeakerOrganizationalRoleApiController.php | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php index ce7be46a0..011b2040b 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php @@ -12,6 +12,7 @@ * limitations under the License. **/ use App\Models\Foundation\Summit\Repositories\ISpeakerOrganizationalRoleRepository; +use App\Security\SummitScopes; use models\oauth2\IResourceServerContext; use Illuminate\Support\Facades\Log; use models\exceptions\EntityNotFoundException; @@ -20,6 +21,26 @@ use utils\PagingResponse; use Illuminate\Support\Facades\Request; use OpenApi\Attributes as OA; + + +#[OA\SecurityScheme( + type: 'oauth2', + securityScheme: 'speaker_organizational_role_oauth2', + flows: [ + new OA\Flow( + authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, + tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, + flow: 'authorizationCode', + scopes: [ + SummitScopes::ReadAllSummitData => 'Read All Summit Data', + SummitScopes::ReadSummitData => 'Read Summit Data', + ], + ), + ], + ) +] +class SpeakerOrganizationalRoleAuthSchema{} + /** * Class OAuth2SpeakerOrganizationalRoleApiController * @package App\Http\Controllers @@ -47,7 +68,7 @@ public function __construct summary: 'Get all default speaker organizational roles', description: 'Retrieves a list of default organizational roles for speakers. These are predefined role types that speakers can select to describe their position or role within an organization (e.g., "Developer", "Manager", "Architect", "Executive").', operationId: 'getAllSpeakerOrganizationalRoles', - security: [['oauth2_scopes' => [ + security: [['speaker_organizational_role_oauth2' => [ SummitScopes::ReadSummitData, SummitScopes::ReadAllSummitData ]]], From b01de0431d9212a34a5d82cec24d032fbb2a65fc Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 13 Nov 2025 19:49:40 +0000 Subject: [PATCH 7/7] chore: Move the security schema for the controller to its own file --- ...SpeakerOrganizationalRoleApiController.php | 19 -------------- .../SpeakerOrganizationalRoleAuthSchema.php | 25 +++++++++++++++++++ 2 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 app/Swagger/Security/SpeakerOrganizationalRoleAuthSchema.php diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php index 011b2040b..6382415f7 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php @@ -22,25 +22,6 @@ use Illuminate\Support\Facades\Request; use OpenApi\Attributes as OA; - -#[OA\SecurityScheme( - type: 'oauth2', - securityScheme: 'speaker_organizational_role_oauth2', - flows: [ - new OA\Flow( - authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, - tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, - flow: 'authorizationCode', - scopes: [ - SummitScopes::ReadAllSummitData => 'Read All Summit Data', - SummitScopes::ReadSummitData => 'Read Summit Data', - ], - ), - ], - ) -] -class SpeakerOrganizationalRoleAuthSchema{} - /** * Class OAuth2SpeakerOrganizationalRoleApiController * @package App\Http\Controllers diff --git a/app/Swagger/Security/SpeakerOrganizationalRoleAuthSchema.php b/app/Swagger/Security/SpeakerOrganizationalRoleAuthSchema.php new file mode 100644 index 000000000..af67d23a2 --- /dev/null +++ b/app/Swagger/Security/SpeakerOrganizationalRoleAuthSchema.php @@ -0,0 +1,25 @@ + 'Read All Summit Data', + SummitScopes::ReadSummitData => 'Read Summit Data', + ], + ), + ], + ) +] +class SpeakerOrganizationalRoleAuthSchema{}