Skip to content

build(deploy): refresh OpenAPI docs after deployments - #1540

Open
NishaSharma14 wants to merge 2 commits into
developmentfrom
issue-#1539
Open

build(deploy): refresh OpenAPI docs after deployments#1540
NishaSharma14 wants to merge 2 commits into
developmentfrom
issue-#1539

Conversation

@NishaSharma14

Copy link
Copy Markdown
Contributor

Regenerate L5 Swagger docs and publish public/api-docs.json as part of the shared post-deploy routine for both dev and prod deployments, so API docs stay in sync with deployed code after build, restart, or successful image deploy.

Regenerate L5 Swagger docs and publish public/api-docs.json as part of the
shared post-deploy routine for both dev and prod deployments, so API docs stay
in sync with deployed code after build, restart, or successful image deploy.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

OpenAPI regeneration is currently likely to run multiple times per deploy invocation (and one prod log message is misleading), which should be addressed before merging.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates the deployment scripts to regenerate L5 Swagger OpenAPI docs post-deploy so the published public/api-docs.json stays aligned with the currently deployed code.

Changes:

  • Added a refresh_openapi_docs routine to run php artisan l5-swagger:generate and copy the generated spec into public/api-docs.json.
  • Wired OpenAPI refresh into the shared post-deploy routine (run_migration_and_clear_cache) for both dev and prod scripts.
File summaries
File Description
deployment/deploy-prod.sh Adds OpenAPI doc refresh and runs it during the migration/cache routine for prod deploy/build/restart flows.
deployment/deploy-dev.sh Adds OpenAPI doc refresh and runs it during the migration/cache routine for dev deploy/build/restart flows.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread deployment/deploy-dev.sh
Comment on lines +195 to +201
refresh_openapi_docs() {
log_message "Refreshing OpenAPI documentation..."

docker compose -f "$COMPOSE_FILE" exec -T app sh -lc 'cd /var/www/html && L5_SWAGGER_USE_REFLECTION_ANALYSER=true php artisan l5-swagger:generate && cp storage/api-docs/api-docs.json public/api-docs.json'

log_message "OpenAPI documentation refreshed successfully"
}
Comment thread deployment/deploy-prod.sh
Comment on lines +279 to +285
refresh_openapi_docs() {
log_message "Refreshing OpenAPI documentation..."

docker compose -f "$COMPOSE_FILE" exec -T app sh -lc 'cd /var/www/html && L5_SWAGGER_USE_REFLECTION_ANALYSER=true php artisan l5-swagger:generate && cp storage/api-docs/api-docs.json public/api-docs.json'

log_message "OpenAPI documentation refreshed successfully"
}
Comment thread deployment/deploy-prod.sh
docker compose -f "$COMPOSE_FILE" exec -T app php artisan optimize:clear

log_message "Database migration completed successfully"
log_message "Database migration and cache refresh completed successfully"
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.26%. Comparing base (8681915) to head (aca4426).

Additional details and impacted files
@@              Coverage Diff               @@
##             development    #1540   +/-   ##
==============================================
  Coverage          80.25%   80.26%           
  Complexity          4481     4481           
==============================================
  Files                293      293           
  Lines              16424    16424           
==============================================
+ Hits               13181    13182    +1     
+ Misses              3243     3242    -1     
Flag Coverage Δ
unittests 80.26% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@NishaSharma14 NishaSharma14 linked an issue Sep 4, 2026 that may be closed by this pull request
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.

Automate Swagger/OpenAPI doc generation in deployment script

2 participants