fix delete title schema

This commit is contained in:
tenacious
2024-12-26 00:24:45 +08:00
parent bfba4866a5
commit 3409d7a6b6

View File

@@ -245,12 +245,12 @@ func removeAdditionalPropertiesWithDepth(schema interface{}, depth int) interfac
if !ok || len(v) == 0 { if !ok || len(v) == 0 {
return schema return schema
} }
// 删除所有的title字段
delete(v, "title")
// 如果type不为object和array则直接返回 // 如果type不为object和array则直接返回
if typeVal, exists := v["type"]; !exists || (typeVal != "object" && typeVal != "array") { if typeVal, exists := v["type"]; !exists || (typeVal != "object" && typeVal != "array") {
return schema return schema
} }
delete(v, "title")
switch v["type"] { switch v["type"] {
case "object": case "object":
delete(v, "additionalProperties") delete(v, "additionalProperties")