Improve examples and explanations around "includes"
- Dominant language
- TypeScript
- Stars
- 16.9k
- Forks
- 1.9k
- Avg merge
- 22h 45m
- Merged PRs (30d)
- 70
Description
In a recent project, this was my `.graphqlconfig.yml`:
```yml
projects:
app:
schemaPath: schema.graphql
includes: ["**/*.graphql"]
extensions:
endpoints:
default: 'http://localhost:4000'
db:
schemaPath: generated-schema.graphql
includes: ["**/*.graphql"]
extensions:
prisma: prisma.yml
```
In a `seed.graphql` file, I wrote this:
```graphql
mutation {
createPost(data: { content: "title", status: DRAFT, title: "Nilan" }) {
id
}
}
```
which is a valid mutation according to `generated-schema.graphql`, so I was confused to see an error message that said this mutation is not known. The reason for this is that it did not exist in `schema.graphql`, which I didn't know. The solution for this is to assign specific `.graphql` files to either `app` or `db`. This worked for me:
```yml
projects:
app:
schemaPath: schema.graphql
includes: ["**/*.graphql"]
extensions:
endpoints:
default: 'http://localhost:4000'
db:
schemaPath: generated-schema.graphql
includes: [
"prisma.graphql",
"datamodel.graphql",
"schema.graphql"
]
extensions:
prisma: prisma.yml
```
---
For all the examples that use `includes: ["**/*.graphql"]`, I assumed that this would work, but it didn't.
How can we make this clearer?
Contributor guide
Research direction
Review the examples that use `includes: ["**/*.graphql"]` and compare them with the reported `.graphqlconfig.yml` behavior. Clarify the relationship between project `includes`, schema files, and assigning GraphQL files to `app` or `db`; done means the examples no longer imply that the broad glob works for this setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- yaml
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100