Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
477a9a18
Commit
477a9a18
authored
Jan 21, 2026
by
0xff26b9a8
Browse files
fix: 修复 schema 清理逻辑
parent
da48df06
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/internal/pkg/antigravity/schema_cleaner.go
View file @
477a9a18
...
...
@@ -146,17 +146,10 @@ func cleanJSONSchemaRecursive(value any) any {
for
_
,
v
:=
range
schemaMap
{
if
_
,
isMap
:=
v
.
(
map
[
string
]
any
);
isMap
{
cleanJSONSchemaRecursive
(
v
)
}
else
if
_
,
isArr
:=
v
.
([]
any
);
isArr
{
// 数组内的对象也要递归
}
}
// 稍微补全一下数组递归
for
k
,
v
:=
range
schemaMap
{
if
arr
,
ok
:=
v
.
([]
any
);
ok
{
}
else
if
arr
,
isArr
:=
v
.
([]
any
);
isArr
{
for
_
,
item
:=
range
arr
{
cleanJSONSchemaRecursive
(
item
)
}
schemaMap
[
k
]
=
arr
}
}
}
...
...
@@ -455,18 +448,18 @@ func mergeAllOf(m map[string]any) {
}
if
len
(
mergedReq
)
>
0
{
existReq
,
_
:=
m
[
"required"
]
.
([]
any
)
var
current
Reqs
[]
string
var
valid
Reqs
[]
any
for
_
,
r
:=
range
existReq
{
if
s
,
ok
:=
r
.
(
string
);
ok
{
current
Reqs
=
append
(
current
Reqs
,
s
)
valid
Reqs
=
append
(
valid
Reqs
,
s
)
delete
(
mergedReq
,
s
)
// already exists
}
}
// append new
for
r
:=
range
mergedReq
{
exist
Req
=
append
(
exist
Req
,
r
)
valid
Req
s
=
append
(
valid
Req
s
,
r
)
}
m
[
"required"
]
=
exist
Req
m
[
"required"
]
=
valid
Req
s
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment