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

Can't merge schemas using mergeSchemas #38

Open
panjizhi opened this issue Oct 30, 2018 · 3 comments
Open

Can't merge schemas using mergeSchemas #38

panjizhi opened this issue Oct 30, 2018 · 3 comments
Assignees
Labels

Comments

@panjizhi
Copy link

panjizhi commented Oct 30, 2018

when merge multiple schemas using mergeSchemas, it throw error

Error: Can't find type Root.

const { mergeSchemas } = require('graphql-tools')
const { getSchema } = require('graphql-sequelize-crud')

const dbschema1 = getSchema(sequelize1)
const dbschema2 = getSchema(sequelize2)

module.exports = mergeSchemas({
  schemas: [dbschema1, dbschema2]
})
@Glavin001
Copy link
Owner

Could you provide a small repository reproducing this?

@Yehonal
Copy link

Yehonal commented Dec 13, 2018

i've same issue, graphql-tools from apollo server needs that schema must be defined with typeDefs for Schema Stiching:

https://www.apollographql.com/docs/graphql-tools/schema-stitching.html

@Yehonal
Copy link

Yehonal commented Dec 13, 2018

when merge multiple schemas using mergeSchemas, it throw error

Error: Can't find type Root.

const { mergeSchemas } = require('graphql-tools')
const { getSchema } = require('graphql-sequelize-crud')

const dbschema1 = getSchema(sequelize1)
const dbschema2 = getSchema(sequelize2)

module.exports = mergeSchemas({
  schemas: [dbschema1, dbschema2]
})

@panjizhi i'm using a workaround, you've just to add this in your code:

const linkTypeDefs = `
  type Root {
    _: Boolean
  }
`;

module.exports = mergeSchemas({
  schemas: [dbschema1, dbschema2, linkTypeDefs]
})

Let me know

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

No branches or pull requests

3 participants