Add Swagger documentation for user routes - #282
Open
cyber-shehan wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds Swagger/OpenAPI documentation for the User Service routes to improve API documentation and make the endpoints easier to understand and test through Swagger UI.
The documentation includes:
• Endpoint summaries and descriptions.
• Appropriate tags for grouping endpoints.
• Bearer authentication requirements for protected endpoints.
• Path parameter documentation where applicable.
• Response documentation for successful and error responses.
Swagger annotations were added to the route definitions to generate the API documentation.
Documented Endpoints
Health
• GET /api/users/health
Metadata
• GET /api/users/meta/locations
• GET /api/users/meta/event-statuses
• GET /api/users/meta/linked-event-types
• GET /api/users/meta/seasons
• GET /api/users/meta/reference-days
• GET /api/users/meta/reference-times
Integration
• GET /api/users/integration
• GET /api/users/integration/{integrationId}
Training Models
• GET /api/users/training-models
• GET /api/users/training-models/{file_id}
Users
• GET /api/users/user
Dashboard
• GET /api/users/dashboard/overview
• GET /api/users/dashboard/charts
• GET /api/users/dashboard/activity
Hazards
• GET /api/users/hazards
• GET /api/users/hazards/{hazardId}
Testing
• Verified that all documented endpoints are displayed correctly in Swagger UI.
• Tested the documentation locally using:
◦ npm run dev:gateway
◦ npm run dev:user
• Confirmed that protected endpoints correctly require authentication and return401 Unauthorized when accessed without a valid token.
Notes
This PR only adds Swagger/OpenAPI documentation and related Swagger annotations. No business logic or endpoint behaviour was intentionally modified.