Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/main/kotlin/org/neo4j/graphql/Predicates.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ data class ExpressionPredicate(val name: String, val op: Operators, val value: A
override fun toExpression(variable: String): Cypher {
val paramName: String = ProjectionBase.FILTER + paramName(variable, name, value).capitalize()
val query = if (fieldDefinition.isNativeId()) {
"${not}ID($variable) ${op.op} toInteger(\$$paramName)"
if (op.list){
"${not}ID($variable) ${op.op} [id IN \$$paramName | toInteger(id)]"
} else {
"${not}ID($variable) ${op.op} toInteger(\$$paramName)"
}
} else {
"$not$variable.${name.quote()} ${op.op} \$$paramName"
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/org/neo4j/graphql/SchemaBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ object SchemaBuilder {

@JvmStatic
@JvmOverloads
fun buildSchema(typeDefinitionRegistry: TypeDefinitionRegistry , config: SchemaConfig = SchemaConfig(), dataFetchingInterceptor: DataFetchingInterceptor? = null): GraphQLSchema {
val enhancedRegistry = typeDefinitionRegistry.merge(getNeo4jEnhancements())
fun buildSchema(typeDefinitionRegistry: TypeDefinitionRegistry, config: SchemaConfig = SchemaConfig(), dataFetchingInterceptor: DataFetchingInterceptor? = null): GraphQLSchema {
val enhancedRegistry = typeDefinitionRegistry.merge(getNeo4jEnhancements())
if (!enhancedRegistry.getType(QUERY).isPresent) {
enhancedRegistry.add(ObjectTypeDefinition.newObjectTypeDefinition().name(QUERY).build())
}

val builder = RuntimeWiring.newRuntimeWiring() .scalar(DynamicProperties.INSTANCE)
val builder = RuntimeWiring.newRuntimeWiring().scalar(DynamicProperties.INSTANCE)

enhancedRegistry
.getTypes(InterfaceTypeDefinition::class.java)
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/dynamic-property-tests.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ mutation {
[source,cypher]
----
MATCH ()-[updateKnows:KNOWS]->()
WHERE ID(updateKnows) = $updateKnows_id
WHERE ID(updateKnows) = toInteger($updateKnows_id)
SET updateKnows = { `prefix.foo`: $updateKnowsJsonFoo }
WITH updateKnows
RETURN updateKnows {
Expand Down Expand Up @@ -240,7 +240,7 @@ mutation {
[source,cypher]
----
MATCH ()-[mergeKnows:KNOWS]->()
WHERE ID(mergeKnows) = $mergeKnows_id
WHERE ID(mergeKnows) = toInteger($mergeKnows_id)
SET mergeKnows += { `prefix.foo`: $mergeKnowsJsonFoo }
WITH mergeKnows RETURN mergeKnows {
json:apoc.map.fromPairs([key IN keys(mergeKnows) WHERE key STARTS WITH 'prefix.'| [substring(key,7), mergeKnows[key]]])
Expand Down
8 changes: 4 additions & 4 deletions src/test/resources/filter-tests.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ RETURN person { .name } AS person
[source,cypher]
----
MATCH (company:Company)
WHERE ID(company) = $filterCompany_id
WHERE ID(company) = toInteger($filterCompany_id)
RETURN company { .name, _id:ID(company) } AS company
----

Expand All @@ -408,7 +408,7 @@ RETURN company { .name, _id:ID(company) } AS company
[source,cypher]
----
MATCH (company:Company)
WHERE ID(company) IN $filterCompany_id
WHERE ID(company) IN [id IN $filterCompany_id | toInteger(id)]
RETURN company { .name, _id:ID(company) } AS company
----

Expand All @@ -430,7 +430,7 @@ RETURN company { .name, _id:ID(company) } AS company
[source,cypher]
----
MATCH (company:Company)
WHERE NOT ID(company) IN $filterCompany_id
WHERE NOT ID(company) IN [id IN $filterCompany_id | toInteger(id)]
RETURN company { .name, _id:ID(company) } AS company
----

Expand All @@ -452,7 +452,7 @@ RETURN company { .name, _id:ID(company) } AS company
[source,cypher]
----
MATCH (company:Company)
WHERE NOT ID(company) = $filterCompany_id
WHERE NOT ID(company) = toInteger($filterCompany_id)
RETURN company { .name, _id:ID(company) } AS company
----

Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/movie-tests.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ ORDER BY movie.year DESC LIMIT $movieFirst
[source,cypher]
----
MATCH ()-[rated:RATED]->()
WHERE ID(rated) = $rated_id
WHERE ID(rated) = toInteger($rated_id)
RETURN rated { .rating } AS rated
----

Expand Down Expand Up @@ -939,7 +939,7 @@ mutation {
[source,cypher]
----
MATCH ()-[updateRated:RATED]->()
WHERE ID(updateRated) = $updateRated_id
WHERE ID(updateRated) = toInteger($updateRated_id)
SET updateRated = { rating: $updateRatedRating }
WITH updateRated
RETURN updateRated { .rating } AS updateRated
Expand Down