View Javadoc
1   package fr.tiogars.domaintemplate.domains.auth.user.models;
2   
3   import java.util.Set;
4   
5   import io.swagger.v3.oas.annotations.media.Schema;
6   import jakarta.validation.constraints.NotBlank;
7   import jakarta.validation.constraints.NotEmpty;
8   
9   /** Request body used to create a user account. */
10  public record CreateUserRequest(
11          @Schema(
12                  description = "Unique login name.",
13                  example = "operator",
14                  requiredMode = Schema.RequiredMode.REQUIRED)
15          @NotBlank
16          String username,
17          @Schema(
18                  description = "Plain password, stored only as a BCrypt hash.",
19                  requiredMode = Schema.RequiredMode.REQUIRED)
20          @NotBlank
21          String password,
22          @Schema(description = "Whether this account can authenticate.", example = "true")
23          Boolean enabled,
24          @Schema(
25                  description = "Role codes assigned to this account.",
26                  example = "[\"USER\"]",
27                  requiredMode = Schema.RequiredMode.REQUIRED)
28          @NotEmpty
29          Set<@NotBlank String> roles) {
30  }