Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File consisting only of imports throws error #45

Closed
mwoelk opened this issue Jan 14, 2018 · 0 comments
Closed

File consisting only of imports throws error #45

mwoelk opened this issue Jan 14, 2018 · 0 comments

Comments

@mwoelk
Copy link
Contributor

mwoelk commented Jan 14, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants