dotansimha / dotansimha/graphql-code-generator
Cannot add meta types or fields to schema
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
**Describe the bug**
As described in https://github.com/dotansimha/graphql-code-generator/issues/2911#issuecomment-561019738 and https://github.com/dotansimha/graphql-code-generator/issues/3459#issuecomment-583487477, we're supposed to add meta types and fields to the schema ourselves for use with codegen. However that doesn't work as the schema fails validation:
> Error: Name "\_\_schema" must not begin with "\_\_", which is reserved by GraphQL introspection.
**To Reproduce**
Steps to reproduce the behavior:
1. My GraphQL schema:
```graphql
type Query {
__schema: __Schema!
}
```
2. My GraphQL operations:
```graphql
query Query {
__schema {
__typename
}
}
```
3. My `codegen.yml` config file:
```yml
schema:
- src/schema.graphql
documents:
- src/document.graphql
generates:
src/types.ts:
plugins:
- typescript
```
**Expected behavior**
Types successfully generated for the meta query.
**Environment:**
- OS: macOS Catalina 10.15.1
- ```json
"@graphql-codegen/cli": "^1.12.2",
"@graphql-codegen/typescript": "^1.12.2",
```
- NodeJS: 12.14.1
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.