neo4j-graphql / neo4j-graphql-java

Neo4j Labs Project: Pure JVM translation for GraphQL queries and mutations to Neo4j's Cypher
Apache License 2.0
105 stars 49 forks source link

CALL graphql.idl() command not working when schema contains @cypher directive #111

Closed Chimba123 closed 4 years ago

Chimba123 commented 4 years ago

I am using Neo4j 3.5.14 with the APOC plugin installed everything else works fine

However, when I try to update the graphql schema with cypher queries using the @cypher directive using CALL graphql.idl() it just doesn't work. I have used the example schema here https://neo4j.com/developer/graphql/ it still doesn't work.

jexp commented 4 years ago

Are you using the database plugin or this middleware library?

Can you share your script / screenshot?

What does "doesn't work" mean?

Chimba123 commented 4 years ago

@jexp locally I am using the plugin installed automatically from the plugin section then for my sandbox I am using a graphene database with the Full APOC installed.

In both cases, the command is not working when I use the "@cypher" directive

the code is as follows graphql.idl(“ type User { followsCount:Int @cypher ( statement: "MATCH (this)<-[r:FOLLOWS_ON_SOCIALS]-(:User) with this, count(r) as rel_cnt return rel_cnt" ) } “)

I am getting the following error: Neo.ClientError.Statement.SyntaxError Invalid input 'M': expected whitespace, '.', node labels, '[', "=~", IN, STARTS, ENDS, CONTAINS, IS, '^', '*', '/', '%', '+', '-', '=', '~', "<>", "!=", '<', '>', "<=", ">=", AND, XOR, OR, ',' or ')' (line 20, column 13 (offset: 574)) "statement: "MATCH (this)<-[r:FOLLOWS_ON_SOCIALS]-(:User) with this, count(r) as rel_cnt return rel_cnt"

Chimba123 commented 4 years ago

@jexp not working means it's not setting the schema when the "@cypher" directive is in the command and frankly it's disturbing

I have realized all the examples where the @cypher directive is used is that you guys have not used with CALL graphql.idl() command as a wrapper to the schemas... perhaps there is a special way of doing it in graphql that you guys are not showing?

take for example the link given above it just shows the schema... but not the procedure command to create the schema with graphql

Chimba123 commented 4 years ago

@jexp ITS NOT WORKING AND THE INSTRUCTIONS WRT GRAPHQL JAVA and the CALL graphql.idl() command are not clearly shown, only raw schema objects are shown but not with the command ... something is off ... I mean I have tried a lot of schemas in the procedure with the "@cypher" directive, I have downgraded even but the graphql plugin on the Neo4j desktop isn't generating graphql schemas when there is an "@cypher" directive.. maybe you try it on Neo4j desktop with the CALL graphql.idl() and see for yourself

jexp commented 4 years ago

You saw that you were using double quotes within double quotes? You should use single quotes on the procedure call string.

Also this is the wrong repo, the correct repo for the plugin is github.com/neo4j-graphql/neo4j-graphql

graphql.idl(' type User { followsCount:Int @cypher ( statement: "MATCH (this)<-[r:FOLLOWS_ON_SOCIALS]-(:User) with this, count(r) as rel_cnt return rel_cnt" ) } ')

Chimba123 commented 4 years ago

You saw that you were using double quotes within double quotes? You should use single quotes on the procedure call string.

Also this is the wrong repo, the correct repo for the plugin is github.com/neo4j-graphql/neo4j-graphql

graphql.idl(' type User { followsCount:Int @cypher ( statement: "MATCH (this)<-[r:FOLLOWS_ON_SOCIALS]-(:User) with this, count(r) as rel_cnt return rel_cnt" ) } ')

Thanks a lot !!! wow what a simple solution!!