Skip to content

fix: use *bool for EmailVerified in CreateUserRequestDto#270

Merged
The127 merged 1 commit intomainfrom
fix/create-user-email-verified-validation
Apr 19, 2026
Merged

fix: use *bool for EmailVerified in CreateUserRequestDto#270
The127 merged 1 commit intomainfrom
fix/create-user-email-verified-validation

Conversation

@The127
Copy link
Copy Markdown
Owner

@The127 The127 commented Apr 19, 2026

Summary

  • EmailVerified bool with validate:"required" caused user creation to always fail when emailVerified: false was sent, because go-playground/validator rejects the zero value of a bool
  • Changed to *bool with no required tag; handler uses utils.ZeroIfNil to default to false when omitted

Test plan

  • Create a user via the UI without checking email verified — should succeed
  • Create a user with emailVerified: true — should still work
  • Create a user without sending emailVerified at all — should default to false

…uired validator rejecting false

go-playground/validator's required tag rejects the zero value of bool (false),
causing user creation to always fail with a validation error when emailVerified
is set to false. Switching to *bool with ZeroIfNil makes the field optional and
defaults to false when omitted.

Signed-off-by: karo <karolin.kostial@gmail.com>
@The127 The127 force-pushed the fix/create-user-email-verified-validation branch from 9b71190 to f591e58 Compare April 19, 2026 11:55
@The127 The127 enabled auto-merge (squash) April 19, 2026 11:56
@The127 The127 merged commit 9d5fb6b into main Apr 19, 2026
8 checks passed
@The127 The127 deleted the fix/create-user-email-verified-validation branch April 19, 2026 11:58
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.

1 participant