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
fb4e9369
Commit
fb4e9369
authored
Jun 18, 2020
by
Luke Duncalfe
Committed by
Evan Read
Jun 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update GraphQL Styleguide mutation name convention
Adding more specific guidance around how to choose a name.
parent
4f6c629d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
5 deletions
+43
-5
doc/development/api_graphql_styleguide.md
doc/development/api_graphql_styleguide.md
+43
-5
No files found.
doc/development/api_graphql_styleguide.md
View file @
fb4e9369
...
...
@@ -717,11 +717,49 @@ will be returned as the result of the mutation.
### Naming conventions
Always provide a consistent GraphQL-name to the mutation, this name is
used to generate the input types and the field the mutation is mounted
on. The name should look like
`<Resource being modified><Mutation
class name>`
, for example the
`Mutations::MergeRequests::SetWip`
mutation has GraphQL name
`MergeRequestSetWip`
.
Each mutation must define a
`graphql_name`
, which is the name of the
mutation in the GraphQL schema.
Example:
```
ruby
class
UserUpdateMutation
<
BaseMutation
graphql_name
'UserUpdate'
end
```
Our GraphQL mutation names are historically inconsistent, but new
mutation names should follow the convention
`'{Resource}{Action}'`
or
`'{Resource}{Action}{Attribute}'`
.
Mutations that
**create**
new resources should use the verb
`Create`
.
Example:
-
`CommitCreate`
Mutations that
**update**
data should use the verb
`Update`
or a
domain-specific verb like
`Set`
,
`Add`
, or
`Toggle`
if more
appropriate.
Examples:
-
`EpicTreeReorder`
-
`IssueSetWeight`
-
`IssueUpdate`
-
`TodoMarkDone`
Mutations that
**remove**
data should use the verb
`Delete`
rather than
`Destroy`
. Or use a domain-specific verb like
`Remove`
if more
appropriate.
Examples:
-
`AwardEmojiRemove`
-
`NoteDelete`
If you need advice for mutation naming, canvass the Slack
`#graphql`
channel for feedback.
### Arguments
...
...
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