Skip to content

Feat | API OAuth2UserApiController routes v1#106

Open
matiasperrone-exo wants to merge 3 commits intomainfrom
feat/openapi----api-v1---oauth2userapicontroller
Open

Feat | API OAuth2UserApiController routes v1#106
matiasperrone-exo wants to merge 3 commits intomainfrom
feat/openapi----api-v1---oauth2userapicontroller

Conversation

@matiasperrone-exo
Copy link
Contributor

@matiasperrone-exo matiasperrone-exo commented Feb 11, 2026

Task:

Ref: https://app.clickup.com/t/86b8e6k87

Endpoints:

Method Endpoint Method Name
GET,HEAD api/v1/users getAll
POST api/v1/users create
GET,HEAD api/v1/users/info userInfo
POST api/v1/users/info userInfo
GET,HEAD api/v1/users/me me
OPTIONS,PUT api/v1/users/me updateMe
OPTIONS,PUT api/v1/users/me/pic updateMyPic
GET,HEAD api/v1/users/{id} get
PUT api/v1/users/{id} update
PUT api/v1/users/{id}/groups updateUserGroups

Summary by CodeRabbit

  • New Features
    • Added multiple user-management API endpoints: list/search users (paginated, filterable, sortable, expandable), get current user, create/update users, update profile picture, OpenID UserInfo, and update user group assignments.
  • Documentation
    • Ship comprehensive OpenAPI docs and schemas for user endpoints, request/response shapes, paginated responses, and OAuth2 scopes (profile/email/address).
  • Bug Fixes
    • Improved JSON validation, error handling and response consistency for user endpoints.
  • Style
    • Minor formatting and structural cleanups.

@matiasperrone-exo matiasperrone-exo self-assigned this Feb 11, 2026
@matiasperrone-exo matiasperrone-exo added the documentation Improvements or additions to documentation label Feb 11, 2026
@matiasperrone-exo matiasperrone-exo force-pushed the feat/openapi----api-v1---oauth2userapicontroller branch from e5e28a9 to 54025c8 Compare February 11, 2026 22:36
@smarcet smarcet force-pushed the main branch 2 times, most recently from ae79f5e to 4b5b726 Compare February 12, 2026 20:00
@matiasperrone-exo matiasperrone-exo force-pushed the feat/openapi----api-v1---oauth2userapicontroller branch 10 times, most recently from 28e31ae to 2c37852 Compare February 13, 2026 20:43
Copy link

@martinquiroga-exo martinquiroga-exo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matiasperrone-exo please add the clickup card link to this PR please

Copy link
Contributor

@caseylocker caseylocker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@coderabbitai
Copy link

coderabbitai bot commented Mar 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d1d29b54-3cc2-430a-9309-9acb6fae0c60

📥 Commits

Reviewing files that changed from the base of the PR and between d08d047 and b545fb6.

📒 Files selected for processing (9)
  • app/Http/Controllers/Api/OAuth2/OAuth2UserApiController.php
  • app/Swagger/Models/UserInfoResponseSchema.php
  • app/Swagger/OAuth2UserApiControllerSchemas.php
  • app/Swagger/Requests/CreateUserRequestSchema.php
  • app/Swagger/Requests/UpdateUserGroupsRequestSchema.php
  • app/Swagger/Requests/UpdateUserPicRequestSchema.php
  • app/Swagger/Requests/UpdateUserRequestSchema.php
  • app/Swagger/Requests/UserFieldsSchema.php
  • app/Swagger/Security/UsersOAuth2Schema.php
🚧 Files skipped from review as they are similar to previous changes (3)
  • app/Swagger/Requests/UserFieldsSchema.php
  • app/Swagger/Requests/UpdateUserPicRequestSchema.php
  • app/Swagger/Requests/UpdateUserGroupsRequestSchema.php

📝 Walkthrough

Walkthrough

Adds extensive OpenAPI annotations and multiple REST endpoints to the OAuth2 user controller; adds Swagger schema classes for UserInfo, pagination, request payloads, and updates the OAuth2 security schema.

Changes

Cohort / File(s) Summary
Controller / Endpoints
app/Http/Controllers/Api/OAuth2/OAuth2UserApiController.php
Adds OpenAPI-annotated endpoints and public methods: create(), updateMe(), update($id), updateUserGroups($user_id). Exposes routes for listing, fetching (me, id, v2), creating, updating (me, id), updating picture, userinfo (OIDC), and updating groups; adds JSON request checks and expanded error responses.
UserInfo / Response Schemas
app/Swagger/Models/UserInfoResponseSchema.php, app/Swagger/OAuth2UserApiControllerSchemas.php
Adds UserInfoAddressClaimSchema and UserInfoResponseSchema (OpenID UserInfo claims) and PaginatedUserResponseSchema composing pagination metadata with an array of User items.
Request Schemas
app/Swagger/Requests/CreateUserRequestSchema.php, app/Swagger/Requests/UpdateUserRequestSchema.php, app/Swagger/Requests/UpdateUserPicRequestSchema.php, app/Swagger/Requests/UpdateUserGroupsRequestSchema.php, app/Swagger/Requests/UserFieldsSchema.php
Introduces CreateUserRequest, UpdateUserRequest, UpdateUserPicRequest (binary file), UpdateUserGroupsRequest (groups integer array), and a comprehensive UserFields schema enumerating user properties, types, examples, and constraints.
Security Schema
app/Swagger/Security/UsersOAuth2Schema.php
Renames/updates OAuth2 security schema to UsersOAuth2Schema, adds/adjusts scopes (Profile, Email, Address, ReadAll, MeWrite, Write, UserGroupWrite) and minor description edits.

Sequence Diagram(s)

sequenceDiagram
  participant Client as Client
  participant Controller as OAuth2UserApiController
  participant Auth as OAuth2 Security
  participant Service as UserService
  participant DB as Database/Storage

  Client->>Auth: obtain access token
  Client->>Controller: HTTP request (e.g., POST /api/v1/users) with token
  Controller->>Auth: validate token & scopes
  Auth-->>Controller: token validated
  Controller->>Service: invoke create/update/get/updateGroups/updatePic
  Service->>DB: read/write user record / groups / store pic
  DB-->>Service: operation result
  Service-->>Controller: domain/result object
  Controller-->>Client: JSON response (200/201/4xx/5xx)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped through routes and specs tonight,

Added claims and uploads, made endpoints right,
Groups and pics and userinfo in view,
Schemas stitched tidy, docs fresh as dew,
A little rabbit's API delight!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding API routes and OpenAPI documentation for OAuth2UserApiController v1 endpoints.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/openapi----api-v1---oauth2userapicontroller
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

📘 OpenAPI / Swagger preview

➡️ https://OpenStackweb.github.io/openstackid/openapi/pr-106/

This page is automatically updated on each push to this PR.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/Http/Controllers/Api/OAuth2/OAuth2UserApiController.php`:
- Around line 499-504: The OpenAPI response for the update operation in
OAuth2UserApiController currently uses HttpResponse::HTTP_CREATED (201); change
it to HttpResponse::HTTP_OK (200) so the OA\Response for the update (the block
creating new OA\Response in OAuth2UserApiController, around the
profile-picture/update endpoint) correctly reflects an update operation
returning 200 instead of 201.
- Around line 801-805: The OpenAPI annotation in OAuth2UserApiController
currently documents an update operation with response:
HttpResponse::HTTP_CREATED (201); change that OA\Response to use
HttpResponse::HTTP_OK (200) or HttpResponse::HTTP_NO_CONTENT (204) instead and
update the controller method that performs the user group assignment (the method
containing this OA\Response) so the actual HTTP response status it returns
matches the new code.
- Around line 397-402: The OpenAPI annotation in OAuth2UserApiController is
incorrectly using HttpResponse::HTTP_CREATED for a PUT update response; update
the OA\Response entry in the controller's update annotation to use
HttpResponse::HTTP_OK (200) so the documented status matches the update
semantics and returned User payload in the OA\JsonContent.
- Around line 450-455: The OpenAPI response annotation in
OAuth2UserApiController uses HttpResponse::HTTP_CREATED for an update endpoint;
change the response status to HttpResponse::HTTP_OK (200) to match an update
operation. Locate the OA\Response entry in the controller annotation (the block
that currently has response: HttpResponse::HTTP_CREATED and description
'Updated') and replace HttpResponse::HTTP_CREATED with HttpResponse::HTTP_OK
and, if desired, update the description to 'OK' or keep 'Updated' for clarity.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d9a428ab-13a3-4653-a1b3-9b59842b0f6b

📥 Commits

Reviewing files that changed from the base of the PR and between 446696c and 1a0c2b0.

📒 Files selected for processing (9)
  • app/Http/Controllers/Api/OAuth2/OAuth2UserApiController.php
  • app/Swagger/Models/UserInfoResponseSchema.php
  • app/Swagger/OAuth2UserApiControllerSchemas.php
  • app/Swagger/Requests/CreateUserRequestSchema.php
  • app/Swagger/Requests/UpdateUserGroupsRequestSchema.php
  • app/Swagger/Requests/UpdateUserPicRequestSchema.php
  • app/Swagger/Requests/UpdateUserRequestSchema.php
  • app/Swagger/Requests/UserFieldsSchema.php
  • app/Swagger/Security/UsersOAuth2Schema.php

Copy link
Collaborator

@smarcet smarcet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matiasperrone-exo please review comments and rebase with main to get the proper preview for the swagger doc many thanks

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/Swagger/Security/UsersOAuth2Schema.php`:
- Line 3: The namespace declaration in UsersOAuth2Schema.php is incorrect
(currently App\Swagger\schemas) and breaks PSR-4 autoloading; update the
namespace to match the file path (use App\Swagger\Security) so the class
UsersOAuth2Schema is declared under the App\Swagger\Security namespace, then run
a quick Composer dump-autoload to verify resolution.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d9f0529e-eb78-4a4f-87f4-70c27e0a825a

📥 Commits

Reviewing files that changed from the base of the PR and between 1a0c2b0 and 174fd81.

📒 Files selected for processing (3)
  • app/Http/Controllers/Api/OAuth2/OAuth2UserApiController.php
  • app/Swagger/OAuth2UserApiControllerSchemas.php
  • app/Swagger/Security/UsersOAuth2Schema.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/Swagger/OAuth2UserApiControllerSchemas.php

@matiasperrone-exo matiasperrone-exo force-pushed the feat/openapi----api-v1---oauth2userapicontroller branch from 174fd81 to d08d047 Compare March 16, 2026 20:34
@github-actions
Copy link

📘 OpenAPI / Swagger preview

➡️ https://OpenStackweb.github.io/openstackid/openapi/pr-106/

This page is automatically updated on each push to this PR.

@matiasperrone-exo matiasperrone-exo force-pushed the feat/openapi----api-v1---oauth2userapicontroller branch from d08d047 to b545fb6 Compare March 17, 2026 19:27
@matiasperrone-exo
Copy link
Contributor Author

@smarcet the branch was rebased

@github-actions
Copy link

📘 OpenAPI / Swagger preview

➡️ https://OpenStackweb.github.io/openstackid/openapi/pr-106/

This page is automatically updated on each push to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants