-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
HardSWoC26documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request
Description
Summary
Integrate Swagger API documentation into the BrowsePing backend using swagger-ui-express and swagger-autogen, ensuring compatibility with the current codebase.
Details
- Add API documentation using Swagger UI so that developers can easily browse and test endpoints.
- Use
swagger-autogenfor automatic generation of the Swagger JSON documentation from JSDoc/TSDoc comments in the codebase. - Expose Swagger UI at a route such as
/docsor/api-docs. - Ensure minimal refactoring—prioritize compatibility with the existing Express.js/TypeScript application and folder structure.
- Only generate Swagger documentation JSON locally (do not commit generated JSON to repo).
- Add generated Swagger files to
.gitignore/ ensure no docs or generated JSON are pushed.
Implementation Suggestions
- Install
swagger-ui-expressandswagger-autogenas devDependencies. - Create a standalone script file for documentation generation.
- Add an npm script (e.g.,
npm run generate:swagger) to generate the documentation locally. - The API docs UI (
/docsor/api-docs) should only appear when the Swagger JSON is present and should NOT be exposed in production. - Swagger docs must NOT break the server if the docs are not generated or not present.
- Production server (
npm run start) must not require or serve Swagger docs. - Add
.envvariable to control docs UI; default to enabled only for development/local environment. - users must generate docs locally; do not add generated files to version control.
- Follow minimal-change principle—do not refactor existing routes beyond what's necessary for Swagger integration.
SWoC Friendly Guidance
- Reference open source examples where Swagger docs are optional/local-only.
- Keep the PR atomic and focused.
- Confirm that production flow is untouched for users who do not generate docs.
- Ask for help in Discord if you hit any blockers.
While working on this issue, please adhere to the guidelines outlined in contributing.md. Any pull requests that do not follow these rules will be marked as invalid.
Metadata
Metadata
Assignees
Labels
HardSWoC26documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request