From 4d0f1e7688b601efa82de9a951581ca2c70fd999 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Wed, 1 Oct 2025 19:23:37 -0300 Subject: [PATCH 1/9] feat: Extend Swagger Coverage for controller Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php --- ...2SpeakerActiveInvolvementApiController.php | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php index efd5ee260..483c947d1 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php @@ -18,6 +18,7 @@ use models\exceptions\ValidationException; use utils\PagingResponse; use Illuminate\Support\Facades\Request; +use OpenApi\Attributes as OA; /** * Class OAuth2SpeakerActiveInvolvementApiController * @package App\Http\Controllers @@ -40,6 +41,32 @@ public function __construct $this->repository = $repository; } + #[OA\Get( + path: '/api/v1/speakers/active-involvements', + summary: 'Get all default speaker active involvements', + description: 'Retrieves a list of default active involvements for speakers. These are predefined involvement types that speakers can select to describe their current activities (e.g., "Active Contributor", "User", "Evaluator"). Public endpoint accessible without authentication.', + operationId: 'getAllSpeakerActiveInvolvements', + 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: 'Active involvements retrieved successfully', + content: new OA\JsonContent(ref: '#/components/schemas/SpeakerActiveInvolvementsResponse') + ), + 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 */ @@ -71,4 +98,4 @@ public function getAll(){ return $this->error500($ex); } } -} \ No newline at end of file +} From aaccd94045c30418ec9d0030e9e7952b2e399792 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Wed, 8 Oct 2025 18:48:51 -0300 Subject: [PATCH 2/9] fix: incorrect types and descriptions for errors --- .../Summit/OAuth2SpeakerActiveInvolvementApiController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php index 483c947d1..03f482a1f 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php @@ -62,9 +62,9 @@ public function __construct description: 'Active involvements retrieved successfully', content: new OA\JsonContent(ref: '#/components/schemas/SpeakerActiveInvolvementsResponse') ), - 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 2e1a10eea81fdcb8363a74d89d9694bceb5665a4 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Wed, 8 Oct 2025 18:52:42 -0300 Subject: [PATCH 3/9] fix: Move schema to the new file --- ...2SpeakerActiveInvolvementApiController.php | 1 + app/Swagger/SummitSpeakersSchemas.php | 30 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php index 03f482a1f..b8cccbe60 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.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; diff --git a/app/Swagger/SummitSpeakersSchemas.php b/app/Swagger/SummitSpeakersSchemas.php index 6b3e2f895..6cd22d65a 100644 --- a/app/Swagger/SummitSpeakersSchemas.php +++ b/app/Swagger/SummitSpeakersSchemas.php @@ -4,4 +4,32 @@ use OpenApi\Attributes as OA; -// +#[OA\Schema( + schema: 'SpeakerActiveInvolvement', + 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: 'involvement', type: 'string', example: 'Active Contributor'), + new OA\Property(property: 'is_default', type: 'boolean', example: true), + ] +)] +class SpeakerActiveInvolvementSchema {} + +#[OA\Schema( + schema: 'SpeakerActiveInvolvementsResponse', + type: 'object', + properties: [ + new OA\Property(property: 'total', type: 'integer', example: 5), + new OA\Property(property: 'per_page', type: 'integer', example: 5), + 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/SpeakerActiveInvolvement') + ), + ] +)] +class SpeakerActiveInvolvementsResponseSchema {} From 4ef809b7311936bd65333e1fde809460e995fad2 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Tue, 14 Oct 2025 14:16:56 -0300 Subject: [PATCH 4/9] fix: Change "namespace" word positioning --- .../Summit/OAuth2SpeakerActiveInvolvementApiController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php index b8cccbe60..1c54daf1e 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php @@ -1,4 +1,7 @@ - Date: Fri, 31 Oct 2025 13:34:08 -0300 Subject: [PATCH 5/9] chore: Add security param --- .../Summit/OAuth2SpeakerActiveInvolvementApiController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php index 1c54daf1e..6a8fca3c6 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php @@ -50,6 +50,7 @@ public function __construct summary: 'Get all default speaker active involvements', description: 'Retrieves a list of default active involvements for speakers. These are predefined involvement types that speakers can select to describe their current activities (e.g., "Active Contributor", "User", "Evaluator"). Public endpoint accessible without authentication.', operationId: 'getAllSpeakerActiveInvolvements', + security: [['Bearer' => []]], tags: ['Speakers'], parameters: [ new OA\Parameter( From 08c219a1f2288dfccb356e906bc88c895340d5d8 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 7 Nov 2025 18:44:45 +0000 Subject: [PATCH 6/9] fix: security scopes --- .../Summit/OAuth2SpeakerActiveInvolvementApiController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php index 6a8fca3c6..16308453e 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php @@ -50,7 +50,10 @@ public function __construct summary: 'Get all default speaker active involvements', description: 'Retrieves a list of default active involvements for speakers. These are predefined involvement types that speakers can select to describe their current activities (e.g., "Active Contributor", "User", "Evaluator"). Public endpoint accessible without authentication.', operationId: 'getAllSpeakerActiveInvolvements', - security: [['Bearer' => []]], + security: [['oauth2_scopes' => [ + SummitScopes::ReadSummitData, + SummitScopes::ReadAllSummitData, + ]]], tags: ['Speakers'], parameters: [ new OA\Parameter( From 8a85d09f8467c73a6e170b8a218caa14c8684ad8 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Tue, 11 Nov 2025 21:46:17 +0000 Subject: [PATCH 7/9] fix: Security schema --- ...2SpeakerActiveInvolvementApiController.php | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php index 16308453e..b3ec31394 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php @@ -15,6 +15,7 @@ * limitations under the License. **/ use App\Models\Foundation\Summit\Repositories\ISpeakerActiveInvolvementRepository; +use App\Security\SummitScopes; use models\oauth2\IResourceServerContext; use Illuminate\Support\Facades\Log; use models\exceptions\EntityNotFoundException; @@ -23,6 +24,28 @@ use utils\PagingResponse; use Illuminate\Support\Facades\Request; use OpenApi\Attributes as OA; + + +#[ + OA\SecurityScheme( + type: 'oauth2', + securityScheme: 'speaker_active_involvement_oauth2', + flows: [ + new OA\Flow( + authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, + tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, + flow: 'authorizationCode', + scopes: [ + SummitScopes::ReadSummitData => 'Read Summit Data', + SummitScopes::ReadAllSummitData => 'Read All Summit Data', + ], + ), + ], + ) +] +class SpeakerActiveInvolvementAuthSchema{} + + /** * Class OAuth2SpeakerActiveInvolvementApiController * @package App\Http\Controllers @@ -50,7 +73,7 @@ public function __construct summary: 'Get all default speaker active involvements', description: 'Retrieves a list of default active involvements for speakers. These are predefined involvement types that speakers can select to describe their current activities (e.g., "Active Contributor", "User", "Evaluator"). Public endpoint accessible without authentication.', operationId: 'getAllSpeakerActiveInvolvements', - security: [['oauth2_scopes' => [ + security: [['speaker_active_involvement_oauth2' => [ SummitScopes::ReadSummitData, SummitScopes::ReadAllSummitData, ]]], From e0a9988b09e50806e436e66e372aa40648bc0129 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 13 Nov 2025 19:48:17 +0000 Subject: [PATCH 8/9] chore: Move the security schema for the controller to its own file --- ...2SpeakerActiveInvolvementApiController.php | 21 ---------------- .../SpeakerActiveInvolvementAuthSchema.php | 25 +++++++++++++++++++ 2 files changed, 25 insertions(+), 21 deletions(-) create mode 100644 app/Swagger/Security/SpeakerActiveInvolvementAuthSchema.php diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php index b3ec31394..2d43043bb 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php @@ -25,27 +25,6 @@ use Illuminate\Support\Facades\Request; use OpenApi\Attributes as OA; - -#[ - OA\SecurityScheme( - type: 'oauth2', - securityScheme: 'speaker_active_involvement_oauth2', - flows: [ - new OA\Flow( - authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, - tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, - flow: 'authorizationCode', - scopes: [ - SummitScopes::ReadSummitData => 'Read Summit Data', - SummitScopes::ReadAllSummitData => 'Read All Summit Data', - ], - ), - ], - ) -] -class SpeakerActiveInvolvementAuthSchema{} - - /** * Class OAuth2SpeakerActiveInvolvementApiController * @package App\Http\Controllers diff --git a/app/Swagger/Security/SpeakerActiveInvolvementAuthSchema.php b/app/Swagger/Security/SpeakerActiveInvolvementAuthSchema.php new file mode 100644 index 000000000..775070bcf --- /dev/null +++ b/app/Swagger/Security/SpeakerActiveInvolvementAuthSchema.php @@ -0,0 +1,25 @@ + 'Read Summit Data', + SummitScopes::ReadAllSummitData => 'Read All Summit Data', + ], + ), + ], + ) +] +class SpeakerActiveInvolvementAuthSchema{} From f71c24de56d5d5568e71f7f33587b91acca76646 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 21 Nov 2025 18:51:42 +0000 Subject: [PATCH 9/9] chore: include PR requested changes --- ...2SpeakerActiveInvolvementApiController.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php index 2d43043bb..a004ee3c0 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php @@ -41,8 +41,7 @@ public function __construct ( ISpeakerActiveInvolvementRepository $repository, IResourceServerContext $resource_server_context - ) - { + ) { parent::__construct($resource_server_context); $this->repository = $repository; } @@ -50,19 +49,23 @@ public function __construct #[OA\Get( path: '/api/v1/speakers/active-involvements', summary: 'Get all default speaker active involvements', - description: 'Retrieves a list of default active involvements for speakers. These are predefined involvement types that speakers can select to describe their current activities (e.g., "Active Contributor", "User", "Evaluator"). Public endpoint accessible without authentication.', + description: 'Retrieves a list of default active involvements for speakers. These are predefined involvement types that speakers can select to describe their current activities (e.g., "Active Contributor", "User", "Evaluator").', operationId: 'getAllSpeakerActiveInvolvements', - security: [['speaker_active_involvement_oauth2' => [ - SummitScopes::ReadSummitData, - SummitScopes::ReadAllSummitData, - ]]], + security: [ + [ + 'speaker_active_involvement_oauth2' => [ + SummitScopes::ReadSummitData, + SummitScopes::ReadAllSummitData, + ] + ] + ], tags: ['Speakers'], parameters: [ new OA\Parameter( name: 'expand', in: 'query', required: false, - description: 'Comma-separated list of related resources to expand', + description: 'No expandable relationships available for this resource', schema: new OA\Schema(type: 'string', example: '') ), ],