Skip to content

Commit

Permalink
Use consts
Browse files Browse the repository at this point in the history
  • Loading branch information
islamaliev committed Mar 30, 2023
1 parent e7fd4d2 commit cedb3f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion request/graphql/parser/introspection.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func IsIntrospectionQuery(schema gql.Schema, doc *ast.Document) bool {
continue
}

if astOpDef.Operation == "query" {
if astOpDef.Operation == ast.OperationTypeQuery {
for _, selection := range astOpDef.SelectionSet.Selections {
switch node := selection.(type) {
case *ast.Field:
Expand Down
6 changes: 3 additions & 3 deletions request/graphql/parser/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func ParseRequest(schema gql.Schema, doc *ast.Document) (*request.Request, []err
}

switch astOpDef.Operation {
case "query":
case ast.OperationTypeQuery:
parsedQueryOpDef, errs := parseQueryOperationDefinition(schema, astOpDef)
if errs != nil {
return nil, errs
Expand All @@ -55,7 +55,7 @@ func ParseRequest(schema gql.Schema, doc *ast.Document) (*request.Request, []err

r.Queries = append(r.Queries, parsedQueryOpDef)

case "mutation":
case ast.OperationTypeMutation:
parsedMutationOpDef, err := parseMutationOperationDefinition(schema, astOpDef)
if err != nil {
return nil, []error{err}
Expand All @@ -69,7 +69,7 @@ func ParseRequest(schema gql.Schema, doc *ast.Document) (*request.Request, []err

r.Mutations = append(r.Mutations, parsedMutationOpDef)

case "subscription":
case ast.OperationTypeSubscription:
parsedSubscriptionOpDef, err := parseSubscriptionOperationDefinition(schema, astOpDef)
if err != nil {
return nil, []error{err}
Expand Down

0 comments on commit cedb3f4

Please sign in to comment.