Skip to content

Return types alignment#29

Merged
LightJack05 merged 2 commits intomainfrom
return-types-alignment
Jan 27, 2026
Merged

Return types alignment#29
LightJack05 merged 2 commits intomainfrom
return-types-alignment

Conversation

@LightJack05
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings January 27, 2026 12:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR standardizes HTTP error response types across the API by introducing a shared handlers.Error model and wiring it into both handlers and Swagger documentation.

Changes:

  • Introduced a centralized handlers.Error struct and updated user, session, and health handlers to return this type instead of ad-hoc gin.H{"error": ...} maps.
  • Updated Swagger annotations in handlers plus swagger.yaml, swagger.json, and docs.go to reference the new handlers.Error definition for 4xx/5xx responses.
  • Ensured error response schemas are aligned between runtime behavior and API documentation for all relevant user and session endpoints.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/handlers/userhandler/post.go Switches POST /auth/user error responses to use handlers.Error and updates Swagger failure types accordingly.
internal/handlers/userhandler/patch.go Updates PATCH /auth/user bad request and internal error responses to use handlers.Error and aligns annotations.
internal/handlers/userhandler/get.go Uses handlers.Error for not-found and internal errors on GET /auth/user and updates Swagger failure schemas.
internal/handlers/userhandler/delete.go Standardizes DELETE /auth/user internal error response on handlers.Error and adjusts failure annotation.
internal/handlers/sessionhandler/post.go Updates login error paths (400/401/500) to return handlers.Error and documents these in Swagger.
internal/handlers/sessionhandler/delete.go Standardizes logout error responses (400/401/500) on handlers.Error and updates Swagger annotations.
internal/handlers/health/get.go Returns handlers.Error for database unavailability on the health check endpoint.
internal/handlers/error.go Introduces the shared handlers.Error struct ({"error": string}) used by all handlers.
docs/swagger.yaml Defines handlers.Error in the OpenAPI spec and rewires relevant response schemas to reference it.
docs/swagger.json Mirrors the YAML changes in the generated JSON Swagger spec, referencing handlers.Error for error responses.
docs/docs.go Updates the embedded Swagger template to define and use handlers.Error for documented error responses.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@LightJack05 LightJack05 requested a review from Ferrari78 January 27, 2026 14:27
@LightJack05 LightJack05 merged commit 320dd28 into main Jan 27, 2026
12 checks passed
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