Skip to content

Add automatic Swagger UI and ReDoc docs routes under /docs - #3

Draft
yufeiminds with Copilot wants to merge 7 commits into
mainfrom
copilot/add-swagger-ui-and-redoc-integration
Draft

yufeiminds with Copilot wants to merge 7 commits into
mainfrom
copilot/add-swagger-ui-and-redoc-integration

Conversation

Copilot AI commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Add automatic API documentation integration for generated projects.

Changes

  • Generate built-in docs routes in src/generated/router.mbt:
    • GET /docs → Swagger UI (internal development platform)
    • GET /docs/redoc → ReDoc (open platform)
    • GET /docs/openapi → embedded raw OpenAPI spec
  • Pass raw spec content from CLI command flow into generator so docs can be served automatically.
  • Add safer embedded-spec handling:
    • content-type inference (application/json, application/yaml, fallback text/plain)
    • escaping for quotes, slashes, whitespace escapes, and control characters (including DEL)
  • Update README feature list to document new docs endpoints.

Validation

  • moon fmt ❌ (not available in environment: moon: command not found)
  • moon check ❌ (not available in environment: moon: command not found)
  • moon build ❌ (not available in environment: moon: command not found)
  • moon test ❌ (not available in environment: moon: command not found)
  • Parallel validation (Code Review + CodeQL) ✅

Notes

  • One non-blocking review suggestion remains: replacing numeric constant 127 with a named constant for readability.

Copilot AI and others added 6 commits April 16, 2026 19:00
Agent-Logs-Url: https://github.com/cogna-dev/mapi/sessions/02524dc6-8ed4-4160-bb9b-ee50d44c6748

Co-authored-by: yufeiminds <9150374+yufeiminds@users.noreply.github.com>
Agent-Logs-Url: https://github.com/cogna-dev/mapi/sessions/02524dc6-8ed4-4160-bb9b-ee50d44c6748

Co-authored-by: yufeiminds <9150374+yufeiminds@users.noreply.github.com>
Agent-Logs-Url: https://github.com/cogna-dev/mapi/sessions/02524dc6-8ed4-4160-bb9b-ee50d44c6748

Co-authored-by: yufeiminds <9150374+yufeiminds@users.noreply.github.com>
Agent-Logs-Url: https://github.com/cogna-dev/mapi/sessions/02524dc6-8ed4-4160-bb9b-ee50d44c6748

Co-authored-by: yufeiminds <9150374+yufeiminds@users.noreply.github.com>
Agent-Logs-Url: https://github.com/cogna-dev/mapi/sessions/02524dc6-8ed4-4160-bb9b-ee50d44c6748

Co-authored-by: yufeiminds <9150374+yufeiminds@users.noreply.github.com>
@yufeiminds

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Co-authored-by: yufeiminds <9150374+yufeiminds@users.noreply.github.com>

Copilot AI commented Apr 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Conflicts are resolved and the branch is updated with a merge commit from origin/main while preserving the /docs Swagger UI + ReDoc integration. Commit: 85daaa8.

No UI layout changes were introduced in this conflict-resolution update, so there is no new UI screenshot.

This branch has not been deployed

No deployments
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.

2 participants