feat: 调试必传参数

This commit is contained in:
2026-01-06 18:52:57 +08:00
parent 0dd0e8f22f
commit 8ed6735d48
2 changed files with 4 additions and 3 deletions

View File

@@ -19,8 +19,8 @@ import (
func TestGenerate_AddApiDoc(t *testing.T) {
type Category struct {
ID int64 `json:"id" description:"分类ID"`
Name string `json:"name" description:"分类名称"`
ID int64 `json:"id" description:"分类ID" binding:"required,min=10,max=100"`
Name string `json:"name" description:"分类名称" binding:"required,min=8"`
}
type Product struct {
ID int64 `json:"id,omitempty" description:"产品ID" example:"1001" required:"true" binding:"required"`

View File

@@ -81,7 +81,8 @@ func GenerateOpenAPISchema(s any) *openapi3.SchemaRef {
}
}
return generateSchemaRecursive(tType, make(map[string]bool))
schema := generateSchemaRecursive(tType, make(map[string]bool))
return schema
}
// 生成 schema