neo4j-graphql-js @relation directive produce a @relation undefined error in nestjs graphql generate-typings:
Using the following:
type Author {
id: ID!
name: String!
posts: [Post] @relation(name: "REGISTERED", direction: "OUT")
}
with
const definitionsFactory = new GraphQLDefinitionsFactory();
definitionsFactory.generate({
typePaths: ['./src/**/*.graphql'],
path: join(process.cwd(), 'src/schema.graphql.ts'),
outputAs: 'class',
watch: true,
});
to produce an auto-generated schema result in this error:
(node:181608) UnhandledPromiseRejectionWarning: Error: Unknown directive "relation".
at assertValidSDL (C:\Genysis-Microservices\registry.genysis.com\node_modules\graphql\validation\validate.js:108:11)
at Object.buildASTSchema (C:\Genysis-Microservices\registry.genysis.com\node_modules\graphql\utilities\buildASTSchema.js:71:34)
at Object.buildSchemaFromTypeDefinitions (C:\Genysis-Microservices\registry.genysis.com\node_modules\graphql-tools\src\generate\buildSchemaFromTypeDefinitions.ts:43:32)
It would appear that we have to define the directives before we can use them in GraphQLDefinitionsFactory()....if this is the case how would we handle the directives of neo4j-graphql-js augmented schema?
Incredible.....I have not been following the community for lack of activity. i find it very interesting that a question I ask almost 3 years ago we still struggle with. I have just revisited this issue and found your answer a year ago interesting. Did you improve on it? I would be interested to know. I found the new directives in neo4jGraphql V3 interesting and would really like to use them with Nest. I have been ignoring the neo4jGraphql lib for the plain neo4j-driver but with a solution to this problem it may get new life in nest.
Hey Matt.....this is great news. I have revamp my strategy many times.
My most recent strategy follows this pattern: using nestjs v11/apollo server V4/neo4jGraphql V3 in a monorepo with Federation..
Here I have a gateway and let's say a wallet microservice. I also have a neo4j dynamic module that creates a connection to the database, AND I also have a dynamic graphql module that launches the startStandAloneServer. I have not fully tested this as yet but I can post the relevant code.
My main problems relates to launching the v4 apollo server and that the neo4j directives are compatible with Nest and apollo v4.