Refactor(Parameter): Optimize parameter verification #22

Merged
FatttSnake merged 1 commits from FatttSnake into dev 2024-04-22 16:14:53 +08:00
5 changed files with 18 additions and 1 deletions
Showing only changes of commit 015e2ac09c - Show all commits

View File

@@ -40,7 +40,7 @@ data class MailSettingsParam(
* @since 1.0.0
*/
@Schema(description = "安全类型", allowableValues = ["None", "SSL/TLS", "StartTls"], defaultValue = "None")
val securityType: MailSecurityType? = MailSecurityType.NONE,
val securityType: MailSecurityType = MailSecurityType.NONE,
/**
* Username

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import top.fatweb.oxygen.api.annotation.Trim
/**
@@ -30,6 +31,7 @@ data class ToolBaseUpdateParam(
*/
@Trim
@Schema(description = "名称")
@field: Pattern(regexp = "^.*\\S.*$", message = "Name can not be blank")
var name: String?,
/**
@@ -39,6 +41,7 @@ data class ToolBaseUpdateParam(
* @since 1.0.0
*/
@Schema(description = "源码")
@field: Pattern(regexp = "^.*\\S.*$", message = "Source can not be blank")
val source: String?,
/**
@@ -48,5 +51,6 @@ data class ToolBaseUpdateParam(
* @since 1.0.0
*/
@Schema(description = "产物")
@field: Pattern(regexp = "^.*\\S.*$", message = "Dist can not be blank")
val dist: String?
)

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import top.fatweb.oxygen.api.annotation.Trim
/**
@@ -30,6 +31,7 @@ data class ToolCategoryUpdateParam(
*/
@Trim
@Schema(description = "名称")
@field: Pattern(regexp = "^.*\\S.*$", message = "Name can not be blank")
var name: String?,
/**

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import top.fatweb.oxygen.api.annotation.Trim
/**
@@ -30,6 +31,7 @@ data class ToolTemplateUpdateParam(
*/
@Trim
@Schema(description = "名称")
@field: Pattern(regexp = "^.*\\S.*$", message = "Name can not be blank")
var name: String?,
/**
@@ -39,6 +41,7 @@ data class ToolTemplateUpdateParam(
* @since 1.0.0
*/
@Schema(description = "源码")
@field: Pattern(regexp = "^.*\\S.*$", message = "Source can not be blank")
val source: String?,
/**
@@ -49,6 +52,7 @@ data class ToolTemplateUpdateParam(
*/
@Trim
@Schema(description = "入口文件")
@field: Pattern(regexp = "^.*\\S.*$", message = "Entry point can not be blank")
var entryPoint: String?,
/**

View File

@@ -2,6 +2,8 @@ package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import top.fatweb.oxygen.api.annotation.Trim
/**
@@ -31,6 +33,7 @@ data class ToolUpdateParam(
*/
@Trim
@Schema(description = "名称")
@field: Pattern(regexp = "^.*\\S.*$", message = "Name can not be blank")
var name: String?,
/**
@@ -40,6 +43,7 @@ data class ToolUpdateParam(
* @since 1.0.0
*/
@Schema(description = "图标")
@field: Pattern(regexp = "^.*\\S.*$", message = "Icon can not be blank")
val icon: String?,
/**
@@ -58,6 +62,7 @@ data class ToolUpdateParam(
* @since 1.0.0
*/
@Schema(description = "关键词")
@field:Size(min = 1, message = "Keywords can not be empty")
val keywords: List<String>?,
/**
@@ -67,6 +72,7 @@ data class ToolUpdateParam(
* @since 1.0.0
*/
@Schema(description = "类别")
@field:Size(min = 1, message = "Categories can not be empty")
val categories: List<Long>?,
/**
@@ -76,5 +82,6 @@ data class ToolUpdateParam(
* @since 1.0.0
*/
@Schema(description = "源码")
@field: Pattern(regexp = "^.*\\S.*$", message = "Source can not be blank")
val source: String?
)