dotansimha / dotansimha/graphql-code-generator

Could generate from local `.schema` or local `introspection.json` file.

Open
#8,329 2 comments 0 reactions 0 assignees View on GitHub
core
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

### Describe the bug

If I split the generations into two steps:
1. Download shema.
2. Generate types from local `.schema` file.

Then the generation fails:
```

Failed to load schema from schema.graphql,introspection.json:
Unable to find any GraphQL type definitions for the following pointers:
- schema.graphql
,
- introspection.json
Error:
Unable to find any GraphQL type definitions for the following pointers:
- schema.graphql
,
- introspection.json
at prepareResult (/workspaces/!gql/node_modules/@graphql-tools/load/cjs/load-typedefs.js:75:15)
at loadTypedefs (/workspaces/!gql/node_modules/@graphql-tools/load/cjs/load-typedefs.js:39:12)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
```
However it works when https schema is specified.

### Your Example Website or App

https://github.com/vsDizzy/gql-codegen-bug

### Steps to Reproduce the Bug or Issue

1. npm i
2. npm run get-schema
3. npm start

### Expected behavior

There should be no error.

### Screenshots or Videos

![image](https://user-images.githubusercontent.com/5798340/188554084-f6a84033-04e8-49a6-ba85-49a5bc980dd6.png)

### Platform

- OS: docker
- NodeJS: 16
- "@graphql-codegen/cli": "^2.12.0",
"@graphql-codegen/introspection": "^2.2.1",
"@graphql-codegen/schema-ast": "^2.5.1",
"@graphql-codegen/typescript": "^2.7.3"

### Codegen Config File
```yaml
schema:
- schema.graphql
- introspection.json
generates:
types.ts:
plugins:
- typescript
```

### Additional context

This is also not working for shema downloaded with `apollo client:download-schema`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.