nicolasdao / schemaglue

Naturally breaks down your monolithic graphql schema into bits and pieces and then glue them back together.
BSD 3-Clause "New" or "Revised" License
116 stars 13 forks source link

No schemas found #23

Closed timscott closed 3 years ago

timscott commented 3 years ago

I'm getting the following error:

Error: Missing GraphQL Schema: No schemas found under the path '/Users/me/code/my-repo/app/graphql'

My code is structured like:

- app/
   |__ graphql/
          |__ query/
                  |__ schema.graphql
                  |__ resolver.js
- bin/
   |__ server.js
// server.js
const {schema: typeDefs, resolver: resolvers} = glue('app/graphql');
# schema.graphql
type Query {
  hello: String!
}
// resolver.js
const hello = () => {
  return 'world';
};

export const resolver = {
  Query: {
    hello
  }
};

As a workaround, when I add /app/graphql/schema.graphql it works. Event without a resolver. It's like it needs something at the root level.

nicolasdao commented 3 years ago

Hi @timscott,

I failed to reproduce your issue. Would you mind to add this example into a git repo that I can clone so I can fix this issue?

timscott commented 3 years ago

Here you go: https://github.com/timscott/schemaglue-issue

Run it an see it works. Then remove https://github.com/timscott/schemaglue-issue/blob/master/app/graphql/schema.graphql and run again. You should get this error:

Error: Missing GraphQL Schema: No schemas found under the path '/Users/tscott/code/glg/schemaglue-issue/app/graphql'

Thanks for looking into it.

nicolasdao commented 3 years ago

Thanks a lot for providing that repo @timscott. Thanks to you, I managed to close this issue. This fix is part of the latest release (i.e., 4.0.6).

Thanks a lot for your patience.

Cheers,

Nic