Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab
Commits
e26022a4
Commit
e26022a4
authored
1 year ago
by
Luke Duncalfe
Browse files
Options
Downloads
Patches
Plain Diff
Document GraphQL negated helper
parent
4040009b
No related branches found
No related tags found
1 merge request
!141730
Document GraphQL negated helper
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/development/api_graphql_styleguide.md
+13
-3
13 additions, 3 deletions
doc/development/api_graphql_styleguide.md
with
13 additions
and
3 deletions
doc/development/api_graphql_styleguide.md
+
13
−
3
View file @
e26022a4
...
...
@@ -1453,9 +1453,19 @@ issues(labelName: "bug", not: {labelName: "bug2"}) {
}
```
To avoid duplicated argument definitions, you can place these arguments in a reusable module (or
class, if the arguments are nested). Alternatively, you can consider to add a
[
helper resolver method
](
https://gitlab.com/gitlab-org/gitlab/-/issues/258969
)
.
You can use the
`negated`
helper from
`Gitlab::Graphql::NegatableArguments`
in your type or resolver.
For example:
```
ruby
extend
::
Gitlab
::
Graphql
::
NegatableArguments
negated
do
argument
:labels
,
[
GraphQL
::
STRING_TYPE
],
required:
false
,
as: :label_name
,
description:
'Array of label names. All resolved merge requests will not have these labels.'
end
```
### Metadata
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment