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
37748122
Commit
37748122
authored
Aug 12, 2020
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Describe the usage of global ID types in the style-guide
parent
20088565
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
doc/development/api_graphql_styleguide.md
doc/development/api_graphql_styleguide.md
+14
-0
No files found.
doc/development/api_graphql_styleguide.md
View file @
37748122
...
...
@@ -49,6 +49,20 @@ See also:
-
[
Exposing Global IDs
](
#exposing-global-ids
)
.
-
[
Mutation arguments
](
#object-identifier-arguments
)
.
We have a custom scalar type (
`Types::GlobalIDType`
) which should be used as the
type of input and output arguments when the value is a
`GlobalID`
. The benefits
of using this type instead of
`ID`
are:
-
it validates that the value is a
`GlobalID`
-
it parses it into a
`GlobalID`
before passing it to user code
-
it can be parameterized on the type of the object (e.g.
`GlobalIDType[Project]`
) which offers even better validation and security.
Consider using this type for all new arguments and result types. Remember that
it is perfectly possible to parameterize this type with a concern or a
supertype, if you want to accept a wider range of objects (e.g.
`GlobalIDType[Issuable]`
vs
`GlobalIDType[Issue]`
).
## Types
We use a code-first schema, and we declare what type everything is in Ruby.
...
...
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