feat: 修复数字取值范围与字符长度限制显示错误问题

This commit is contained in:
2026-01-06 19:17:22 +08:00
parent 708e327ddf
commit 088b813045
3 changed files with 20 additions and 7 deletions

View File

@@ -137,7 +137,7 @@ func (g *Generate) AddApiDoc(apiMeta define.UriConfig, request any, response any
schemaData := GenerateOpenAPISchema(requestType)
apiOperate, isRead := g.initApiConfig(apiMeta)
requestTypeStr := strings.ReplaceAll(requestType.String(), ".", "_")
requestTypeStr := requestType.String()
if isRead {
for paramName, paramConfig := range schemaData.Value.Properties {
apiOperate.Parameters = append(apiOperate.Parameters, &openapi3.ParameterRef{
@@ -152,7 +152,7 @@ func (g *Generate) AddApiDoc(apiMeta define.UriConfig, request any, response any
Description: paramConfig.Value.Description,
Style: "",
Explode: nil,
AllowEmptyValue: false,
AllowEmptyValue: paramConfig.Value.AllowEmptyValue,
AllowReserved: false,
Deprecated: false,
Required: op_array.ArrayType(paramConfig.Value.Required).Has(paramName) >= 0,
@@ -176,7 +176,7 @@ func (g *Generate) AddApiDoc(apiMeta define.UriConfig, request any, response any
if _, exist := g.doc.Components.Schemas[requestTypeStr]; !exist {
g.doc.Components.Schemas[requestTypeStr] = schemaData
}
responseTypeStr := strings.ReplaceAll(requestType.String(), ".", "_")
responseTypeStr := requestType.String()
if _, exist := g.doc.Components.Schemas[responseTypeStr]; !exist {
g.doc.Components.Schemas[responseTypeStr] = GenerateOpenAPISchema(responseType)
}