File consisting only of imports throws error
Closed this issue · 0 comments
mwoelk commented
I've tried to split my whole schema to be able to put the schema-parts and corresponding resolvers together.
I ended up with a file structure like this:
├── generated
├── resolvers
| ├── User
| | ├── queries.ts
| | ├── mutations.ts
| | └── user-schema.graphql
| ├── Post
| | ├── queries.ts
| | ├── mutations.ts
| | └── post-schema.graphql
| └── index.ts
└── complete-schema.graphql
And schemas looking like this:
user-schema.graphql
# import Post from "../../generated/graphcool.graphql"
type User {
id: ID!
email: String!
name: String!
posts: [Post!]!
}
type Query {
me: User
}
...
My main schema ended up being empty (except for the import statements):
complete-schema.graphql
# import Query.*, Mutation.* from './resolvers/Post/post-schema.graphql'
# import Query.*, Mutation.* from './resolvers/User/user-schema.graphql'
Which leads to an Syntax Error: Unexpected <EOF>
.
It only works if I change the schema to:
complete-schema-working.graphql
# import Query.*, Mutation.* from './resolvers/Post/post-schema.graphql'
# import Query.*, Mutation.* from './resolvers/User/user-schema.graphql'
# We need at least one 'real' definition or things go south ;)
type Dummy {
dummy: String!
}
It would be great if we could use files that consist only of import statements without having to add dummy-types.