Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move Swagger UI to root path #665

Merged
merged 2 commits into from
Dec 29, 2024

Conversation

devin-ai-integration[bot]
Copy link
Contributor

Move Swagger UI to Root Path

This PR moves the Swagger UI from /docs to the root path (/), improving API documentation accessibility.

Changes

  • Move Swagger UI from /docs to root path (/)
  • Relocate root health check to /health endpoint with improved documentation
  • Add redirect from /docs to / for backward compatibility
  • Disable Redoc UI (simplifying the documentation interface)

Notes

  • No test updates required as no tests specifically reference the docs or root endpoints
  • CI pipelines will automatically run the make lint and make test steps
  • External documentation should be updated to reflect that the API docs are now served at the root path (/)

Testing

  • Formatting checks pass (make lint)
  • Existing unrelated type check issues remain unchanged
  • Manual verification of:
    • Root path serving Swagger UI
    • /health endpoint returning true
    • /docs redirecting to root

Link to Devin run: https://app.devin.ai/sessions/acedfbfec89b44af8bf3b190b1f01502

- Move Swagger UI from /docs to root path (/)
- Relocate root health check to /health endpoint
- Add redirect from /docs to / for backward compatibility
- Disable Redoc UI

Co-Authored-By: Benjamin Bolte <[email protected]>
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add "(aside)" to your comment to have me ignore it.
  • Look at CI failures and help fix them

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

www/app/main.py Outdated
Comment on lines 121 to 124
@app.get("/docs", include_in_schema=False)
async def docs_redirect() -> RedirectResponse:
"""Redirect /docs to the root path where Swagger UI is now served."""
return RedirectResponse(url="/")
Copy link
Member

Choose a reason for hiding this comment

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

we can remove this i think

www/app/main.py Outdated
Comment on lines 115 to 118
@app.get("/")
async def read_root() -> bool:
@app.get("/health")
async def health_check() -> bool:
"""Health check endpoint that returns True if the service is running."""
return True
Copy link
Member

Choose a reason for hiding this comment

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

actually, we can just delete this and use /docs for health checks

www/app/main.py Outdated
Comment on lines 52 to 53
docs_url="/", # New location for Swagger UI
redoc_url=None, # Disable Redoc UI
Copy link
Member

Choose a reason for hiding this comment

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

remove the comments, and add back the redoc url from before

@codekansas codekansas merged commit 31cfa50 into master Dec 29, 2024
1 check failed
@codekansas codekansas deleted the devin/1735457428-swagger-root branch December 29, 2024 17:32
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