-
Notifications
You must be signed in to change notification settings - Fork 49
Added alias or field name as variable to Cypher.kt #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…qlgh-172 # Conflicts: # core/src/main/kotlin/org/neo4j/graphql/handler/BaseDataFetcher.kt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apply changes from DirkMahler#1
use variable everywhere
What I don't understand is the unrelated change of the "Cypher" type as result/parameter to String In places where we know we expect Cypher, we should also make use of that. What does that "variable" actually mean? Is that one of the column names that the contained cypher statement returns? Do we always know these? |
The generated Cypher query per row returns a map with exactly one column. This one is the query field or alias that was part of the GraphQL query. To fill the data field of the GraphQL response the name of this field or alias needs to be extracted, until now this was only possible by looking at the first row of the result. Even worse: if the result was empty it was not possible to infer that name, e.g. for returning an empty list if the schema requires a Non-Null value. This now has been made available via |
The use of the Because the |
The alias or field name has been added as variable to the Cypher class. This comes for two purposes:
In a controller the following code can be used:
PS: I did not update the examples as I felt a bit unsafe about Kotlin (still stuck in the "pure" Java universe). Any guidance appreciated for providing this as well.