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
bd72aca4
Commit
bd72aca4
authored
Feb 08, 2021
by
Alex Kalderimis
Committed by
Amy Qualls
Feb 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add documentation describing gitlab:graphql:analyze
parent
59ab13ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
doc/development/api_graphql_styleguide.md
doc/development/api_graphql_styleguide.md
+4
-0
doc/development/rake_tasks.md
doc/development/rake_tasks.md
+42
-0
No files found.
doc/development/api_graphql_styleguide.md
View file @
bd72aca4
...
...
@@ -67,6 +67,10 @@ Complexity is explained [on our client-facing API page](../api/graphql/index.md#
Fields default to adding
`1`
to a query's complexity score, but developers can
[
specify a custom complexity
](
#field-complexity
)
when defining a field.
To estimate the complexity of a query, you can run the
[
`gitlab:graphql:analyze`
](
rake_tasks.md#analyze-graphql-queries
)
Rake task.
### Request timeout
Requests time out at 30 seconds.
...
...
doc/development/rake_tasks.md
View file @
bd72aca4
...
...
@@ -261,6 +261,48 @@ bundle exec rake db:obsolete_ignored_columns
Feel free to remove their definitions from their
`ignored_columns`
definitions.
## Validate GraphQL queries
To check the validity of one or more of our front-end GraphQL queries,
run:
```
shell
# Validate all queries
bundle
exec
rake gitlab::graphql:validate
# Validate one query
bundle
exec
rake gitlab::graphql:validate[path/to/query.graphql]
# Validate a directory
bundle
exec
rake gitlab::graphql:validate[path/to/queries]
```
This prints out a report with an entry for each query, explaining why
each query is invalid if it fails to pass validation.
We strip out
`@client`
fields during validation so it is important to mark
client fields with the
`@client`
directive to avoid false positives.
## Analyze GraphQL queries
Analogous to
`ANALYZE`
in SQL, we can run
`gitlab:graphql:analyze`
to
estimate the of the cost of running a query.
Usage:
```
shell
# Analyze all queries
bundle
exec
rake gitlab::graphql:analyze
# Analyze one query
bundle
exec
rake gitlab::graphql:analyze[path/to/query.graphql]
# Analyze a directory
bundle
exec
rake gitlab::graphql:analyze[path/to/queries]
```
This prints out a report for each query, including the complexity
of the query if it is valid.
The complexity depends on the arguments in some cases, so the reported
complexity is a best-effort assessment of the upper bound.
## Update GraphQL documentation and schema definitions
To generate GraphQL documentation based on the GitLab schema, run:
...
...
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