fixed homepage not respecting homepage.show field, disabled schema validation for included file

This commit is contained in:
yusing
2024-10-04 08:36:32 +08:00
parent 6211ddcdf0
commit e566fd9b57
6 changed files with 33 additions and 15 deletions

View File

@@ -58,7 +58,14 @@ func ApplyLabel[T any](obj *T, l *Label) E.NestedError {
}
dst, ok := field.Interface().(NestedLabelMap)
if !ok {
return U.Deserialize(U.SerializedObject{nestedLabel.Namespace: nestedLabel.Value}, field.Addr().Interface())
if field.Kind() == reflect.Ptr {
if field.IsNil() {
field.Set(reflect.New(field.Type().Elem()))
}
} else {
field = field.Addr()
}
return U.Deserialize(U.SerializedObject{nestedLabel.Namespace: nestedLabel.Value}, field.Interface())
}
if dst == nil {
field.Set(reflect.MakeMap(reflect.TypeFor[NestedLabelMap]()))