You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.
When you have such a big schema to design you might need to split your schema into multiple files instead of a single one.
We split the files to one base file that has all base (Query, Mutation, Subscription) types and all other files extend these types if they need.
The problem came when we need to extend the type Query and use @cypher inside it.
The problem @cypher didn't work as expected in the extend type Query and only work on the root Query type
Use mergeTypeDefs function from the @graphql-toolkit/schema-merging module, it will merge type extensions together, then you use print from graphql.js to export the typedefs back into an SDL string.
Which you can then pass back into makeAugmentedSchema.
pseudocode:
import { mergeTypeDefs } from '@graphql-toolkit/schema-merging';
import { print } from 'graphql';
const a = `type Query {
rootQuery: String @cypher(statement: "WITH 'Wooorking 🐈 🐈 🐈 🐈' AS value RETURN value")
}`;
const b = ` type Movie {
title: String
movieTestBase: String @cypher(statement: "WITH 'Wooorking 🐈 🐈 🐈 🐈' AS value RETURN value")
}`;
const c = `extend type Movie {
movieTestExtend: String @cypher(statement: "WITH 'Wooorking 🐈 🐈 🐈 🐈' AS value RETURN value")
}`;
const d = `extend type Query {
extendQuery: String @cypher(statement: "WITH 'NOT WORKING 😞 😞 😞 😞' AS value RETURN value")
}
`;
const tdList = [a, b, c, d];
return print(mergeTypeDefs(tdlist));
Description
When you have such a big schema to design you might need to split your schema into multiple files instead of a single one.
We split the files to one base file that has all base (Query, Mutation, Subscription) types and all other files extend these types if they need.
The problem came when we need to extend the type
Query
and use@cypher
inside it.The problem
@cypher
didn't work as expected in theextend type Query
and only work on the rootQuery
typeHere is a sample repo for this issue
Sample Code
The text was updated successfully, but these errors were encountered: