feat: 调试必传参数
This commit is contained in:
@@ -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"`
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user