graphql
graphql copied to clipboard
replacement for neo4jgraphql() in resolver
The previous version has the easiest way to define resolvers to convert to cypher using neo4jgraphql
contact(object, params, ctx, resolveInfo) {
return neo4jgraphql(object, params, ctx, resolveInfo);
}
There is no direct migration for this function
Using delegateToSchema
isn't working for me either.
https://github.com/neo4j/graphql/issues/227#issuecomment-963264909
Having a direct alternative for neo4jgraphql() would be apt for easy migration of larger schema
We have generally countered the request for this to be added back in as it's generally not what users actually need.
For what purpose do you require the generated Cypher in your resolvers if you don't mind me asking?
We designed our graphql app with our query names. The legacy package provided us the ability to define our queries and mutation and translate it to cypher. By using this we designed our entire schema and so many apps started using the queries and mutation. Now if I have to change those query/mutation names and ask all the systems to change the way they use the queries is not an easy migration. If we have an option for neo4jgraphql() in this package, it would be easy to make a migration for bigger graphql apps.
So it sounds like you decided on what you wanted your Query and Mutation field names to be rather than letting the old library generate them for itself?
For those users who want to create custom Query and Mutation resolvers, we offer the OGM (https://neo4j.com/docs/graphql-manual/current/ogm/) which can be used to programmatically execute against the Neo4j GraphQL Library. I'd recommend looking into that as an alternative to your current approach.
If I have to use OGM for all my query resolvers, I assume I have to initialize all the models with OGM and map it in resolver right?
like for this
contact(object, params, ctx, resolveInfo) {
return neo4jgraphql(object, params, ctx, resolveInfo);
}
I need to do
const ogm = new OGM({ typeDefs, driver });
const contact = ogm.model("contact");
const { contact } = await contact.read({
input: [
{
id,
}
]
});
This changes our resolver and a huge effort to change all the models.
Can we have something similar to neo4jgraphql()
be made available in this package and that will be helpful for people to migrate easily from neo4j-graphql-js
?
Thanks
We'll probably allow users to get the translation result (#302).