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

support for structured GraphQL Schema #37

Open
vreality64 opened this issue Nov 16, 2018 · 2 comments
Open

support for structured GraphQL Schema #37

vreality64 opened this issue Nov 16, 2018 · 2 comments

Comments

@vreality64
Copy link

vreality64 commented Nov 16, 2018

Hi, it's a feature request not a bug.

I think GraphQL schema could be more flexible than now.
For now, I have to define all GraphQL schema and resolver to schema.graphql, resolvers.js. I know resolvers are more options but not enough.

My proper structure for GraphQL is like this. each entry has own definitions.

src/
├── definitions
│   ├── groot
│   │   ├── groot.resolvers.js
│   │   └── groot.graphql
│   └── hello
│       ├── hello.resolvers.js
│       └── hello.graphql
└── index.js

3 directories, 5 files

However, this structure is not worked with graphqlpack. code sandbox has following error message.

Error: Couldn't find any resolvers. Please add resolvers to your src/resolvers.js
    at Module../node_modules/graphpack/lib/server.js

How about your thought on above GraphQL schema structure support?
I think merge-graphql-schemas can make things works easily. this repository will show you how to use the merge-graphql-schemas and what the benefits are. 😃

@glennreyes
Copy link
Owner

You can use import definitions in GraphQL SDL to achieve your structure:

schema.graphql

# import Post from "posts.graphql"

type Query {
  posts: [Post]
}

@vreality64
Copy link
Author

Yes. I know. However, that has the disadvantage of writing the all Query in schema.graphql. My point is to write Query in individual entity schema to fulfill separation of concern.

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

No branches or pull requests

2 participants