1
0

2 Commits 9d1b0819ef ... 3f4e5ee015

Autor SHA1 Nachricht Datum
  yang yi 3f4e5ee015 # feat:完善openAPI配置类 vor 1 Woche
  yang yi c629496ff8 # feat:完善openAPI实体的定义信息 vor 1 Woche

+ 23 - 0
src/main/java/space/anyi/serve/config/OpenApiConfig.java

@@ -0,0 +1,23 @@
+package space.anyi.serve.config;
+
+import io.swagger.v3.oas.models.OpenAPI;
+import io.swagger.v3.oas.models.info.Contact;
+import io.swagger.v3.oas.models.info.Info;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class OpenApiConfig {
+
+    @Bean
+    public OpenAPI customOpenAPI() {
+        return new OpenAPI()
+                .info(new Info()
+                        .title("Serve API")
+                        .version("0.0.1-SNAPSHOT")
+                        .description("Serve应用接口文档")
+                        .contact(new Contact()
+                                .name("杨逸"))
+                );
+    }
+}

+ 2 - 2
src/main/java/space/anyi/serve/entity/user/UpdateUserAvatarDto.java

@@ -21,11 +21,11 @@ import jakarta.validation.constraints.Pattern;
 )
 public class UpdateUserAvatarDto {
     @NotBlank(message = "用户ID不能为空")
-    @Schema(description = "用户的ID")
+    @Schema(description = "用户的ID", minLength = 1)
     private String id;
     @Pattern(regexp = "^(https?)://[^\\s/$.?#].[^\\s]*$", message = "URL格式不正确")
     @NotBlank(message = "头像不能链接地址不能为空")
-    @Schema(description = "头像地址的链接")
+    @Schema(description = "头像地址的链接", minLength = 1)
     private String avatar;
 
     public String getId() {

+ 3 - 3
src/main/java/space/anyi/serve/entity/user/UpdateUserPasswordDto.java

@@ -15,15 +15,15 @@ import jakarta.validation.constraints.Size;
 @Schema(description = "用户密码修改使用的DTO")
 public class UpdateUserPasswordDto {
     @NotBlank(message = "用户ID不能为空")
-    @Schema(description = "用户ID")
+    @Schema(description = "用户ID", minLength = 1)
     private String id;
     @NotBlank(message = "用户的旧密码不能为空")
     @Size(min = 4,max = 20,message = "用户密码长度不能小于4且不能大于20")
-    @Schema(description = "用户的当前密码")
+    @Schema(description = "用户的当前密码", minLength = 4,maxLength = 20)
     private String password;
     @NotBlank(message = "用户的新密码不能为空")
     @Size(min = 4,max = 20,message = "用户密码长度不能小于4且不能大于20")
-    @Schema(description = "用户的新密码")
+    @Schema(description = "用户的新密码", minLength = 4,maxLength = 20)
     private String oldPassword;
 
     public String getId() {

+ 2 - 2
src/main/java/space/anyi/serve/entity/user/UpdateUserStatusDto.java

@@ -18,12 +18,12 @@ import jakarta.validation.constraints.NotNull;
 @Schema(description = "用户状态更新使用的DTO")
 public class UpdateUserStatusDto {
     @NotBlank(message = "用户ID不能为空")
-    @Schema(description = "用户ID")
+    @Schema(description = "用户ID", minLength = 1)
     private String id;
     @NotNull(message = "用户状态不能为空")
     @Min(value = 0,message = "状态不能小于0")
     @Max(value = 1,message = "用户状态不能大于1")
-    @Schema(description = "更新后的状态;1:启用,0:禁用")
+    @Schema(description = "更新后的状态;1:启用,0:禁用", minLength = 1)
     private Integer enable;
 
     public String getId() {

+ 13 - 5
src/main/java/space/anyi/serve/entity/user/UserDto.java

@@ -12,25 +12,33 @@ import jakarta.validation.constraints.Size;
  * @date:2026/3/31 20:42
  * @description:
  */
-@Schema(description = "用户新增和修改使用的DTO")
+@Schema(
+        description = "用户新增和修改使用的DTO",
+        requiredProperties = {
+                "account",
+                "password",
+                "username",
+                "role"
+        }
+)
 public class UserDto {
     @Schema(description = "用户ID")
     private String id;
     @NotBlank(message = "用户账号不能为空")
     @Size(min = 4,max = 20,message = "用户账号长度不能小于4且不能大于20")
-    @Schema(description = "用户账号")
+    @Schema(description = "用户账号",minLength = 4,maxLength = 20)
     private String account;
     @NotBlank(message = "用户密码不能为空")
     @Size(min = 4,max = 20,message = "用户密码长度不能小于4且不能大于20")
-    @Schema(description = "用户密码")
+    @Schema(description = "用户密码",minLength = 4,maxLength = 20)
     private String password;
     @NotBlank(message = "用户名称不能为空")
     @Size(min = 2,max = 32,message = "用户名称长度不能小于2且不能大于32")
-    @Schema(description = "用户名称")
+    @Schema(description = "用户名称",minLength = 2,maxLength = 32)
     private String username;
     @NotBlank(message = "用户角色不能为空")
     @Size(min = 4,max = 32,message = "用户角色长度不能小于4且不能大于32")
-    @Schema(description = "用户角色")
+    @Schema(description = "用户角色",minLength = 4,maxLength = 32)
     private String role;
 
     public String getId() {