diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 21:07:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 21:07:48 +0300 |
commit | e72386771751fb22245bc6604fef236a2ee130cb (patch) | |
tree | 7cf54bca933159cb177d3caa2f139f87d6d30391 /doc/development/fe_guide | |
parent | c2b98d3dbd47ab92c79c702276fe9130d9a28036 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/fe_guide')
-rw-r--r-- | doc/development/fe_guide/graphql.md | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/doc/development/fe_guide/graphql.md b/doc/development/fe_guide/graphql.md index 40df5f3265a..40b9fdef76e 100644 --- a/doc/development/fe_guide/graphql.md +++ b/doc/development/fe_guide/graphql.md @@ -39,43 +39,31 @@ To distinguish queries from mutations and fragments, the following naming conven - `addUser.mutation.graphql` for mutations; - `basicUser.fragment.graphql` for fragments. -GraphQL: - -- Queries are stored in `(ee/)app/assets/javascripts/` under the feature. For example, `respository/queries`. Frontend components can use these stored queries. -- Mutations are stored in - `(ee/)app/assets/javascripts/<subfolders>/<name of mutation>.mutation.graphql`. - ### Fragments -Fragments are a way to make your complex GraphQL queries more readable and re-usable. -They can be stored in a separate file and imported. +Fragments are a way to make your complex GraphQL queries more readable and re-usable. Here is an example of GraphQL fragment: -For example, a fragment that references another fragment: - -```ruby -fragment BaseEpic on Epic { +```javascript +fragment DesignListItem on Design { id - iid - title - webPath - relativePosition - userPermissions { - adminEpic - createEpic - } + image + event + filename + notesCount } +``` -fragment EpicNode on Epic { - ...BaseEpic - state - reference(full: true) - relationPath - createdAt - closedAt - hasChildren - hasIssues - group { - fullPath +Fragments can be stored in separate files, imported and used in queries, mutations or other fragments. + +```javascript +#import "./designList.fragment.graphql" +#import "./diffRefs.fragment.graphql" + +fragment DesignItem on Design { + ...DesignListItem + fullPath + diffRefs { + ...DesignDiffRefs } } ``` |