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
c68c0e08
Commit
c68c0e08
authored
Sep 29, 2020
by
charlie ablett
Committed by
Mike Jang
Sep 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docs review edits
- Simplify language - Break down long lines - Future -> present tense
parent
db0a9d62
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
2 deletions
+31
-2
doc/development/api_graphql_styleguide.md
doc/development/api_graphql_styleguide.md
+31
-2
No files found.
doc/development/api_graphql_styleguide.md
View file @
c68c0e08
...
...
@@ -827,10 +827,39 @@ mutation.
### Building Mutations
Mutations
live in
`app/graphql/mutations`
ideally grouped per
Mutations
are stored in
`app/graphql/mutations`
,
ideally grouped per
resources they are mutating, similar to our services. They should
inherit
`Mutations::BaseMutation`
. The fields defined on the mutation
will be returned as the result of the mutation.
are returned as the result of the mutation.
#### Update mutation granularity
GitLab's service-oriented architecture means that most mutations call a Create, Delete, or Update
service, for example
`UpdateMergeRequestService`
.
For Update mutations, a you might want to only update one aspect of an object, and thus only need a
_fine-grained_
mutation, for example
`MergeRequest::SetWip`
.
It's acceptable to have both fine-grained mutations and coarse-grained mutations, but be aware
that too many fine-grained mutations can lead to organizational challenges in maintainability, code
comprehensibility, and testing.
Each mutation requires a new class, which can lead to technical debt.
It also means the schema becomes very big, and we want users to easily navigate our schema.
As each new mutation also needs tests (including slower request integration tests), adding mutations
slows down the test suite.
To minimize changes:
-
Use existing mutations, such as
`MergeRequest::Update`
, when available.
-
Expose existing services as a coarse-grained mutation.
When a fine-grained mutation might be more appropriate:
-
Modifying a property that requires specific permissions or other specialized logic.
-
Exposing a state-machine-like transition (locking issues, merging MRs, closing epics, etc).
-
Accepting nested properties (where we accept properties for a child object).
-
The semantics of the mutation can be expressed clearly and concisely.
See
[
issue #233063
](
https://gitlab.com/gitlab-org/gitlab/-/issues/233063
)
for further context.
### Naming conventions
...
...
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