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
11dc1d62
Commit
11dc1d62
authored
Mar 24, 2020
by
charlieablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add docs for shortcut fields
Also, update descriptions to actually reflect what is being suggested
parent
42387d6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
doc/development/api_graphql_styleguide.md
doc/development/api_graphql_styleguide.md
+10
-1
No files found.
doc/development/api_graphql_styleguide.md
View file @
11dc1d62
...
...
@@ -150,7 +150,7 @@ query($project_path: ID!) {
```
This would return the first 2 pipelines of a project and related
pagination info
.
, ordered by descending ID. The returned data would
pagination info
rmation
, ordered by descending ID. The returned data would
look like this:
```
json
...
...
@@ -211,6 +211,15 @@ To ensure that we get consistent ordering, we will append an ordering on the pri
key, in descending order. This is usually
`id`
, so basically we will add
`order(id: :desc)`
to the end of the relation. A primary key _must_ be available on the underlying table.
#### Shortcut fields
Sometimes it can seem easy to implement a "shortcut field", having the resolver return the first of a collection if no parameters are passed.
These "shortcut fields" are discouraged because they create maintenance overhead.
They need to be kept in sync with their canonical field, and deprecated or modified if their canonical field changes.
Use the functionality the framework provides unless there is a compelling reason to do otherwise.
For example, instead of
`latest_pipeline`
, use
`pipelines(last: 1)`
.
### Exposing permissions for a type
To expose permissions the current user has on a resource, you can call
...
...
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