Skip to content

feat(openapi): add OpenAPI specification generation#905

Open
oleksandr-nc wants to merge 1 commit into
mainfrom
enh/openapi-spec
Open

feat(openapi): add OpenAPI specification generation#905
oleksandr-nc wants to merge 1 commit into
mainfrom
enh/openapi-spec

Conversation

@oleksandr-nc

Copy link
Copy Markdown
Contributor

Subj. Additionally in appinfo/routes.php I removed five dead routes whose controllers no longer exist (three EventsListener routes and two ExAppsPage#viewApps routes) and added 'postfix' => 'get' to the GET enableApp route so it no longer collides with the POST enableApp route during spec generation.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6d97823b-5df2-48e7-87b8-99c37e7fb7b3

📥 Commits

Reviewing files that changed from the base of the PR and between 1e37b0a and 2c60c65.

⛔ Files ignored due to path filters (1)
  • vendor-bin/openapi-extractor/composer.lock is excluded by !**/*.lock
📒 Files selected for processing (46)
  • .github/workflows/command-openapi.yml
  • .github/workflows/openapi.yml
  • REUSE.toml
  • appinfo/routes.php
  • composer.json
  • lib/Capabilities.php
  • lib/Controller/AppConfigController.php
  • lib/Controller/ConfigController.php
  • lib/Controller/DaemonConfigController.php
  • lib/Controller/ExAppProxyController.php
  • lib/Controller/ExAppsPageController.php
  • lib/Controller/HarpController.php
  • lib/Controller/NotificationsController.php
  • lib/Controller/OCSApiController.php
  • lib/Controller/OCSExAppController.php
  • lib/Controller/OCSSettingsController.php
  • lib/Controller/OCSUiController.php
  • lib/Controller/OccCommandController.php
  • lib/Controller/PreferencesController.php
  • lib/Controller/TalkBotController.php
  • lib/Controller/TaskProcessingController.php
  • lib/Controller/TopMenuController.php
  • lib/Db/Console/ExAppOccCommand.php
  • lib/Db/DaemonConfig.php
  • lib/Db/ExApp.php
  • lib/Db/ExAppConfig.php
  • lib/Db/ExAppPreference.php
  • lib/Db/TaskProcessing/TaskProcessingProvider.php
  • lib/Db/UI/FilesActionsMenu.php
  • lib/Db/UI/InitialState.php
  • lib/Db/UI/Script.php
  • lib/Db/UI/Style.php
  • lib/Db/UI/TopMenu.php
  • lib/PublicCapabilities.php
  • lib/ResponseDefinitions.php
  • openapi-administration.json
  • openapi-full.json
  • openapi.json
  • tests/php/Controller/AppConfigControllerTest.php
  • tests/php/Controller/OCSSettingsControllerTest.php
  • tests/php/Controller/OCSUiControllerTest.php
  • tests/php/Controller/OccCommandControllerTest.php
  • tests/php/Controller/PreferencesControllerTest.php
  • tests/php/Controller/TalkBotControllerTest.php
  • tests/php/Controller/TaskProcessingControllerTest.php
  • vendor-bin/openapi-extractor/composer.json
✅ Files skipped from review due to trivial changes (16)
  • lib/Db/Console/ExAppOccCommand.php
  • lib/Capabilities.php
  • lib/Controller/TopMenuController.php
  • lib/Db/UI/TopMenu.php
  • lib/Db/UI/InitialState.php
  • lib/Db/UI/FilesActionsMenu.php
  • lib/Db/ExAppPreference.php
  • lib/PublicCapabilities.php
  • lib/Controller/OCSExAppController.php
  • lib/Db/DaemonConfig.php
  • lib/Db/UI/Style.php
  • lib/Db/TaskProcessing/TaskProcessingProvider.php
  • lib/Db/UI/Script.php
  • lib/Db/ExApp.php
  • lib/Db/ExAppConfig.php
  • lib/Controller/ExAppProxyController.php
🚧 Files skipped from review as they are similar to previous changes (27)
  • tests/php/Controller/OCSSettingsControllerTest.php
  • composer.json
  • lib/Controller/HarpController.php
  • tests/php/Controller/OCSUiControllerTest.php
  • REUSE.toml
  • tests/php/Controller/OccCommandControllerTest.php
  • tests/php/Controller/AppConfigControllerTest.php
  • lib/Controller/NotificationsController.php
  • lib/Controller/OCSSettingsController.php
  • vendor-bin/openapi-extractor/composer.json
  • lib/Controller/AppConfigController.php
  • tests/php/Controller/PreferencesControllerTest.php
  • .github/workflows/openapi.yml
  • tests/php/Controller/TaskProcessingControllerTest.php
  • lib/Controller/ExAppsPageController.php
  • tests/php/Controller/TalkBotControllerTest.php
  • lib/ResponseDefinitions.php
  • lib/Controller/ConfigController.php
  • .github/workflows/command-openapi.yml
  • lib/Controller/OccCommandController.php
  • lib/Controller/OCSUiController.php
  • lib/Controller/TaskProcessingController.php
  • lib/Controller/OCSApiController.php
  • lib/Controller/DaemonConfigController.php
  • lib/Controller/PreferencesController.php
  • lib/Controller/TalkBotController.php
  • appinfo/routes.php

📝 Walkthrough

Walkthrough

This PR adds OpenAPI regeneration workflows for pull requests and comment commands, plus a Composer script and vendor-bin package for OpenAPI extraction. It introduces shared Psalm response-shape definitions and applies them across DB serializers and controller docblocks. Controllers add OpenAPI scope annotations, normalize several request header lookups to lowercase, and some responses now return serialized arrays instead of raw objects. Route entries are removed for some ExApps and OCS endpoints, and tests are updated for the new header matching and response shapes.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 67.94% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and clearly summarizes the main change: adding OpenAPI specification generation.
Description check ✅ Passed The description is relevant to the changeset, covering route cleanup and the enableApp postfix fix for spec generation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 PHPStan (2.2.2)

Project config file at path /phpstan.neon does not exist.

🔧 OpenGrep (1.23.0)
lib/Db/ExAppPreference.php

┌──────────────┐
│ Opengrep CLI │
└──────────────┘

�[32m✔�[39m �[1mOpengrep OSS�[0m
�[32m✔�[39m Basic security coverage for first-party code vulnerabilities.

[00.13][ERROR]: unable to find a config; path .coderabbit-opengrep-fallback.yml does not exist

lib/Db/TaskProcessing/TaskProcessingProvider.php

┌──────────────┐
│ Opengrep CLI │
└──────────────┘

�[32m✔�[39m �[1mOpengrep OSS�[0m
�[32m✔�[39m Basic security coverage for first-party code vulnerabilities.

[00.21][ERROR]: unable to find a config; path .coderabbit-opengrep-fallback.yml does not exist

lib/Db/UI/FilesActionsMenu.php

┌──────────────┐
│ Opengrep CLI │
└──────────────┘

�[32m✔�[39m �[1mOpengrep OSS�[0m
�[32m✔�[39m Basic security coverage for first-party code vulnerabilities.

[00.18][ERROR]: unable to find a config; path .coderabbit-opengrep-fallback.yml does not exist

  • 14 others

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🧹 Nitpick comments (3)
.github/workflows/openapi.yml (2)

81-85: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Consider explicit command and dependency caching.

Two optional improvements:

  1. Use composer install instead of composer i for better clarity in CI logs.
  2. Add Composer dependency caching to speed up workflow runs.
⚡ Proposed enhancement

Add caching before the "Set up dependencies" step:

+      - name: Get composer cache directory
+        id: composer-cache
+        run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
+
+      - name: Cache dependencies
+        uses: actions/cache@v4
+        with:
+          path: ${{ steps.composer-cache.outputs.dir }}
+          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+          restore-keys: ${{ runner.os }}-composer-
+
       - name: Set up dependencies
-        run: composer i
+        run: composer install

87-89: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Simplify the git status check.

The current bash construct is complex. Consider using git diff --exit-code which fails if there are uncommitted changes and has built-in error messaging.

♻️ Proposed simplification
-      - name: Check openapi*.json and typescript changes
-        run: |
-          bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please run \"composer run openapi\" and commit the openapi*.json files and (if applicable) src/types/openapi/openapi*.ts, see the section \"Show changes on failure\" for details' && exit 1)"
+      - name: Check openapi*.json and typescript changes
+        run: |
+          if ! git diff --exit-code; then
+            echo 'Please run "composer run openapi" and commit the openapi*.json files and (if applicable) src/types/openapi/openapi*.ts, see the section "Show changes on failure" for details'
+            exit 1
+          fi
.github/workflows/command-openapi.yml (1)

164-191: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Complex commit orchestration—ensure it's tested.

The workflow supports three commit modes (default, fixup, amend) and conditional force-push. While flexible, this complexity increases the chance of edge-case failures. Consider documenting the supported command syntax and testing each mode.

Add documentation in a README or workflow comment explaining:

  • /openapi - Default commit
  • /openapi fixup - Fixup last commit
  • /openapi amend - Amend last commit
  • /openapi rebase - Rebase before regenerating

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 90264baa-1b6c-4fe2-8213-9d485d0b9790

📥 Commits

Reviewing files that changed from the base of the PR and between 3df483f and 1e37b0a.

⛔ Files ignored due to path filters (1)
  • vendor-bin/openapi-extractor/composer.lock is excluded by !**/*.lock
📒 Files selected for processing (46)
  • .github/workflows/command-openapi.yml
  • .github/workflows/openapi.yml
  • REUSE.toml
  • appinfo/routes.php
  • composer.json
  • lib/Capabilities.php
  • lib/Controller/AppConfigController.php
  • lib/Controller/ConfigController.php
  • lib/Controller/DaemonConfigController.php
  • lib/Controller/ExAppProxyController.php
  • lib/Controller/ExAppsPageController.php
  • lib/Controller/HarpController.php
  • lib/Controller/NotificationsController.php
  • lib/Controller/OCSApiController.php
  • lib/Controller/OCSExAppController.php
  • lib/Controller/OCSSettingsController.php
  • lib/Controller/OCSUiController.php
  • lib/Controller/OccCommandController.php
  • lib/Controller/PreferencesController.php
  • lib/Controller/TalkBotController.php
  • lib/Controller/TaskProcessingController.php
  • lib/Controller/TopMenuController.php
  • lib/Db/Console/ExAppOccCommand.php
  • lib/Db/DaemonConfig.php
  • lib/Db/ExApp.php
  • lib/Db/ExAppConfig.php
  • lib/Db/ExAppPreference.php
  • lib/Db/TaskProcessing/TaskProcessingProvider.php
  • lib/Db/UI/FilesActionsMenu.php
  • lib/Db/UI/InitialState.php
  • lib/Db/UI/Script.php
  • lib/Db/UI/Style.php
  • lib/Db/UI/TopMenu.php
  • lib/PublicCapabilities.php
  • lib/ResponseDefinitions.php
  • openapi-administration.json
  • openapi-full.json
  • openapi.json
  • tests/php/Controller/AppConfigControllerTest.php
  • tests/php/Controller/OCSSettingsControllerTest.php
  • tests/php/Controller/OCSUiControllerTest.php
  • tests/php/Controller/OccCommandControllerTest.php
  • tests/php/Controller/PreferencesControllerTest.php
  • tests/php/Controller/TalkBotControllerTest.php
  • tests/php/Controller/TaskProcessingControllerTest.php
  • vendor-bin/openapi-extractor/composer.json

Comment thread .github/workflows/command-openapi.yml
Comment thread composer.json
Comment thread lib/Controller/ExAppProxyController.php
Comment thread lib/Controller/OCSExAppController.php
Comment thread lib/Controller/OCSExAppController.php
Comment thread lib/Controller/TalkBotController.php Outdated
Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant