Skip to content

Feat | Add OpenAPI documentation for OAuth2StreamChatSSOApiController#110

Open
matiasperrone-exo wants to merge 1 commit intomainfrom
feat/openapi----api-v1---oauth2streamchatssoapicontroller
Open

Feat | Add OpenAPI documentation for OAuth2StreamChatSSOApiController#110
matiasperrone-exo wants to merge 1 commit intomainfrom
feat/openapi----api-v1---oauth2streamchatssoapicontroller

Conversation

@matiasperrone-exo
Copy link
Contributor

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

Task:

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

Summary by CodeRabbit

  • Documentation
    • Added comprehensive API documentation including endpoint specifications, response schemas, and OAuth2 security details for Stream Chat Single Sign-On functionality.

@matiasperrone-exo matiasperrone-exo added the documentation Improvements or additions to documentation label Feb 11, 2026
@matiasperrone-exo matiasperrone-exo self-assigned this Feb 11, 2026
@matiasperrone-exo matiasperrone-exo force-pushed the feat/openapi----api-v1---oauth2streamchatssoapicontroller branch 2 times, most recently from 293ea4b to eb2e34e Compare February 12, 2026 19:22
@matiasperrone-exo matiasperrone-exo force-pushed the feat/openapi----api-v1---oauth2streamchatssoapicontroller branch from eb2e34e to e541410 Compare February 12, 2026 20:02
@matiasperrone-exo matiasperrone-exo force-pushed the feat/openapi----api-v1---oauth2streamchatssoapicontroller branch 2 times, most recently from 9935b59 to 487b12f Compare February 17, 2026 21:36
@matiasperrone-exo matiasperrone-exo changed the base branch from feat/openapi---initial to main February 17, 2026 21:37
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 matiasperrone-exo force-pushed the feat/openapi----api-v1---oauth2streamchatssoapicontroller branch from 487b12f to b7a20f4 Compare February 19, 2026 21:07
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

@matiasperrone-exo matiasperrone-exo force-pushed the feat/openapi----api-v1---oauth2streamchatssoapicontroller branch from b7a20f4 to 77482f2 Compare March 17, 2026 19:30
@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

This pull request adds OpenAPI/Swagger documentation to a Stream Chat SSO API endpoint. Three new or modified files introduce OpenAPI annotations and schema definitions for the getUserProfile endpoint, including path parameters, response schemas, and OAuth2 security requirements. No functional logic changes are made.

Changes

Cohort / File(s) Summary
OpenAPI Schema Definitions
app/Swagger/Models/StreamChatUserProfileSchema.php, app/Swagger/Security/OAuth2StreamChatSSOApiControllerSecuritySchema.php
New schema classes define the Stream Chat user profile response structure (id, name, image, token, api_key, local_role) and OAuth2 security scheme with authorizationCode flow for SSO access.
API Controller Documentation
app/Http/Controllers/Api/OAuth2/OAuth2StreamChatSSOApiController.php
Adds detailed OpenAPI annotation to getUserProfile method specifying GET endpoint at /api/v1/sso/stream-chat/{forum_slug}/profile, including path parameters, response types (200, 401, 403, 404, 412, 500), and OAuth2 security requirements.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops through API paths,
With schemas neat in OpenAPI's maths,
Security schemes dance in OAuth's light, 🐰✨
Docs now flourish, endpoints bright,
No bugs were fixed, just clarity gained—
The API's future, well-explained! 📚

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding OpenAPI documentation to the OAuth2StreamChatSSOApiController, which is the primary purpose across all three modified files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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---oauth2streamchatssoapicontroller
📝 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-110/

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: 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/Http/Controllers/Api/OAuth2/OAuth2StreamChatSSOApiController.php`:
- Around line 66-92: The OpenAPI responses for 404 and 412 in
OAuth2StreamChatSSOApiController.php are missing JSON content schemas while the
controller actually returns JSON via error404() and error412(); update the
OA\Response entries for HttpResponse::HTTP_NOT_FOUND and
HttpResponse::HTTP_PRECONDITION_FAILED to include a content: new
OA\JsonContent(...) that matches the real payload (e.g., a simple {"message":
"..."} schema for 404 and a {"message":"Validation Failed","errors":[...]}
validation-error schema for 412), or reference existing components like
StreamChatUserProfile for 200 and a shared ErrorResponse / ValidationError
schema if available, so the OpenAPI docs accurately reflect the returned JSON
bodies.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4eee0347-ea24-47d2-b759-1ba3fae79c44

📥 Commits

Reviewing files that changed from the base of the PR and between 6d23f7f and 77482f2.

📒 Files selected for processing (3)
  • app/Http/Controllers/Api/OAuth2/OAuth2StreamChatSSOApiController.php
  • app/Swagger/Models/StreamChatUserProfileSchema.php
  • app/Swagger/Security/OAuth2StreamChatSSOApiControllerSecuritySchema.php

Comment on lines +66 to +92
responses: [
new OA\Response(
response: HttpResponse::HTTP_OK,
description: 'OK',
content: new OA\JsonContent(ref: '#/components/schemas/StreamChatUserProfile')
),
new OA\Response(
response: HttpResponse::HTTP_NOT_FOUND,
description: 'Not Found'
),
new OA\Response(
response: HttpResponse::HTTP_PRECONDITION_FAILED,
description: 'Validation Error'
),
new OA\Response(
response: HttpResponse::HTTP_INTERNAL_SERVER_ERROR,
description: 'Server Error'
),
new OA\Response(
response: HttpResponse::HTTP_UNAUTHORIZED,
description: 'Unauthorized - invalid or missing token'
),
new OA\Response(
response: HttpResponse::HTTP_FORBIDDEN,
description: 'Forbidden - insufficient scope'
),
]
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Response helpers used by OAuth2StreamChatSSOApiController ==="
rg -n -C4 'class\s+OAuth2ProtectedController\b|function\s+(ok|error404|error412|error500)\s*\(' --glob '*.php'

echo
echo "=== Stream Chat SSO payload serialization ==="
rg -n -C4 'IStreamChatSSOService|class\s+.*StreamChat.*|function\s+getUserProfile\s*\(|function\s+serialize\s*\(' --glob '*.php'

Repository: OpenStackweb/openstackid

Length of output: 35631


🏁 Script executed:

sed -n '94,115p' app/Http/Controllers/Api/OAuth2/OAuth2StreamChatSSOApiController.php

Repository: OpenStackweb/openstackid

Length of output: 691


Add content specifications to 404 and 412 responses.

Line 97 returns the serialized profile directly via ok(), but lines 101 and 106 emit structured JSON through error412() and error404() respectively. The OpenAPI documentation currently omits content for the 404 and 412 responses, though they do emit JSON bodies:

  • 404 returns {"message": "..."} via error404()
  • 412 returns {"message": "Validation Failed", "errors": [...]} via error412()

Update the 404 and 412 response definitions to specify their actual JSON content schemas, or verify the 200 response schema correctly describes the flat profile object.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/Http/Controllers/Api/OAuth2/OAuth2StreamChatSSOApiController.php` around
lines 66 - 92, The OpenAPI responses for 404 and 412 in
OAuth2StreamChatSSOApiController.php are missing JSON content schemas while the
controller actually returns JSON via error404() and error412(); update the
OA\Response entries for HttpResponse::HTTP_NOT_FOUND and
HttpResponse::HTTP_PRECONDITION_FAILED to include a content: new
OA\JsonContent(...) that matches the real payload (e.g., a simple {"message":
"..."} schema for 404 and a {"message":"Validation Failed","errors":[...]}
validation-error schema for 412), or reference existing components like
StreamChatUserProfile for 200 and a shared ErrorResponse / ValidationError
schema if available, so the OpenAPI docs accurately reflect the returned JSON
bodies.

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.

3 participants