Parse configuration → Cannot convert undefined or null to object
fnduister opened this issue · 5 comments
Hi,
When trying to convert a simple graphql schema, i'm getting this error
× Parse configuration
→ Cannot convert undefined or null to object
Steps to reproduce the behavior:
- create .graphql.yml with this content
schema: ./src/**/*.graphql
extensions:
codegen:
./generated-backend.ts:
plugins:
- typescript
-
npx graphql-cli@next init
-
choose backend only, no generation, typescript
-
yarn graphql codegen
-
See error: Parse configuration → Cannot convert undefined or null to object
Expected behavior
should generation typescipt types
Versions (please complete the following information):
- OS: windows10
graphql-cli
: 4.0.1-beta.2
I think this is due to missing required documents section in config.
At least this is what it was for myself
It seems like validation issue in config.
Did this solved the issue. Feel free to reopen if needed.
This worked for me
schema: http://localhost:8081/graphql
extensions:
codegen:
generates:
./schema.graphql:
- schema-ast
src/client/types.ts:
- typescript
I also use relay
"relay": "relay-compiler --src src --schema ./schema.graphql --extensions ts tsx --artifactDirectory src/__generated__ --language typescript",
"syncgql": "run-s schema relay",
"schema": "graphql codegen",
@olso , Thank you. It also worked for me.
@arjun-kava Also if you have custom scalars, you can type them 🙂
schema: http://localhost:8081/graphql
config:
scalars:
DateTime: string
Money: string
generates:
src/types/Generated.ts:
- typescript