Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ca7f3f3e
Commit
ca7f3f3e
authored
Nov 27, 2019
by
James Tharpe
Committed by
Evan Read
Nov 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify authorization, remove resolvers docs
Resolvers docs aren't relevant to client dev, redundent w/ syleguide
parent
263e8ac4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
43 deletions
+18
-43
doc/api/graphql/getting_started.md
doc/api/graphql/getting_started.md
+18
-43
No files found.
doc/api/graphql/getting_started.md
View file @
ca7f3f3e
...
@@ -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
'http
s://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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment