From 61067ac49cb76e9635cbbac1e6932a2a3f2c5c94 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 9 Oct 2025 13:11:38 -0300 Subject: [PATCH 1/4] feat: Extend Swagger Coverage for controller `OAuth2SummitPresentationActionTypeApiController` --- ...mitPresentationActionTypeApiController.php | 193 +++++++++++++++++- app/Swagger/SummitPresentationSchemas.php | 52 +++++ 2 files changed, 242 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php index 9daabb3ee..5353d82e3 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php @@ -15,6 +15,7 @@ use App\Http\Utils\EpochCellFormatter; use App\Models\Foundation\Summit\Repositories\IPresentationActionTypeRepository; use App\Services\Model\ISummitPresentationActionTypeService; +use Illuminate\Http\Response; use Illuminate\Support\Facades\Input; use models\exceptions\ValidationException; use models\oauth2\IResourceServerContext; @@ -22,6 +23,7 @@ use models\summit\Summit; use models\utils\IEntity; use ModelSerializers\SerializerRegistry; +use OpenApi\Attributes as OA; use utils\Filter; use utils\FilterElement; @@ -84,7 +86,7 @@ protected function addChild(Summit $summit, array $payload): IEntity /** * @inheritDoc */ - function getAddValidationRules(array $payload): array + public function getAddValidationRules(array $payload): array { return SummitPresentationActionTypeValidationRulesFactory::build($payload, false); } @@ -116,7 +118,7 @@ protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity /** * @inheritDoc */ - function getUpdateValidationRules(array $payload): array + public function getUpdateValidationRules(array $payload): array { return SummitPresentationActionTypeValidationRulesFactory::build($payload, true); } @@ -133,6 +135,160 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I * @param $summit_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Post( + path: '/api/v1/summits/{id}/presentation-action-types', + summary: 'Create a new presentation action type', + security: [['OAuth2' => ['openid', 'profile', 'email']]], + tags: ['Summits', 'Presentation Action Types'], + parameters: [ + new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID', schema: new OA\Schema(type: 'integer')), + ], + requestBody: new OA\RequestBody( + required: true, + content: new OA\JsonContent(ref: '#/components/schemas/PresentationActionTypeCreateRequest') + ), + responses: [ + new OA\Response( + response: Response::HTTP_CREATED, + description: 'Presentation action type created', + content: new OA\JsonContent(ref: '#/components/schemas/PresentationActionType') + ), + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), + 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"), + ] + )] + public function add($summit_id){ + return parent::add($summit_id); + } + + /** + * @param $summit_id + * @param $action_id + * @return \Illuminate\Http\JsonResponse|mixed + */ + #[OA\Get( + path: '/api/v1/summits/{id}/presentation-action-types/{action_id}', + summary: 'Get a presentation action type by ID', + security: [['OAuth2' => ['openid', 'profile', 'email']]], + tags: ['Summits', 'Presentation Action Types'], + parameters: [ + new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID', schema: new OA\Schema(type: 'integer')), + new OA\Parameter(name: 'action_id', in: 'path', required: true, description: 'Presentation Action Type ID', schema: new OA\Schema(type: 'integer')), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: 'Successful response', + content: new OA\JsonContent(ref: '#/components/schemas/PresentationActionType') + ), + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Not found"), + new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), + ] + )] + public function get($summit_id, $action_id){ + return parent::get($summit_id, $action_id); + } + + /** + * @param $summit_id + * @param $action_id + * @return \Illuminate\Http\JsonResponse|mixed + */ + #[OA\Put( + path: '/api/v1/summits/{id}/presentation-action-types/{action_id}', + summary: 'Update a presentation action type', + security: [['OAuth2' => ['openid', 'profile', 'email']]], + tags: ['Summits', 'Presentation Action Types'], + parameters: [ + new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID', schema: new OA\Schema(type: 'integer')), + new OA\Parameter(name: 'action_id', in: 'path', required: true, description: 'Presentation Action Type ID', schema: new OA\Schema(type: 'integer')), + ], + requestBody: new OA\RequestBody( + required: true, + content: new OA\JsonContent(ref: '#/components/schemas/PresentationActionTypeUpdateRequest') + ), + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: 'Presentation action type updated', + content: new OA\JsonContent(ref: '#/components/schemas/PresentationActionType') + ), + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), + 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"), + ] + )] + public function update($summit_id, $action_id){ + return parent::update($summit_id, $action_id); + } + + /** + * @param $summit_id + * @param $action_id + * @return \Illuminate\Http\JsonResponse|mixed + */ + #[OA\Delete( + path: '/api/v1/summits/{id}/presentation-action-types/{action_id}', + summary: 'Delete a presentation action type', + security: [['OAuth2' => ['openid', 'profile', 'email']]], + tags: ['Summits', 'Presentation Action Types'], + parameters: [ + new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID', schema: new OA\Schema(type: 'integer')), + new OA\Parameter(name: 'action_id', in: 'path', required: true, description: 'Presentation Action Type ID', schema: new OA\Schema(type: 'integer')), + ], + responses: [ + new OA\Response(response: Response::HTTP_NO_CONTENT, description: "No Content"), + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Not found"), + new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), + ] + )] + public function delete($summit_id, $action_id){ + return parent::delete($summit_id, $action_id); + } + + /** + * @param $summit_id + * @return \Illuminate\Http\JsonResponse|mixed + */ + #[OA\Get( + path: '/api/v1/summits/{id}/presentation-action-types', + summary: 'Get all presentation action types for a summit', + security: [['OAuth2' => ['openid', 'profile', 'email']]], + tags: ['Summits', 'Presentation Action Types'], + parameters: [ + new OA\Parameter(ref: '#/components/parameters/page'), + new OA\Parameter(ref: '#/components/parameters/per_page'), + new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID', schema: new OA\Schema(type: 'integer')), + new OA\Parameter(name: 'filter', in: 'query', description: 'Filter by label (label=@value, label==value)', schema: new OA\Schema(type: 'string')), + new OA\Parameter(name: 'order', in: 'query', description: 'Order by: +/-id, +/-label, +/-order', schema: new OA\Schema(type: 'string')), + new OA\Parameter(name: 'selection_plan_id', in: 'query', description: 'Filter by selection plan and include order field', schema: new OA\Schema(type: 'integer')), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: 'Successful response', + content: new OA\JsonContent(ref: '#/components/schemas/PaginatedPresentationActionTypesResponse') + ), + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Not found"), + new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), + ] + )] public function getAllBySummit($summit_id) { $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); @@ -178,6 +334,37 @@ function () { * @param $summit_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Get( + path: '/api/v1/summits/{id}/presentation-action-types/csv', + summary: 'Get all presentation action types for a summit in CSV format', + security: [['OAuth2' => ['openid', 'profile', 'email']]], + tags: ['Summits', 'Presentation Action Types'], + parameters: [ + new OA\Parameter(ref: '#/components/parameters/page'), + new OA\Parameter(ref: '#/components/parameters/per_page'), + new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID', schema: new OA\Schema(type: 'integer')), + new OA\Parameter(name: 'filter', in: 'query', description: 'Filter by label (label=@value, label==value)', schema: new OA\Schema(type: 'string')), + new OA\Parameter(name: 'order', in: 'query', description: 'Order by: +/-id, +/-label, +/-order', schema: new OA\Schema(type: 'string')), + new OA\Parameter(name: 'selection_plan_id', in: 'query', description: 'Filter by selection plan and include order field', schema: new OA\Schema(type: 'integer')), + new OA\Parameter(name: 'columns', in: 'query', description: 'Comma-separated list of columns (allowed: id, created, last_edited, label, order)', schema: new OA\Schema(type: 'string')), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: 'CSV file', + content: new OA\MediaType( + mediaType: 'text/csv', + schema: new OA\Schema(type: 'string', format: 'binary') + ) + ), + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), + 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"), + ] + )] public function getAllBySummitCSV($summit_id) { $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); @@ -248,4 +435,4 @@ function () use ($summit) { sprintf('summit_presentation_action_types-%s', $summit_id) ); } -} \ No newline at end of file +} diff --git a/app/Swagger/SummitPresentationSchemas.php b/app/Swagger/SummitPresentationSchemas.php index 54f150301..e2a6dc1b4 100644 --- a/app/Swagger/SummitPresentationSchemas.php +++ b/app/Swagger/SummitPresentationSchemas.php @@ -145,3 +145,55 @@ class PresentationTrackChairScoreTypeCreateRequest {} class PresentationTrackChairScoreTypeUpdateRequest {} // End Track Chair Score Types + + +#[OA\Schema( + schema: 'PresentationActionType', + type: 'object', + properties: [ + new OA\Property(property: 'id', type: 'integer', example: 1), + new OA\Property(property: 'created', type: 'integer', example: 1630500518), + new OA\Property(property: 'last_edited', type: 'integer', example: 1630500518), + new OA\Property(property: 'label', type: 'string', example: 'Review'), + new OA\Property(property: 'summit_id', type: 'integer', example: 42), + new OA\Property(property: 'order', type: 'integer', example: 1, description: 'Order within a selection plan. Only present when filtering by selection_plan_id',), + ] +)] +class PresentationActionTypeSchema {} + +#[OA\Schema( + schema: 'PaginatedPresentationActionTypesResponse', + allOf: [ + new OA\Schema(ref: '#/components/schemas/PaginateDataSchemaResponse'), + new OA\Schema( + type: 'object', + properties: [ + new OA\Property( + property: 'data', + type: 'array', + items: new OA\Items(ref: '#/components/schemas/PresentationActionType') + ) + ] + ) + ] +)] +class PaginatedPresentationActionTypesResponseSchema {} + +#[OA\Schema( + schema: 'PresentationActionTypeCreateRequest', + type: 'object', + required: ['label'], + properties: [ + new OA\Property(property: 'label', type: 'string', example: 'Review', maxLength: 255), + ] +)] +class PresentationActionTypeCreateRequestSchema {} + +#[OA\Schema( + schema: 'PresentationActionTypeUpdateRequest', + type: 'object', + properties: [ + new OA\Property(property: 'label', type: 'string', example: 'Review', maxLength: 255), + ] +)] +class PresentationActionTypeUpdateRequestSchema {} From f386d1f13f95d198609e37490e80c7dec32b4f1b Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 13 Nov 2025 20:27:56 +0000 Subject: [PATCH 2/4] chore: Add the security schema for the controller to its own file --- ...mitPresentationActionTypeApiController.php | 78 +++++++++++++++++-- .../PresentationActionTypesAuthSchema.php | 26 +++++++ 2 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 app/Swagger/Security/PresentationActionTypesAuthSchema.php diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php index 5353d82e3..c0e9a5810 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php @@ -13,7 +13,9 @@ **/ use App\Http\Utils\EpochCellFormatter; +use App\Models\Foundation\Main\IGroup; use App\Models\Foundation\Summit\Repositories\IPresentationActionTypeRepository; +use App\Security\SummitScopes; use App\Services\Model\ISummitPresentationActionTypeService; use Illuminate\Http\Response; use Illuminate\Support\Facades\Input; @@ -138,7 +140,17 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I #[OA\Post( path: '/api/v1/summits/{id}/presentation-action-types', summary: 'Create a new presentation action type', - security: [['OAuth2' => ['openid', 'profile', 'email']]], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + IGroup::TrackChairsAdmins, + ] + ], + security: [['presentation_action_types_oauth2' => [ + SummitScopes::WriteSummitData, + ]]], tags: ['Summits', 'Presentation Action Types'], parameters: [ new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID', schema: new OA\Schema(type: 'integer')), @@ -173,7 +185,18 @@ public function add($summit_id){ #[OA\Get( path: '/api/v1/summits/{id}/presentation-action-types/{action_id}', summary: 'Get a presentation action type by ID', - security: [['OAuth2' => ['openid', 'profile', 'email']]], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + IGroup::TrackChairsAdmins, + ] + ], + security: [['presentation_action_types_oauth2' => [ + SummitScopes::ReadAllSummitData, + SummitScopes::ReadSummitData, + ]]], tags: ['Summits', 'Presentation Action Types'], parameters: [ new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID', schema: new OA\Schema(type: 'integer')), @@ -204,7 +227,17 @@ public function get($summit_id, $action_id){ #[OA\Put( path: '/api/v1/summits/{id}/presentation-action-types/{action_id}', summary: 'Update a presentation action type', - security: [['OAuth2' => ['openid', 'profile', 'email']]], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + IGroup::TrackChairsAdmins, + ] + ], + security: [['presentation_action_types_oauth2' => [ + SummitScopes::WriteSummitData, + ]]], tags: ['Summits', 'Presentation Action Types'], parameters: [ new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID', schema: new OA\Schema(type: 'integer')), @@ -240,7 +273,17 @@ public function update($summit_id, $action_id){ #[OA\Delete( path: '/api/v1/summits/{id}/presentation-action-types/{action_id}', summary: 'Delete a presentation action type', - security: [['OAuth2' => ['openid', 'profile', 'email']]], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + IGroup::TrackChairsAdmins, + ] + ], + security: [['presentation_action_types_oauth2' => [ + SummitScopes::WriteSummitData, + ]]], tags: ['Summits', 'Presentation Action Types'], parameters: [ new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID', schema: new OA\Schema(type: 'integer')), @@ -266,7 +309,19 @@ public function delete($summit_id, $action_id){ #[OA\Get( path: '/api/v1/summits/{id}/presentation-action-types', summary: 'Get all presentation action types for a summit', - security: [['OAuth2' => ['openid', 'profile', 'email']]], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + IGroup::TrackChairsAdmins, + IGroup::TrackChairs, + ] + ], + security: [['presentation_action_types_oauth2' => [ + SummitScopes::ReadAllSummitData, + SummitScopes::ReadSummitData, + ]]], tags: ['Summits', 'Presentation Action Types'], parameters: [ new OA\Parameter(ref: '#/components/parameters/page'), @@ -337,7 +392,18 @@ function () { #[OA\Get( path: '/api/v1/summits/{id}/presentation-action-types/csv', summary: 'Get all presentation action types for a summit in CSV format', - security: [['OAuth2' => ['openid', 'profile', 'email']]], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + IGroup::TrackChairsAdmins, + ] + ], + security: [['presentation_action_types_oauth2' => [ + SummitScopes::ReadAllSummitData, + SummitScopes::ReadSummitData, + ]]], tags: ['Summits', 'Presentation Action Types'], parameters: [ new OA\Parameter(ref: '#/components/parameters/page'), diff --git a/app/Swagger/Security/PresentationActionTypesAuthSchema.php b/app/Swagger/Security/PresentationActionTypesAuthSchema.php new file mode 100644 index 000000000..d39edebfe --- /dev/null +++ b/app/Swagger/Security/PresentationActionTypesAuthSchema.php @@ -0,0 +1,26 @@ + 'Read All Summit Data', + SummitScopes::ReadSummitData => 'Read Summit Data', + SummitScopes::WriteSummitData => 'Write Summit Data', + ], + ), + ], + ) +] +class PresentationActionTypesAuthSchema{} From 7f0c7ce95d130a215b6c57c82142287f857b4aaa Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Mon, 24 Nov 2025 14:06:14 +0000 Subject: [PATCH 3/4] chore: add description for complex expand models. Fix issues on params --- ...mitPresentationActionTypeApiController.php | 127 +++++++++++++----- app/Swagger/SummitPresentationSchemas.php | 21 ++- 2 files changed, 105 insertions(+), 43 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php index c0e9a5810..a9ca7e372 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php @@ -1,4 +1,5 @@ -repository = $repository; $this->summit_repository = $summit_repository; @@ -148,9 +147,13 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I IGroup::TrackChairsAdmins, ] ], - security: [['presentation_action_types_oauth2' => [ - SummitScopes::WriteSummitData, - ]]], + security: [ + [ + 'presentation_action_types_oauth2' => [ + SummitScopes::WriteSummitData, + ] + ] + ], tags: ['Summits', 'Presentation Action Types'], parameters: [ new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID', schema: new OA\Schema(type: 'integer')), @@ -173,7 +176,8 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), ] )] - public function add($summit_id){ + public function add($summit_id) + { return parent::add($summit_id); } @@ -193,10 +197,14 @@ public function add($summit_id){ IGroup::TrackChairsAdmins, ] ], - security: [['presentation_action_types_oauth2' => [ - SummitScopes::ReadAllSummitData, - SummitScopes::ReadSummitData, - ]]], + security: [ + [ + 'presentation_action_types_oauth2' => [ + SummitScopes::ReadAllSummitData, + SummitScopes::ReadSummitData, + ] + ] + ], tags: ['Summits', 'Presentation Action Types'], parameters: [ new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID', schema: new OA\Schema(type: 'integer')), @@ -215,7 +223,8 @@ public function add($summit_id){ new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), ] )] - public function get($summit_id, $action_id){ + public function get($summit_id, $action_id) + { return parent::get($summit_id, $action_id); } @@ -235,9 +244,13 @@ public function get($summit_id, $action_id){ IGroup::TrackChairsAdmins, ] ], - security: [['presentation_action_types_oauth2' => [ - SummitScopes::WriteSummitData, - ]]], + security: [ + [ + 'presentation_action_types_oauth2' => [ + SummitScopes::WriteSummitData, + ] + ] + ], tags: ['Summits', 'Presentation Action Types'], parameters: [ new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID', schema: new OA\Schema(type: 'integer')), @@ -261,7 +274,8 @@ public function get($summit_id, $action_id){ new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), ] )] - public function update($summit_id, $action_id){ + public function update($summit_id, $action_id) + { return parent::update($summit_id, $action_id); } @@ -281,9 +295,13 @@ public function update($summit_id, $action_id){ IGroup::TrackChairsAdmins, ] ], - security: [['presentation_action_types_oauth2' => [ - SummitScopes::WriteSummitData, - ]]], + security: [ + [ + 'presentation_action_types_oauth2' => [ + SummitScopes::WriteSummitData, + ] + ] + ], tags: ['Summits', 'Presentation Action Types'], parameters: [ new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID', schema: new OA\Schema(type: 'integer')), @@ -298,7 +316,8 @@ public function update($summit_id, $action_id){ new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), ] )] - public function delete($summit_id, $action_id){ + public function delete($summit_id, $action_id) + { return parent::delete($summit_id, $action_id); } @@ -318,14 +337,30 @@ public function delete($summit_id, $action_id){ IGroup::TrackChairs, ] ], - security: [['presentation_action_types_oauth2' => [ - SummitScopes::ReadAllSummitData, - SummitScopes::ReadSummitData, - ]]], + security: [ + [ + 'presentation_action_types_oauth2' => [ + SummitScopes::ReadAllSummitData, + SummitScopes::ReadSummitData, + ] + ] + ], tags: ['Summits', 'Presentation Action Types'], parameters: [ - new OA\Parameter(ref: '#/components/parameters/page'), - new OA\Parameter(ref: '#/components/parameters/per_page'), + new OA\Parameter( + name: 'page', + in: 'query', + required: false, + description: 'Page number for pagination', + schema: new OA\Schema(type: 'integer', example: 1) + ), + new OA\Parameter( + name: 'per_page', + in: 'query', + required: false, + description: 'Items per page', + schema: new OA\Schema(type: 'integer', example: 10, maximum: 100) + ), new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID', schema: new OA\Schema(type: 'integer')), new OA\Parameter(name: 'filter', in: 'query', description: 'Filter by label (label=@value, label==value)', schema: new OA\Schema(type: 'string')), new OA\Parameter(name: 'order', in: 'query', description: 'Order by: +/-id, +/-label, +/-order', schema: new OA\Schema(type: 'string')), @@ -347,7 +382,8 @@ public function delete($summit_id, $action_id){ public function getAllBySummit($summit_id) { $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); + if (is_null($summit)) + return $this->error404(); return $this->_getAll( function () { @@ -400,14 +436,30 @@ function () { IGroup::TrackChairsAdmins, ] ], - security: [['presentation_action_types_oauth2' => [ - SummitScopes::ReadAllSummitData, - SummitScopes::ReadSummitData, - ]]], + security: [ + [ + 'presentation_action_types_oauth2' => [ + SummitScopes::ReadAllSummitData, + SummitScopes::ReadSummitData, + ] + ] + ], tags: ['Summits', 'Presentation Action Types'], parameters: [ - new OA\Parameter(ref: '#/components/parameters/page'), - new OA\Parameter(ref: '#/components/parameters/per_page'), + new OA\Parameter( + name: 'page', + in: 'query', + required: false, + description: 'Page number for pagination', + schema: new OA\Schema(type: 'integer', example: 1) + ), + new OA\Parameter( + name: 'per_page', + in: 'query', + required: false, + description: 'Items per page', + schema: new OA\Schema(type: 'integer', example: 10, maximum: 100) + ), new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID', schema: new OA\Schema(type: 'integer')), new OA\Parameter(name: 'filter', in: 'query', description: 'Filter by label (label=@value, label==value)', schema: new OA\Schema(type: 'string')), new OA\Parameter(name: 'order', in: 'query', description: 'Order by: +/-id, +/-label, +/-order', schema: new OA\Schema(type: 'string')), @@ -434,7 +486,8 @@ function () { public function getAllBySummitCSV($summit_id) { $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); + if (is_null($summit)) + return $this->error404(); return $this->_getAllCSV( function () { @@ -501,4 +554,4 @@ function () use ($summit) { sprintf('summit_presentation_action_types-%s', $summit_id) ); } -} +} \ No newline at end of file diff --git a/app/Swagger/SummitPresentationSchemas.php b/app/Swagger/SummitPresentationSchemas.php index e2a6dc1b4..bf2e70ed8 100644 --- a/app/Swagger/SummitPresentationSchemas.php +++ b/app/Swagger/SummitPresentationSchemas.php @@ -155,11 +155,13 @@ class PresentationTrackChairScoreTypeUpdateRequest {} new OA\Property(property: 'created', type: 'integer', example: 1630500518), new OA\Property(property: 'last_edited', type: 'integer', example: 1630500518), new OA\Property(property: 'label', type: 'string', example: 'Review'), - new OA\Property(property: 'summit_id', type: 'integer', example: 42), - new OA\Property(property: 'order', type: 'integer', example: 1, description: 'Order within a selection plan. Only present when filtering by selection_plan_id',), + new OA\Property(property: 'summit_id', type: 'integer', example: 42, description: 'Summit ID, add ?expand=summit to get full summit object'), + new OA\Property(property: 'order', type: 'integer', example: 1, description: 'Order within a selection plan. Only present when filtering by selection_plan_id', ), ] )] -class PresentationActionTypeSchema {} +class PresentationActionTypeSchema +{ +} #[OA\Schema( schema: 'PaginatedPresentationActionTypesResponse', @@ -177,7 +179,9 @@ class PresentationActionTypeSchema {} ) ] )] -class PaginatedPresentationActionTypesResponseSchema {} +class PaginatedPresentationActionTypesResponseSchema +{ +} #[OA\Schema( schema: 'PresentationActionTypeCreateRequest', @@ -185,9 +189,12 @@ class PaginatedPresentationActionTypesResponseSchema {} required: ['label'], properties: [ new OA\Property(property: 'label', type: 'string', example: 'Review', maxLength: 255), + new OA\Property(property: 'selection_plan_id', type: 'integer', example: 42, description: 'If provided, the order field will be set within the context of the selection plan'), ] )] -class PresentationActionTypeCreateRequestSchema {} +class PresentationActionTypeCreateRequestSchema +{ +} #[OA\Schema( schema: 'PresentationActionTypeUpdateRequest', @@ -196,4 +203,6 @@ class PresentationActionTypeCreateRequestSchema {} new OA\Property(property: 'label', type: 'string', example: 'Review', maxLength: 255), ] )] -class PresentationActionTypeUpdateRequestSchema {} +class PresentationActionTypeUpdateRequestSchema +{ +} \ No newline at end of file From 3c0ac79caf4db156ccbca9bfd169da822640d38e Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Tue, 2 Dec 2025 21:46:01 +0000 Subject: [PATCH 4/4] chore: add operationId and fix namespace in security schema --- ...mitPresentationActionTypeApiController.php | 6 ++++ .../PresentationActionTypesAuthSchema.php | 36 ++++++++++--------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php index a9ca7e372..da38f639f 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php @@ -139,6 +139,7 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I #[OA\Post( path: '/api/v1/summits/{id}/presentation-action-types', summary: 'Create a new presentation action type', + operationId: 'createPresentationActionType', x: [ 'required-groups' => [ IGroup::SuperAdmins, @@ -189,6 +190,7 @@ public function add($summit_id) #[OA\Get( path: '/api/v1/summits/{id}/presentation-action-types/{action_id}', summary: 'Get a presentation action type by ID', + operationId: 'getPresentationActionType', x: [ 'required-groups' => [ IGroup::SuperAdmins, @@ -236,6 +238,7 @@ public function get($summit_id, $action_id) #[OA\Put( path: '/api/v1/summits/{id}/presentation-action-types/{action_id}', summary: 'Update a presentation action type', + operationId: 'updatePresentationActionType', x: [ 'required-groups' => [ IGroup::SuperAdmins, @@ -287,6 +290,7 @@ public function update($summit_id, $action_id) #[OA\Delete( path: '/api/v1/summits/{id}/presentation-action-types/{action_id}', summary: 'Delete a presentation action type', + operationId: 'deletePresentationActionType', x: [ 'required-groups' => [ IGroup::SuperAdmins, @@ -328,6 +332,7 @@ public function delete($summit_id, $action_id) #[OA\Get( path: '/api/v1/summits/{id}/presentation-action-types', summary: 'Get all presentation action types for a summit', + operationId: 'getAllPresentationActionTypes', x: [ 'required-groups' => [ IGroup::SuperAdmins, @@ -428,6 +433,7 @@ function () { #[OA\Get( path: '/api/v1/summits/{id}/presentation-action-types/csv', summary: 'Get all presentation action types for a summit in CSV format', + operationId: 'getAllPresentationActionTypesCSV', x: [ 'required-groups' => [ IGroup::SuperAdmins, diff --git a/app/Swagger/Security/PresentationActionTypesAuthSchema.php b/app/Swagger/Security/PresentationActionTypesAuthSchema.php index d39edebfe..464eed28a 100644 --- a/app/Swagger/Security/PresentationActionTypesAuthSchema.php +++ b/app/Swagger/Security/PresentationActionTypesAuthSchema.php @@ -1,26 +1,28 @@ 'Read All Summit Data', - SummitScopes::ReadSummitData => 'Read Summit Data', - SummitScopes::WriteSummitData => 'Write Summit Data', - ], - ), - ], - ) + type: 'oauth2', + securityScheme: 'presentation_action_types_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', + SummitScopes::WriteSummitData => 'Write Summit Data', + ], + ), + ], +) ] -class PresentationActionTypesAuthSchema{} +class PresentationActionTypesAuthSchema +{ +}