operationname
print operation name in your GraphQL query files.
# Query
query GetUser {
user {
name
}
}
mutation UpdateUser($name: String!) {
updateUser(name: $name) {
id
name
}
}
$ go install github.com/gqlgo/operationname/cmd/operationname@latest
The operationname
command has two flags, schema
and query
which will be parsed and analyzed by operationname's Analyzer.
$ operationname -schema="server/graphql/schema/**/*.graphql" -query="client/**/*.graphql"
GetUser
UpdateUser
The default value of schema
is "schema/*/**.graphql" and query
is query/*/**.graphql
.
schema
flag accepts URL for a endpoint of GraphQL server.
operationname
will get schemas by an introspection query via the endpoint.
$ operationname -schema="https://example.com" -query="client/**/*.graphql"