chore: add more tests (#4949)

This commit is contained in:
Kevin Wan
2025-06-13 22:10:08 +08:00
committed by GitHub
parent 4cacc4d9d3
commit 0ba86b1849
3 changed files with 30 additions and 6 deletions

View File

@@ -92,6 +92,15 @@ func ValidatePtr(v reflect.Value) error {
return nil
}
func convertToString(val any, fullName string) (string, error) {
v, ok := val.(string)
if !ok {
return "", fmt.Errorf("expect string for field %s, but got type %T", fullName, val)
}
return v, nil
}
func convertTypeFromString(kind reflect.Kind, str string) (any, error) {
switch kind {
case reflect.Bool: