docs: add error responses to openapi spec (#1684)

This commit is contained in:
Anthony Clerici
2026-08-11 19:26:48 +02:00
committed by GitHub
parent 155a1fcba0
commit 86cf73b86c
13 changed files with 93 additions and 8 deletions
+1 -8
View File
@@ -106,13 +106,6 @@ func (m *ErrorHandlerMiddleware) Add() gin.HandlerFunc {
}
}
type errorResponseBody struct {
Error string `json:"error"`
Code apperror.Code `json:"code"`
Details map[string]any `json:"details,omitempty"`
RequestID string `json:"request_id,omitempty"`
}
func classifyError(err error) classifiedError {
var structuredErr *apperror.Error
if errors.As(err, &structuredErr) && structuredErr != nil {
@@ -188,7 +181,7 @@ func writeErrorResponse(c *gin.Context, classified classifiedError, requestID st
details = nil
}
response := errorResponseBody{
response := dto.ErrorDto{
Error: classified.message,
Code: classified.code,
Details: details,