summaryrefslogtreecommitdiff
path: root/pkg/bindings/internal/util/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/bindings/internal/util/util.go')
-rw-r--r--pkg/bindings/internal/util/util.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/pkg/bindings/internal/util/util.go b/pkg/bindings/internal/util/util.go
index ef93d6e25..bcf6959f2 100644
--- a/pkg/bindings/internal/util/util.go
+++ b/pkg/bindings/internal/util/util.go
@@ -72,14 +72,18 @@ func ToParams(o interface{}) (url.Values, error) {
if reflect.Ptr == f.Kind() {
f = f.Elem()
}
+ paramName := fieldName
+ if pn, ok := sType.Field(i).Tag.Lookup("schema"); ok {
+ paramName = pn
+ }
switch {
case IsSimpleType(f):
- params.Set(fieldName, SimpleTypeToParam(f))
+ params.Set(paramName, SimpleTypeToParam(f))
case f.Kind() == reflect.Slice:
for i := 0; i < f.Len(); i++ {
elem := f.Index(i)
if IsSimpleType(elem) {
- params.Add(fieldName, SimpleTypeToParam(elem))
+ params.Add(paramName, SimpleTypeToParam(elem))
} else {
return nil, errors.New("slices must contain only simple types")
}
@@ -95,7 +99,7 @@ func ToParams(o interface{}) (url.Values, error) {
return nil, err
}
- params.Set(fieldName, s)
+ params.Set(paramName, s)
}
}
return params, nil