diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-29 06:06:31 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-29 06:06:31 +0000 |
commit | 2ac93cb80c4c0a57fde86de8262b569d1e9b9e51 (patch) | |
tree | 3f74cb04801cb4dcea27c8e1b4d24b783b4f1ec3 /doc/development/fe_guide/graphql.md | |
parent | 23d8718bf3a114f7b832a9c493b1efcdc6decedb (diff) | |
download | gitlab-ce-2ac93cb80c4c0a57fde86de8262b569d1e9b9e51.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/fe_guide/graphql.md')
-rw-r--r-- | doc/development/fe_guide/graphql.md | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/doc/development/fe_guide/graphql.md b/doc/development/fe_guide/graphql.md index 894a613ec2d..b813ea24750 100644 --- a/doc/development/fe_guide/graphql.md +++ b/doc/development/fe_guide/graphql.md @@ -39,6 +39,50 @@ 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. + +For example, a fragment that references another fragment: + +```ruby +fragment BaseEpic on Epic { + id + iid + title + webPath + relativePosition + userPermissions { + adminEpic + createEpic + } +} + +fragment EpicNode on Epic { + ...BaseEpic + state + reference(full: true) + relationPath + createdAt + closedAt + hasChildren + hasIssues + group { + fullPath + } +} +``` + +More about fragments: +[GraphQL Docs](https://graphql.org/learn/queries/#fragments) + ## Usage in Vue To use Vue Apollo, import the [Vue Apollo][vue-apollo] plugin as well |