feat(openapi): add OpenAPI specification generation#905
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (46)
✅ Files skipped from review due to trivial changes (16)
🚧 Files skipped from review as they are similar to previous changes (27)
📝 WalkthroughWalkthroughThis 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)
✅ Passed checks (4 passed)
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┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m [00.13][ERROR]: unable to find a config; path lib/Db/TaskProcessing/TaskProcessingProvider.php┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m [00.21][ERROR]: unable to find a config; path lib/Db/UI/FilesActionsMenu.php┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m [00.18][ERROR]: unable to find a config; path
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (3)
.github/workflows/openapi.yml (2)
81-85: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueConsider explicit command and dependency caching.
Two optional improvements:
- Use
composer installinstead ofcomposer ifor better clarity in CI logs.- 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 valueSimplify the git status check.
The current bash construct is complex. Consider using
git diff --exit-codewhich 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 winComplex 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
⛔ Files ignored due to path filters (1)
vendor-bin/openapi-extractor/composer.lockis excluded by!**/*.lock
📒 Files selected for processing (46)
.github/workflows/command-openapi.yml.github/workflows/openapi.ymlREUSE.tomlappinfo/routes.phpcomposer.jsonlib/Capabilities.phplib/Controller/AppConfigController.phplib/Controller/ConfigController.phplib/Controller/DaemonConfigController.phplib/Controller/ExAppProxyController.phplib/Controller/ExAppsPageController.phplib/Controller/HarpController.phplib/Controller/NotificationsController.phplib/Controller/OCSApiController.phplib/Controller/OCSExAppController.phplib/Controller/OCSSettingsController.phplib/Controller/OCSUiController.phplib/Controller/OccCommandController.phplib/Controller/PreferencesController.phplib/Controller/TalkBotController.phplib/Controller/TaskProcessingController.phplib/Controller/TopMenuController.phplib/Db/Console/ExAppOccCommand.phplib/Db/DaemonConfig.phplib/Db/ExApp.phplib/Db/ExAppConfig.phplib/Db/ExAppPreference.phplib/Db/TaskProcessing/TaskProcessingProvider.phplib/Db/UI/FilesActionsMenu.phplib/Db/UI/InitialState.phplib/Db/UI/Script.phplib/Db/UI/Style.phplib/Db/UI/TopMenu.phplib/PublicCapabilities.phplib/ResponseDefinitions.phpopenapi-administration.jsonopenapi-full.jsonopenapi.jsontests/php/Controller/AppConfigControllerTest.phptests/php/Controller/OCSSettingsControllerTest.phptests/php/Controller/OCSUiControllerTest.phptests/php/Controller/OccCommandControllerTest.phptests/php/Controller/PreferencesControllerTest.phptests/php/Controller/TalkBotControllerTest.phptests/php/Controller/TaskProcessingControllerTest.phpvendor-bin/openapi-extractor/composer.json
Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
1e37b0a to
2c60c65
Compare
Subj. Additionally in
appinfo/routes.phpI removed five dead routes whose controllers no longer exist (threeEventsListenerroutes and twoExAppsPage#viewAppsroutes) and added'postfix' => 'get'to the GETenableApproute so it no longer collides with the POSTenableApproute during spec generation.🤖 AI (if applicable)