Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-07-28 18:09:57 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-28 18:09:57 +0300
commit1d9f78b3a4ecd36806890e80e513242d0fdf7b6e (patch)
tree80ea387bd0d33a19d2213be6aa30c39d67ffb9e5 /doc/development/api_graphql_styleguide.md
parentb1e352740bd52771b419829abef0a0ad73141ac1 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/api_graphql_styleguide.md')
-rw-r--r--doc/development/api_graphql_styleguide.md27
1 files changed, 27 insertions, 0 deletions
diff --git a/doc/development/api_graphql_styleguide.md b/doc/development/api_graphql_styleguide.md
index a38a88cb7d7..6b82ebc6e5a 100644
--- a/doc/development/api_graphql_styleguide.md
+++ b/doc/development/api_graphql_styleguide.md
@@ -1366,6 +1366,31 @@ argument :my_arg, GraphQL::Types::String,
description: "A description of the argument."
```
+#### Nullability
+
+Arguments can be marked as `required: true` which means the value must be present and not `null`.
+If a required argument's value can be `null`, use the `required: :nullable` declaration.
+
+Example:
+
+```ruby
+argument :due_date,
+ Types::TimeType,
+ required: :nullable,
+ description: 'The desired due date for the issue. Due date is removed if null.'
+```
+
+In the above example, the `due_date` argument must be given, but unlike the GraphQL spec, the value can be `null`.
+This allows 'unsetting' the due date in a single mutation rather than creating a new mutation for removing the due date.
+
+```ruby
+{ due_date: null } # => OK
+{ due_date: "2025-01-10" } # => OK
+{ } # => invalid (not given)
+```
+
+#### Keywords
+
Each GraphQL `argument` defined is passed to the `#resolve` method
of a mutation as keyword arguments.
@@ -1377,6 +1402,8 @@ def resolve(my_arg:)
end
```
+#### Input Types
+
`graphql-ruby` wraps up arguments into an
[input type](https://graphql.org/learn/schema/#input-types).