Commit ca7f3f3e authored by James Tharpe's avatar James Tharpe Committed by Evan Read

Clarify authorization, remove resolvers docs

Resolvers docs aren't relevant to client dev, redundent w/ syleguide
parent 263e8ac4
...@@ -22,8 +22,8 @@ to use as a bearer token. ...@@ -22,8 +22,8 @@ to use as a bearer token.
Example: Example:
```sh ```sh
GRAPHQL_TOKEN = <your-token> GRAPHQL_TOKEN=<your-token>
curl 'http://gitlab.com/api/graphql' --header "Authorization: Bearer $GRAPHQL_TOKEN" --header "Content-Type: application/json" --request POST --data "{\"query\": \"query {currentUser {name}}\"} curl 'https://gitlab.com/api/graphql' --header "Authorization: Bearer $GRAPHQL_TOKEN" --header "Content-Type: application/json" --request POST --data "{\"query\": \"query {currentUser {name}}\"}"
``` ```
### GraphiQL ### GraphiQL
...@@ -86,18 +86,17 @@ Example: Get a specific project and the title of Issue #2. ...@@ -86,18 +86,17 @@ Example: Get a specific project and the title of Issue #2.
```graphql ```graphql
query { query {
project(fullPath: "gitlab-org/graphql-sandbox") { project(fullPath: "gitlab-org/graphql-sandbox") {
name name
issue(iid: "2") { issue(iid: "2") {
title title
} }
} }
} }
``` ```
### The root node ### Graph traversal
Any field defined in [`QueryType`](https://gitlab.com/gitlab-org/gitlab/tree/master/app/graphql/types/query_type.rb) will be exposed as a root node.
When retrieving child nodes use: When retrieving child nodes use:
- the `edges { node { } }` syntax. - the `edges { node { } }` syntax.
...@@ -121,32 +120,14 @@ query { ...@@ -121,32 +120,14 @@ query {
} }
``` ```
More on schema definitions:
[graphql-ruby docs](https://graphql-ruby.org/schema/definition)
More about queries: More about queries:
[GraphQL docs](https://graphql.org/learn/queries/) and [GraphQL docs](https://graphql.org/learn/queries/)
[graphql-ruby docs](https://graphql-ruby.org/queries/executing_queries)
### Authorization ### Authorization
Authorization uses the same engine as the Rails app. So if you've signed in to GitLab Authorization uses the same engine as the GitLab application (and GitLab.com). So if you've signed in to GitLab
and use GraphiQL, all queries will be performed as you, the signed in user. and use GraphiQL, all queries will be performed as you, the signed in user. For more information, see the
[GitLab API documentation](../README.md#authentication).
See the [authorization section](../../development/api_graphql_styleguide.html#authorization) of the StyleGuide
for implementation details.
### Resolvers
A resolver is how we define how the records requested by the client are retrieved, collected,
and assembled into the response.
The [GraphQL API StyleGuide](../../development/api_graphql_styleguide.md#resolvers) has more details
about the implementation of resolvers.
More about resolvers:
[GraphQL Docs](https://graphql.org/learn/execution/) and
[graphql-ruby docs](https://graphql-ruby.org/fields/resolvers.html)
### Mutations ### Mutations
...@@ -197,7 +178,7 @@ mutation { ...@@ -197,7 +178,7 @@ mutation {
body body
discussion { discussion {
id id
} }
} }
errors errors
} }
...@@ -253,12 +234,8 @@ You should get something like the following output: ...@@ -253,12 +234,8 @@ You should get something like the following output:
We've asked for the note details, but it doesn't exist anymore, so we get `null`. We've asked for the note details, but it doesn't exist anymore, so we get `null`.
The [GraphQL API StyleGuide](../../development/api_graphql_styleguide.md#mutations) has more details
about implementation of mutations.
More about mutations: More about mutations:
[GraphQL Docs](https://graphql.org/learn/queries/#mutations) and [GraphQL Docs](https://graphql.org/learn/queries/#mutations).
[graphql-ruby docs](https://graphql-ruby.org/mutations/mutation_classes.html)
### Introspective queries ### Introspective queries
...@@ -301,8 +278,7 @@ query IssueTypes { ...@@ -301,8 +278,7 @@ query IssueTypes {
``` ```
More about introspection: More about introspection:
[GraphQL docs](https://graphql.org/learn/introspection/) and [GraphQL docs](https://graphql.org/learn/introspection/)
[graphql-ruby docs](https://graphql-ruby.org/schema/introspection.html)
## Sorting ## Sorting
...@@ -382,5 +358,4 @@ query { ...@@ -382,5 +358,4 @@ query {
``` ```
More on pagination and cursors: More on pagination and cursors:
[GraphQL docs](https://graphql.org/learn/pagination/) and [GraphQL docs](https://graphql.org/learn/pagination/)
[graphql-ruby docs](https://graphql-ruby.org/relay/connections.html#cursors)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment