Skip to content

Commit

Permalink
allow custom types as input arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
RXminuS authored and neelance committed May 26, 2017
1 parent dd3d39e commit e90d108
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,9 @@ func validateBasicLit(v *common.BasicLit, t common.Type) bool {
return v.Type == scanner.Ident && (v.Text == "true" || v.Text == "false")
case "ID":
return v.Type == scanner.Int || v.Type == scanner.String
default:
//TODO: Type-check against expected type by Unmarshalling
return true
}

case *schema.Enum:
Expand Down
3 changes: 3 additions & 0 deletions time.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ func (t *Time) UnmarshalGraphQL(input interface{}) error {
case int:
t.Time = time.Unix(int64(input), 0)
return nil
case float64:
t.Time = time.Unix(int64(input), 0)
return nil
default:
return fmt.Errorf("wrong type")
}
Expand Down

0 comments on commit e90d108

Please sign in to comment.