Describe the bug
Providing .graphql file with correct schema gives Loading schema.graphql gives Query root type must be provided. error
To Reproduce
Steps to reproduce the behavior:
schema {
query: QueryRoot
}
type QueryRoot {
"""Fetches an object given its ID"""
node(
"""The ID of an object"""
id: ID!
): Node
}
gql-gen --watch --schema './src/app/graphql/schema.graphql' --template graphql-codegen-apollo-angular-template --out './src/app/graphql/queries.ts' './src/**/*.graphql'Expected behavior
Expected schema to be loaded from .graphql file.
Environment:
I tried to reproduce it as you can see in #816 but it seems everything's fine.
Actually it doesn't work but I fixed that in f1e5a0c05d18da32564a55e14db20de89220a0a2
Fixed in 0.14.0 🎉
@dotansimha Using the example schema above still gives an error in 0.14.0:
Unable to find the schema root matching query
Yeah @dotansimha, I also have the same problem in 0.14.1
$ gql-gen
√ Parse configuration
√ Load schema
√ Load documents
> Generate outputs
> Generate src/app/shared/models/graphql/types.ts
× Generate
→ Unable to find the schema root matching: query
We found 1 errors
Failed to generate src/app/shared/models/graphql/types.ts
Error: Unable to find the schema root matching: query
Something went wrong
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Sorry for nagging you, but I am very eager to test out the graphql-codegen-apollo-angular plugin to start using it in our angular application. :D Is this still waiting-for-release ?
@kamilkisiela is working on fixing it right now :)
The issue is with the package that we are using for merging GraphQL schemas (@graphql-modules/epoxy).
@furier
@dotansimha Also seems this issue is not necessarily related to using graphql(s) files. I am also experiencing this when using the previously working .json file.
It's related to the way schemas are being merged, a schema definition object is removed and it only treats Query, Mutation and Subscription as root types.
Fixed in #899
@wesselvdv @furier Can you please try with 0.15.0-alpha.7c1a7d2a from npm? it includes the latest fixes that @kamilkisiela did .
Have had meetings all day, but ill get right on it now. :)
@dotansimha @kamilkisiela works like a charm when i upgraded all the packages to that version :)
When will a new version be cut?
Fixed in 0.14.2 🎉
@wesselvdv @furier