feat(backend): when the convert array element contains an object, waring information occurs, and the object needs to be added to the array element as well
This commit is contained in:
parent
59729f01b2
commit
3b546369d8
|
|
@ -154,6 +154,9 @@ func FillIfNotRequired(tInfo *vo.TypeInfo, container map[string]any, k string, s
|
||||||
}
|
}
|
||||||
|
|
||||||
newSubContainer := maps.Clone(subContainer)
|
newSubContainer := maps.Clone(subContainer)
|
||||||
|
if newSubContainer == nil {
|
||||||
|
newSubContainer = make(map[string]any)
|
||||||
|
}
|
||||||
|
|
||||||
for subK, subL := range elemTInfo.Properties {
|
for subK, subL := range elemTInfo.Properties {
|
||||||
if err := FillIfNotRequired(subL, newSubContainer, subK, strategy, true); err != nil {
|
if err := FillIfNotRequired(subL, newSubContainer, subK, strategy, true); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -391,6 +391,9 @@ func convertToArray(ctx context.Context, in any, path string, t *vo.TypeInfo, op
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
} else if ws != nil {
|
} else if ws != nil {
|
||||||
|
if elemType.Type == vo.DataTypeObject { // If the array type and the element is an object, the converted object will also need to be added to the array when waring occurs
|
||||||
|
out = append(out, newV)
|
||||||
|
}
|
||||||
warnings = append(warnings, *ws...)
|
warnings = append(warnings, *ws...)
|
||||||
} else { // only correctly converted elements go into the final array
|
} else { // only correctly converted elements go into the final array
|
||||||
out = append(out, newV)
|
out = append(out, newV)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue