schema/field: reject pointers for basic types (#505)

This commit is contained in:
Ariel Mashraki
2020-05-26 23:16:54 +03:00
committed by GitHub
parent 50edd3d370
commit ce89688d00
13 changed files with 340 additions and 9 deletions

View File

@@ -728,7 +728,7 @@ func (d *Descriptor) goType(typ interface{}, expectKind reflect.Kind) {
info.Nillable = true
}
switch {
case tv.Kind() == expectKind:
case t.Kind() == expectKind:
case t.Implements(valueScannerType):
n := t.NumMethod()
for i := 0; i < n; i++ {

View File

@@ -146,6 +146,8 @@ func TestString(t *testing.T) {
assert.Error(t, fd.Err())
fd = field.String("name").GoType(struct{}{}).Descriptor()
assert.Error(t, fd.Err())
fd = field.String("name").GoType(new(http.Dir)).Descriptor()
assert.Error(t, fd.Err())
}
func TestTime(t *testing.T) {