DOC GraphQL src must always be an array. (#10213)

* DOC GraphQL src must always be an array.

* DOC Tweak the graphql module syntax

* DOC Fix minor linting issue in example
This commit is contained in:
Maxime Rainville 2022-02-08 22:08:37 +13:00 committed by GitHub
parent 4044573ae7
commit 6e1bc807e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

View File

@ -78,14 +78,18 @@ relative to the project root.
SilverStripe\GraphQL\Schema\Schema:
schemas:
default:
src: app/_graphql
src:
- app/_graphql
```
Your `src` must be an array. This allows further source files to be merged into your schema.
This feature can be use to extend the schema of third party modules.
[info]
It is recommended that you define your sources as an array so that further source files are merged.
Otherwise, another config file could completely override part of your schema definition.
Your directory can also be a module reference, e.g. `somevendor/somemodule: _graphql`
[/info]
**app/_config/graphql.yml**
```yml
SilverStripe\GraphQL\Schema\Schema:
@ -94,11 +98,11 @@ SilverStripe\GraphQL\Schema\Schema:
src:
- app/_graphql
- module/_graphql
# The next line would map to `vendor/somevendor/somemodule/_graphql`
- 'somevendor/somemodule: _graphql'
```
[info]
Your directory can also be a module reference, e.g. `somevendor/somemodule: _graphql`
[/info]
Now, in our `app/_graphql` file, we can create YAML file definitions.

View File

@ -102,7 +102,7 @@ query {
nodes {
name
}
}
}
}
```