Commit 529d4195 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'docs-fix-folders-and-fragments' into 'master'

Removed folders recommendation

See merge request gitlab-org/gitlab!21943
parents 5edf3ebf 5b79eee3
...@@ -39,43 +39,31 @@ To distinguish queries from mutations and fragments, the following naming conven ...@@ -39,43 +39,31 @@ To distinguish queries from mutations and fragments, the following naming conven
- `addUser.mutation.graphql` for mutations; - `addUser.mutation.graphql` for mutations;
- `basicUser.fragment.graphql` for fragments. - `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
Fragments are a way to make your complex GraphQL queries more readable and re-usable. Fragments are a way to make your complex GraphQL queries more readable and re-usable. Here is an example of GraphQL fragment:
They can be stored in a separate file and imported.
For example, a fragment that references another fragment: ```javascript
fragment DesignListItem on Design {
```ruby
fragment BaseEpic on Epic {
id id
iid image
title event
webPath filename
relativePosition notesCount
userPermissions {
adminEpic
createEpic
}
} }
```
fragment EpicNode on Epic { Fragments can be stored in separate files, imported and used in queries, mutations or other fragments.
...BaseEpic
state ```javascript
reference(full: true) #import "./designList.fragment.graphql"
relationPath #import "./diffRefs.fragment.graphql"
createdAt
closedAt fragment DesignItem on Design {
hasChildren ...DesignListItem
hasIssues fullPath
group { diffRefs {
fullPath ...DesignDiffRefs
} }
} }
``` ```
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment