Skip to content

Commit

Permalink
lowercase for arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminjkraft committed Mar 28, 2020
1 parent 9e01efd commit af5d1bd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions example/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions example/queries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ query getViewer {
}

# getUser gets the given user's name from their username.
query getUser($login: String!) {
user(login: $login) {
query getUser($Login: String!) {
user(login: $Login) {
theirName: name
}
}
8 changes: 5 additions & 3 deletions generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ type argument struct {
}

func fromASTArg(arg *ast.VariableDefinition, schema *ast.Schema) argument {
graphQLName := arg.Variable
firstRest := strings.SplitN(graphQLName, "", 2)
goName := strings.ToLower(firstRest[0]) + firstRest[1]
return argument{
GraphQLName: arg.Variable,
GoName: arg.Variable, // TODO: normalize this to go-style
GraphQLName: graphQLName,
GoName: goName,
GoType: typeForInputType(arg.Type, schema),
// TODO: figure out what to do about defaults
}
}

Expand Down

0 comments on commit af5d1bd

Please sign in to comment.