MCPcopy Create free account
hub / github.com/cli/cli / operationName

Function operationName

script/ghmock/request.go:92–102  ·  view source on GitHub ↗

operationName resolves the requested operation, or the document's sole operation when no name is supplied. Invalid selections retain the supplied name without claiming a kind or selecting a different operation.

(query, selected string)

Source from the content-addressed store, hash-verified

90// operation when no name is supplied. Invalid selections retain the supplied
91// name without claiming a kind or selecting a different operation.
92func operationName(query, selected string) (kind, name string) {
93 doc, err := parser.ParseQuery(&ast.Source{Input: query})
94 if err != nil {
95 return "", selected
96 }
97 op := doc.Operations.ForName(selected)
98 if op == nil {
99 return "", selected
100 }
101 return string(op.Operation), op.Name
102}

Callers 1

parseGraphQLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected