From 264486f72615aabc6f526451e04e57347b76bee6 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Wed, 1 Oct 2025 17:25:47 -0300 Subject: [PATCH 01/10] feat: Add OpenAPI documentation to "getAll" and "add" methods - Add controller's response to OpenAPI schema --- .../Main/OAuth2OrganizationsApiController.php | 100 +++++++- app/Swagger/schemas.php | 224 +++++++++++++----- 2 files changed, 257 insertions(+), 67 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php index 2ff2021d0..6553b60e1 100644 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php +++ b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php @@ -1,4 +1,7 @@ - [SummitScopes::ReadAllSummitData, SummitScopes::WriteSummitData]]], + tags: ['organizations'], + requestBody: new OA\RequestBody( + required: true, + content: new OA\JsonContent(ref: '#/components/schemas/OrganizationCreateRequest') + ), + responses: [ + new OA\Response( + response: 201, + description: 'Organization created successfully', + content: new OA\JsonContent(ref: '#/components/schemas/Organization') + ), + new OA\Response(response: 400, ref: '#/components/responses/400'), + new OA\Response(response: 401, ref: '#/components/responses/401'), + new OA\Response(response: 403, ref: '#/components/responses/403'), + new OA\Response(response: 412, ref: '#/components/responses/412'), + new OA\Response(response: 422, ref: '#/components/responses/422'), + new OA\Response(response: 500, ref: '#/components/responses/500'), + ] + )] /** * OAuth2OrganizationsApiController constructor. @@ -49,6 +80,70 @@ public function __construct $this->service = $service; } + #[OA\Get( + path: "/api/v1/organizations", + description: "Get all organizations with filtering and pagination. Organizations represent companies, foundations, or entities in the system. Requires OAuth2 authentication with appropriate scope.", + summary: 'Get all organizations', + operationId: 'getAllOrganizations', + tags: ['Organizations'], + security: [['summit_rsvp_oauth2' => [ + SummitScopes::ReadAllSummitData, + ]]], + parameters: [ + new OA\Parameter( + name: 'access_token', + in: 'query', + required: false, + description: 'OAuth2 access token (alternative to Authorization: Bearer)', + schema: new OA\Schema(type: 'string', example: 'eyJhbGciOi...') + ), + 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: 'filter[]', + in: 'query', + required: false, + description: 'Filter expressions. Format: fieldvalue. Available field: name (=@, ==, @@). Operators: == (equals), =@ (starts with), @@ (contains)', + style: 'form', + explode: true, + schema: new OA\Schema( + type: 'array', + items: new OA\Items(type: 'string', example: 'name@@OpenStack') + ) + ), + new OA\Parameter( + name: 'order', + in: 'query', + required: false, + description: 'Order by field(s). Available fields: name, id. Use "-" prefix for descending order.', + schema: new OA\Schema(type: 'string', example: 'name') + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Success - Returns paginated list of organizations', + content: new OA\JsonContent(ref: '#/components/schemas/PaginatedOrganizationsResponse') + ), + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request - Invalid parameters"), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized - Invalid or missing access token"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden - Insufficient permissions"), + 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 getAll() { return $this->_getAll( @@ -77,7 +172,6 @@ function () { ); } - use AddEntity; /** * @inheritDoc @@ -96,4 +190,4 @@ protected function addEntity(array $payload): IEntity { return $this->service->addOrganization($payload); } -} \ No newline at end of file +} diff --git a/app/Swagger/schemas.php b/app/Swagger/schemas.php index 35b230377..3ef9fdec6 100644 --- a/app/Swagger/schemas.php +++ b/app/Swagger/schemas.php @@ -18,7 +18,9 @@ new OA\Property(property: 'last_name', type: 'string'), ] )] -class OwnerSchema {} +class OwnerSchema +{ +} #[OA\Schema( schema: 'Ticket', @@ -29,7 +31,9 @@ class OwnerSchema {} new OA\Property(property: 'owner', ref: '#/components/schemas/Owner'), ] )] -class TicketSchema {} +class TicketSchema +{ +} #[OA\Schema( schema: 'Feature', @@ -40,7 +44,9 @@ class TicketSchema {} new OA\Property(property: 'description', type: 'string'), ] )] -class FeatureSchema {} +class FeatureSchema +{ +} #[OA\Schema( schema: 'ValidateBadgeResponse', @@ -55,7 +61,9 @@ class FeatureSchema {} new OA\Property(property: 'ticket', ref: '#/components/schemas/Ticket'), ] )] -class ValidateBadgeResponseSchema {} +class ValidateBadgeResponseSchema +{ +} #[OA\Schema( schema: 'PaginateDataSchemaResponse', @@ -68,7 +76,9 @@ class ValidateBadgeResponseSchema {} ], description: 'Base pagination metadata' )] -class PaginateDataSchemaResponseSchema {} +class PaginateDataSchemaResponseSchema +{ +} #[OA\Schema( schema: 'PaginatedRSVPInvitationsResponse', @@ -86,7 +96,9 @@ class PaginateDataSchemaResponseSchema {} ) ] )] -class PaginatedRSVPInvitationsResponseSchema {} +class PaginatedRSVPInvitationsResponseSchema +{ +} #[OA\Schema( schema: 'PaginatedCSVRSVPInvitationsResponse', @@ -104,7 +116,9 @@ class PaginatedRSVPInvitationsResponseSchema {} ) ] )] -class PaginatedCSVRSVPInvitationsResponseSchema {} +class PaginatedCSVRSVPInvitationsResponseSchema +{ +} #[OA\Schema( schema: 'RSVPInvitation', @@ -120,7 +134,9 @@ class PaginatedCSVRSVPInvitationsResponseSchema {} new OA\Property(property: 'event', ref: '#/components/schemas/SummitEvent'), ] )] -class RSVPInvitationSchema {} +class RSVPInvitationSchema +{ +} #[OA\Schema( schema: 'RSVPInvitationCSV', @@ -133,10 +149,12 @@ class RSVPInvitationSchema {} new OA\Property(property: 'is_accepted', type: 'boolean', example: false), new OA\Property(property: 'is_sent', type: 'boolean', example: false), new OA\Property(property: 'invitee_id', type: 'integer', example: 123), - new OA\Property(property: 'event_id', type: 'integer', example: 123), + new OA\Property(property: 'event_id', type: 'integer', example: 123), ] )] -class RSVPInvitationCSVSchema {} +class RSVPInvitationCSVSchema +{ +} #[OA\Schema( schema: 'SummitAttendee', @@ -150,7 +168,9 @@ class RSVPInvitationCSVSchema {} new OA\Property(property: 'status', type: 'string', example: 'Complete'), ] )] -class SummitAttendeeSchema {} +class SummitAttendeeSchema +{ +} #[OA\Schema( schema: 'SummitEvent', @@ -163,13 +183,15 @@ class SummitAttendeeSchema {} new OA\Property(property: 'description', type: 'string', example: 'This is a Description'), ] )] -class SummitEventSchema {} +class SummitEventSchema +{ +} #[OA\Schema( schema: 'SendRSVPInvitationsRequest', type: 'object', properties: [ - new OA\Property(property: 'email_flow_event', type: 'string', example: RSVPInviteEmail::EVENT_SLUG, enum:[RSVPInviteEmail::EVENT_SLUG, ReRSVPInviteEmail::EVENT_SLUG]), + new OA\Property(property: 'email_flow_event', type: 'string', example: RSVPInviteEmail::EVENT_SLUG, enum: [RSVPInviteEmail::EVENT_SLUG, ReRSVPInviteEmail::EVENT_SLUG]), new OA\Property( property: 'invitations_ids', type: 'array', @@ -186,7 +208,9 @@ class SummitEventSchema {} new OA\Property(property: 'outcome_email_recipient', type: 'string', example: 'result@test.com'), ] )] -class SendRSVPInvitationsRequestSchema {} +class SendRSVPInvitationsRequestSchema +{ +} #[OA\Schema( @@ -197,7 +221,9 @@ class SendRSVPInvitationsRequestSchema {} new OA\Property(property: 'outcome_email_recipient', type: 'string', example: 'result@test.com'), ] )] -class ReSendRSVPConfirmationRequestSchema {} +class ReSendRSVPConfirmationRequestSchema +{ +} #[OA\Schema( @@ -218,55 +244,60 @@ class ReSendRSVPConfirmationRequestSchema {} ), ] )] -class BulkRSVPInvitationsRequestSchema{ +class BulkRSVPInvitationsRequestSchema +{ } #[ OA\SecurityScheme( - type: 'oauth2', - securityScheme: 'summit_rsvp_oauth2', - flows: [ - new OA\Flow( - authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, - tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, - flow: 'authorizationCode', - scopes: [ - SummitScopes::AddMyRSVP => 'RSVP', - SummitScopes::DeleteMyRSVP => 'UnRSVP', - SummitScopes::ReadAllSummitData => 'Read All Summit Data', - SummitScopes::ReadSummitData => 'Read Summit Data', - SummitScopes::WriteSummitData => 'Write Summit Data', - ], - ), - ], - ) + type: 'oauth2', + securityScheme: 'summit_rsvp_oauth2', + flows: [ + new OA\Flow( + authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, + tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, + flow: 'authorizationCode', + scopes: [ + SummitScopes::AddMyRSVP => 'RSVP', + SummitScopes::DeleteMyRSVP => 'UnRSVP', + SummitScopes::ReadAllSummitData => 'Read All Summit Data', + SummitScopes::ReadSummitData => 'Read Summit Data', + SummitScopes::WriteSummitData => 'Write Summit Data', + ], + ), + ], +) ] -class RSVPAuthSchema{} +class RSVPAuthSchema +{ +} #[ OA\SecurityScheme( - type: 'oauth2', - securityScheme: 'summit_rsvp_invitations_oauth2', - flows: [ - new OA\Flow( - authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, - tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, - flow: 'authorizationCode', - scopes: [ - RSVPInvitationsScopes::Read => 'Read RSVP Invitations Data', - RSVPInvitationsScopes::Write => 'Write RSVP Invitations Data', - RSVPInvitationsScopes::Send => 'Send RSVP Invitations', - SummitScopes::ReadAllSummitData => 'Read All Summit Data', - SummitScopes::WriteSummitData => 'Write Summit Data', - ], - ), - ], - ) + type: 'oauth2', + securityScheme: 'summit_rsvp_invitations_oauth2', + flows: [ + new OA\Flow( + authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, + tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, + flow: 'authorizationCode', + scopes: [ + RSVPInvitationsScopes::Read => 'Read RSVP Invitations Data', + RSVPInvitationsScopes::Write => 'Write RSVP Invitations Data', + RSVPInvitationsScopes::Send => 'Send RSVP Invitations', + SummitScopes::ReadAllSummitData => 'Read All Summit Data', + SummitScopes::WriteSummitData => 'Write Summit Data', + ], + ), + ], +) ] -class RSVPInvitationsAuthSchema{} +class RSVPInvitationsAuthSchema +{ +} #[OA\Schema( schema: 'Member', @@ -279,7 +310,9 @@ class RSVPInvitationsAuthSchema{} new OA\Property(property: 'last_name', type: 'string', example: 'Doe'), ] )] -class MemberSchema {} +class MemberSchema +{ +} #[OA\Schema( schema: 'RSVP', @@ -295,7 +328,9 @@ class MemberSchema {} new OA\Property(property: 'event', ref: '#/components/schemas/SummitEvent'), ] )] -class RSVPSchema {} +class RSVPSchema +{ +} #[OA\Schema( schema: 'PaginatedRSVPsResponse', @@ -313,29 +348,36 @@ class RSVPSchema {} ) ] )] -class PaginatedRSVPsResponseSchema {} +class PaginatedRSVPsResponseSchema +{ +} #[OA\Schema( schema: 'RSVPInvitationRequest', type: 'object', properties: [ - new OA\Property(property: 'invitee_ids', type: 'array', + new OA\Property( + property: 'invitee_ids', + type: 'array', items: new OA\Items(type: 'integer', example: 123), example: [1, 2, 3] ), ] )] -class RSVPInvitationRequestSchema {} +class RSVPInvitationRequestSchema +{ +} #[OA\Schema( schema: 'RSVPUpdateRequest', type: 'object', properties: [ - new OA\Property(property: 'seat_type', type: 'string', example: RSVP::SeatTypeRegular, enum: RSVP::ValidSeatTypes), + new OA\Property(property: 'seat_type', type: 'string', example: RSVP::SeatTypeRegular, enum: RSVP::ValidSeatTypes), new OA\Property(property: 'status', type: 'string', example: RSVP::Status_Active, enum: RSVP::AllowedStatus), ] )] -class RSVPUpdateRequestSchema_{ +class RSVPUpdateRequestSchema_ +{ } @@ -348,7 +390,9 @@ class RSVPUpdateRequestSchema_{ ] )] -class RSVPAdminAddRequestSchema {} +class RSVPAdminAddRequestSchema +{ +} // Legal Documents @@ -362,7 +406,9 @@ class RSVPAdminAddRequestSchema {} new OA\Property(property: 'content', type: 'string', example: 'This privacy policy describes how we handle your data...'), ] )] -class LegalDocumentSchema {} +class LegalDocumentSchema +{ +} #[OA\Schema( schema: 'ChunkedFileUploadProgressResponse', @@ -371,7 +417,9 @@ class LegalDocumentSchema {} new OA\Property(property: 'done', type: 'number', format: 'float', example: 45.5, description: 'Upload progress percentage (0-100)'), ] )] -class ChunkedFileUploadProgressResponseSchema {} +class ChunkedFileUploadProgressResponseSchema +{ +} #[OA\Schema( schema: 'ChunkedFileUploadCompleteResponse', @@ -382,7 +430,9 @@ class ChunkedFileUploadProgressResponseSchema {} new OA\Property(property: 'mime_type', type: 'string', example: 'image-jpeg', description: 'MIME type of the uploaded file (slashes replaced with hyphens)'), ] )] -class ChunkedFileUploadCompleteResponseSchema {} +class ChunkedFileUploadCompleteResponseSchema +{ +} #[OA\Schema( schema: 'ChunkedFileUploadRequest', @@ -415,8 +465,54 @@ class ChunkedFileUploadCompleteResponseSchema {} ), ] )] -class ChunkedFileUploadRequestSchema {} +class ChunkedFileUploadRequestSchema +{ +} + +#[OA\Schema( + schema: 'Organization', + 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: 'name', type: 'string', example: 'OpenStack Foundation'), + ] +)] +class OrganizationSchema +{ +} + +#[OA\Schema( + schema: 'PaginatedOrganizationsResponse', + allOf: [ + new OA\Schema(ref: '#/components/schemas/PaginateDataSchemaResponse'), + new OA\Schema( + properties: [ + new OA\Property( + property: 'data', + type: 'array', + items: new OA\Items(ref: '#/components/schemas/Organization') + ) + ] + ) + ] +)] +class PaginatedOrganizationsResponseSchema +{ +} +#[OA\Schema( + schema: 'OrganizationCreateRequest', + required: ['name'], + type: 'object', + properties: [ + new OA\Property(property: 'name', type: 'string', maxLength: 255, example: 'OpenStack Foundation'), + ] +)] +class OrganizationCreateRequestSchema +{ +} // User Stories From 37bccc1ed30a09b0b1c19c135e7aff72a4b546ca Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 31 Oct 2025 11:48:54 -0300 Subject: [PATCH 02/10] fix: errors in error responses references --- .../Main/OAuth2OrganizationsApiController.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php index 6553b60e1..a0ebe7401 100644 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php +++ b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php @@ -53,12 +53,11 @@ final class OAuth2OrganizationsApiController extends OAuth2ProtectedController description: 'Organization created successfully', content: new OA\JsonContent(ref: '#/components/schemas/Organization') ), - new OA\Response(response: 400, ref: '#/components/responses/400'), - new OA\Response(response: 401, ref: '#/components/responses/401'), - new OA\Response(response: 403, ref: '#/components/responses/403'), - new OA\Response(response: 412, ref: '#/components/responses/412'), - new OA\Response(response: 422, ref: '#/components/responses/422'), - new OA\Response(response: 500, ref: '#/components/responses/500'), + 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_PRECONDITION_FAILED, description: "Validation Error"), + new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), ] )] @@ -137,10 +136,9 @@ public function __construct description: 'Success - Returns paginated list of organizations', content: new OA\JsonContent(ref: '#/components/schemas/PaginatedOrganizationsResponse') ), - new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request - Invalid parameters"), - new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized - Invalid or missing access token"), - new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden - Insufficient permissions"), - new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"), + 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") ] )] From 66925f1aecd181d0a720fde5c3bbac9eb17ef311 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 7 Nov 2025 18:18:35 +0000 Subject: [PATCH 03/10] fix: security scope --- .../Protected/Main/OAuth2OrganizationsApiController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php index a0ebe7401..f5bddb445 100644 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php +++ b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php @@ -41,7 +41,7 @@ final class OAuth2OrganizationsApiController extends OAuth2ProtectedController #[OA\Post( path: '/api/v1/organizations', summary: 'Creates a new organization', - security: [['oauth2_security_scope' => [SummitScopes::ReadAllSummitData, SummitScopes::WriteSummitData]]], + security: [['oauth2_security_scope' => [SummitScopes::WriteOrganizationData]]], tags: ['organizations'], requestBody: new OA\RequestBody( required: true, @@ -85,8 +85,8 @@ public function __construct summary: 'Get all organizations', operationId: 'getAllOrganizations', tags: ['Organizations'], - security: [['summit_rsvp_oauth2' => [ - SummitScopes::ReadAllSummitData, + security: [['oauth2_security_scope' => [ + SummitScopes::ReadOrganizationData, ]]], parameters: [ new OA\Parameter( From 571ed2efef7e5568e37e1529b73531174c78f86d Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Tue, 11 Nov 2025 21:22:27 +0000 Subject: [PATCH 04/10] fix: Add security schema --- .../Main/OAuth2OrganizationsApiController.php | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php index f5bddb445..7813116b3 100644 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php +++ b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php @@ -15,6 +15,7 @@ * limitations under the License. **/ +use App\Security\OrganizationScopes; use App\Security\SummitScopes; use App\Services\Model\IOrganizationService; use Illuminate\Http\Response; @@ -24,6 +25,26 @@ use ModelSerializers\SerializerRegistry; use OpenApi\Attributes as OA; + +#[OA\SecurityScheme( + type: 'oauth2', + securityScheme: 'organizations_oauth2', + flows: [ + new OA\Flow( + authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, + tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, + flow: 'authorizationCode', + scopes: [ + OrganizationScopes::WriteOrganizationData => 'Write Organization Data', + OrganizationScopes::ReadOrganizationData => 'Read Organization Data', + ], + ), + ], + ) +] +class RSVPAuthSchema{} + + /** * Class OAuth2OrganizationsApiController * @package App\Http\Controllers @@ -41,7 +62,10 @@ final class OAuth2OrganizationsApiController extends OAuth2ProtectedController #[OA\Post( path: '/api/v1/organizations', summary: 'Creates a new organization', - security: [['oauth2_security_scope' => [SummitScopes::WriteOrganizationData]]], + security: [['organizations_oauth2' => [ + OrganizationScopes::WriteOrganizationData + ] + ]], tags: ['organizations'], requestBody: new OA\RequestBody( required: true, @@ -85,8 +109,8 @@ public function __construct summary: 'Get all organizations', operationId: 'getAllOrganizations', tags: ['Organizations'], - security: [['oauth2_security_scope' => [ - SummitScopes::ReadOrganizationData, + security: [['organizations_oauth2' => [ + OrganizationScopes::ReadOrganizationData, ]]], parameters: [ new OA\Parameter( From 5072486f626cca96b797cec9aae775dd1f71235a Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 13 Nov 2025 19:41:49 +0000 Subject: [PATCH 05/10] chore: Move the security schema for the controller to its own file --- .../Main/OAuth2OrganizationsApiController.php | 19 -------------- .../Security/OrganizationsAuthSchema.php | 25 +++++++++++++++++++ 2 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 app/Swagger/Security/OrganizationsAuthSchema.php diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php index 7813116b3..783041929 100644 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php +++ b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php @@ -26,25 +26,6 @@ use OpenApi\Attributes as OA; -#[OA\SecurityScheme( - type: 'oauth2', - securityScheme: 'organizations_oauth2', - flows: [ - new OA\Flow( - authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, - tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, - flow: 'authorizationCode', - scopes: [ - OrganizationScopes::WriteOrganizationData => 'Write Organization Data', - OrganizationScopes::ReadOrganizationData => 'Read Organization Data', - ], - ), - ], - ) -] -class RSVPAuthSchema{} - - /** * Class OAuth2OrganizationsApiController * @package App\Http\Controllers diff --git a/app/Swagger/Security/OrganizationsAuthSchema.php b/app/Swagger/Security/OrganizationsAuthSchema.php new file mode 100644 index 000000000..37187ded1 --- /dev/null +++ b/app/Swagger/Security/OrganizationsAuthSchema.php @@ -0,0 +1,25 @@ + 'Write Organization Data', + OrganizationScopes::ReadOrganizationData => 'Read Organization Data', + ], + ), + ], + ) +] +class OrganizationsAuthSchema{} From 733a2d3f4f24390c92053416a6b499b1435cd333 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 13 Nov 2025 19:42:37 +0000 Subject: [PATCH 06/10] fix: Tag name --- .../Apis/Protected/Main/OAuth2OrganizationsApiController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php index 783041929..5b3868308 100644 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php +++ b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php @@ -47,7 +47,7 @@ final class OAuth2OrganizationsApiController extends OAuth2ProtectedController OrganizationScopes::WriteOrganizationData ] ]], - tags: ['organizations'], + tags: ['Organizations'], requestBody: new OA\RequestBody( required: true, content: new OA\JsonContent(ref: '#/components/schemas/OrganizationCreateRequest') From 4ba7775b34e1e7c7fcd81b0ebc6129bf91fe9bc6 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 20 Nov 2025 21:59:43 +0000 Subject: [PATCH 07/10] chore: remove unused dependency --- .../Main/OAuth2OrganizationsApiController.php | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php index 5b3868308..823795e9b 100644 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php +++ b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php @@ -16,7 +16,6 @@ **/ use App\Security\OrganizationScopes; -use App\Security\SummitScopes; use App\Services\Model\IOrganizationService; use Illuminate\Http\Response; use models\main\IOrganizationRepository; @@ -43,10 +42,13 @@ final class OAuth2OrganizationsApiController extends OAuth2ProtectedController #[OA\Post( path: '/api/v1/organizations', summary: 'Creates a new organization', - security: [['organizations_oauth2' => [ - OrganizationScopes::WriteOrganizationData + security: [ + [ + 'organizations_oauth2' => [ + OrganizationScopes::WriteOrganizationData + ] ] - ]], + ], tags: ['Organizations'], requestBody: new OA\RequestBody( required: true, @@ -75,10 +77,9 @@ final class OAuth2OrganizationsApiController extends OAuth2ProtectedController public function __construct ( IOrganizationRepository $company_repository, - IResourceServerContext $resource_server_context, - IOrganizationService $service - ) - { + IResourceServerContext $resource_server_context, + IOrganizationService $service + ) { parent::__construct($resource_server_context); $this->repository = $company_repository; $this->service = $service; @@ -90,17 +91,14 @@ public function __construct summary: 'Get all organizations', operationId: 'getAllOrganizations', tags: ['Organizations'], - security: [['organizations_oauth2' => [ - OrganizationScopes::ReadOrganizationData, - ]]], + security: [ + [ + 'organizations_oauth2' => [ + OrganizationScopes::ReadOrganizationData, + ] + ] + ], parameters: [ - new OA\Parameter( - name: 'access_token', - in: 'query', - required: false, - description: 'OAuth2 access token (alternative to Authorization: Bearer)', - schema: new OA\Schema(type: 'string', example: 'eyJhbGciOi...') - ), new OA\Parameter( name: 'page', in: 'query', From 68545d79ca427055efbe70da3ff971bb244fd3a9 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Tue, 2 Dec 2025 21:24:36 +0000 Subject: [PATCH 08/10] chore: change namespace --- .../Security/OrganizationsAuthSchema.php | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/app/Swagger/Security/OrganizationsAuthSchema.php b/app/Swagger/Security/OrganizationsAuthSchema.php index 37187ded1..08a7793bc 100644 --- a/app/Swagger/Security/OrganizationsAuthSchema.php +++ b/app/Swagger/Security/OrganizationsAuthSchema.php @@ -1,25 +1,27 @@ 'Write Organization Data', - OrganizationScopes::ReadOrganizationData => 'Read Organization Data', - ], - ), - ], - ) + type: 'oauth2', + securityScheme: 'organizations_oauth2', + flows: [ + new OA\Flow( + authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, + tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, + flow: 'authorizationCode', + scopes: [ + OrganizationScopes::WriteOrganizationData => 'Write Organization Data', + OrganizationScopes::ReadOrganizationData => 'Read Organization Data', + ], + ), + ], +) ] -class OrganizationsAuthSchema{} +class OrganizationsAuthSchema +{ +} \ No newline at end of file From 11760420b3942180091f90987e7de6230f21abe5 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Tue, 2 Dec 2025 21:34:07 +0000 Subject: [PATCH 09/10] chore: add operationId --- .../Apis/Protected/Main/OAuth2OrganizationsApiController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php index 823795e9b..af18b1f8f 100644 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php +++ b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php @@ -42,6 +42,7 @@ final class OAuth2OrganizationsApiController extends OAuth2ProtectedController #[OA\Post( path: '/api/v1/organizations', summary: 'Creates a new organization', + operationId: 'createOrganization', security: [ [ 'organizations_oauth2' => [ @@ -191,4 +192,4 @@ protected function addEntity(array $payload): IEntity { return $this->service->addOrganization($payload); } -} +} \ No newline at end of file From f119211d7010f7b28b20eeeb448aa2d5d2fa0d14 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 4 Dec 2025 21:10:41 +0000 Subject: [PATCH 10/10] fix: issue on rebase --- app/Swagger/schemas.php | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/app/Swagger/schemas.php b/app/Swagger/schemas.php index 3ef9fdec6..d68f81ad6 100644 --- a/app/Swagger/schemas.php +++ b/app/Swagger/schemas.php @@ -469,20 +469,6 @@ class ChunkedFileUploadRequestSchema { } -#[OA\Schema( - schema: 'Organization', - 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: 'name', type: 'string', example: 'OpenStack Foundation'), - ] -)] -class OrganizationSchema -{ -} - #[OA\Schema( schema: 'PaginatedOrganizationsResponse', allOf: [