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-04-01 15:08:56 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-01 15:08:56 +0300
commit50d66f5ece57dcfbe074d97703691a8d3c38f4ac (patch)
treec96aa5ffd1cb73c18e53356680cb9792d24c257b /doc/development/api_graphql_styleguide.md
parentcfec4ed6fe77e4150b1ea83b87f407aa0cca944c (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.md26
1 files changed, 25 insertions, 1 deletions
diff --git a/doc/development/api_graphql_styleguide.md b/doc/development/api_graphql_styleguide.md
index 8bac02c99af..7e4e7007ca2 100644
--- a/doc/development/api_graphql_styleguide.md
+++ b/doc/development/api_graphql_styleguide.md
@@ -392,6 +392,28 @@ field :blob, type: Types::Snippets::BlobType,
This will increment the [`complexity` score](#field-complexity) of the field by `1`.
+If a resolver calls Gitaly, it can be annotated with
+`BaseResolver.calls_gitaly!`. This passes `calls_gitaly: true` to any
+field that uses this resolver.
+
+For example:
+
+```ruby
+class BranchResolver < BaseResolver
+ type ::Types::BranchType, null: true
+ calls_gitaly!
+
+ argument name: ::GraphQL::STRING_TYPE, required: true
+
+ def resolve(name:)
+ object.branch(name)
+ end
+end
+```
+
+Then when we use it, any field that uses `BranchResolver` has the correct
+value for `calls_gitaly:`.
+
### Exposing permissions for a type
To expose permissions the current user has on a resource, you can call
@@ -1137,9 +1159,10 @@ When using resolvers, they can and should serve as the SSoT for field metadata.
All field options (apart from the field name) can be declared on the resolver.
These include:
-- `type` (this is particularly important, and is planned to be mandatory)
+- `type` (required - all resolvers must include a type annotation)
- `extras`
- `description`
+- Gitaly annotations (with `calls_gitaly!`)
Example:
@@ -1149,6 +1172,7 @@ module Resolvers
type Types::MyType, null: true
extras [:lookahead]
description 'Retrieve a single MyType'
+ calls_gitaly!
end
end
```