Support string pointers for path mapper (#360)

This commit is contained in:
Chris Stephen
2024-03-05 04:59:11 -04:00
committed by GitHub
parent 088cd7874e
commit 4a9fe056ea
2 changed files with 49 additions and 0 deletions
+6
View File
@@ -580,6 +580,12 @@ func pathMapper(r *Registry) MapperFunc {
if target.Kind() == reflect.Slice {
return sliceDecoder(r)(ctx, target)
}
if target.Kind() == reflect.Ptr && target.Elem().Kind() == reflect.String {
if target.IsNil() {
return nil
}
target = target.Elem()
}
if target.Kind() != reflect.String {
return fmt.Errorf("\"path\" type must be applied to a string not %s", target.Type())
}