Skip to content

Commit

Permalink
validator: better error message when InputObject is not a map
Browse files Browse the repository at this point in the history
  • Loading branch information
vbmithr committed Jun 14, 2024
1 parent 8bb54d3 commit 9fe17e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion validator/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (v *varValidator) validateVarType(typ *ast.Type, val reflect.Value) (reflec
return val, gqlerror.ErrorPathf(v.path, "cannot use %s as %s", kind.String(), typ.NamedType)
case ast.InputObject:
if val.Kind() != reflect.Map {
return val, gqlerror.ErrorPathf(v.path, "must be a %s", def.Name)
return val, gqlerror.ErrorPathf(v.path, "must be a %s, not a %s", def.Name, val.Kind())
}

// check for unknown fields
Expand Down

0 comments on commit 9fe17e9

Please sign in to comment.