Fix error response documentation for field attribute
Separated ErrorResponse and ValidationErrorResponse types: - ErrorResponse: general errors (401, 403, 404, 500) - no field attribute - ValidationErrorResponse: form validation errors (400) - includes field attribute Updated respondValidationError to return appropriate type based on error format. Updated Swagger documentation to use ValidationErrorResponse only for validation endpoints. This ensures the field attribute only appears in API responses for actual form field validation errors, not in general error responses.
This commit is contained in:
@@ -96,7 +96,7 @@ type LogoutRequest struct {
|
||||
// @Produce json
|
||||
// @Param request body RegisterRequest true "Registration data (password requires: min 8 chars, uppercase, lowercase, digit, special char)"
|
||||
// @Success 201 {object} RegisterResponse "Returns user ID and message about next steps"
|
||||
// @Failure 400 {object} ErrorResponse "Invalid input: email format, password requirements, or timezone"
|
||||
// @Failure 400 {object} ValidationErrorResponse "Invalid input: email format, password requirements, or timezone"
|
||||
// @Failure 403 {object} ErrorResponse "Registration is closed"
|
||||
// @Failure 409 {object} ErrorResponse "Email already registered"
|
||||
// @Failure 500 {object} ErrorResponse "Internal server error"
|
||||
|
||||
Reference in New Issue
Block a user