Hi, I'm having some difficulty getting `graphql-im...
# orm-help
t
Hi, I'm having some difficulty getting
graphql-import
to play nice with my custom Date scalar running on node + TS. I have four files in my setup with
root.graphql
as the entry point as so:
Copy code
# import * from "common.graphql"
# import * from "queries.graphql"
# import * from "mutations.graphql"
type Query {
  root: String!
}
type Mutation {
  root: String!
}
scalar Date
And the other files are as you would expect. I'm trying to combine my typeDefs as follows:
Copy code
const typeDefs = importSchema("./src/interfaces/graphql/schema/type-defs/root.graphql")
...
// create ApolloServer
When I run my code this way I get the fol error:
UnhandledPromiseRejectionWarning: Error: Query.getProfile defined in resolvers, but not in schema
. On
console.log(typeDef)
it doesn't appear to have loaded the imports because the string only contains whats in root.graphql. I have tried relative paths similar to the path used in importSchema but no joy#. So in playing around I tried:
Copy code
const schemas = {
  common: importSchema("./src/interfaces/graphql/schema/type-defs/common.graphql"),
  mutations: importSchema("./src/interfaces/graphql/schema/type-defs/mutations.graphql"),
  queries: importSchema("./src/interfaces/graphql/schema/type-defs/queries.graphql"),
}

const typeDefs = importSchema(
  "./src/interfaces/graphql/schema/type-defs/root.graphql",
  schemas
)
Which gives the follow error:
Error: Field starts: Couldn't find type Date in any of the schemas.
. If I remove the custom scalar type it runs correctly (or if I put everything into one .graphql file), but for obvious reasons I'd like to use custom scalars and split it into separate files. Any suggestions?
It looks like there were known limitations to graphql-import which were causing my issues. So, I've moved to https://github.com/Urigo/merge-graphql-schemas and have everything working as expected.