lowercase for arguments

This commit is contained in:
Ben Kraft
2020-03-27 18:01:56 -07:00
parent 9e01efdd88
commit af5d1bd542
3 changed files with 10 additions and 8 deletions
+3 -3
View File
@@ -35,13 +35,13 @@ type getUserResponse = struct {
// getUser gets the given user's name from their username.
func getUser(ctx context.Context, client *graphql.Client, login string) (*getUserResponse, error) {
variables := map[string]interface{}{
"login": login,
"Login": login,
}
var retval getUserResponse
err := client.MakeRequest(ctx, `
query getUser ($login: String!) {
user(login: $login) {
query getUser ($Login: String!) {
user(login: $Login) {
theirName: name
}
}
+2 -2
View File
@@ -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
}
}
+5 -3
View File
@@ -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
}
}