Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-27-2022 06:49 AM
Hello,
I have declared following schema
type Person {
name: ID!
born: Int
actedIn: [Movie] @relation(name:"ACTED_IN")
}
type Movie {
title: ID!
released: Int
tagline: String
}
type Query {
person : [Person]
}
Running the following query
{ person(filter: {name_starts_with: "L"}, orderBy: "born_asc", first: 5, offset: 2) { name born actedIn(first: 1) { title } } }
Trying out the same example provided in https://github.com/neo4j-graphql/neo4j-graphql-java
String schema = getResourceFileAsString("neo4j.graphql");
GraphQLSchema schemagql = SchemaBuilder.buildSchema(schema);
Translator t = new Translator(schemagql);
List<Cypher> x = t.translate(query);
x.stream().forEach(c->System.out.println(" Test -->"+c.getQuery()));
I am getting following error
org.neo4j.graphql.InvalidQueryException: Validation error of type WrongType: argument 'orderBy' with value 'StringValue{value='born_asc'}' is not a valid '_PersonOrdering' - Expected AST type 'EnumValue' but was 'StringValue'. @ 'person'
at org.neo4j.graphql.Translator.translate(Translator.kt:35)
at org.neo4j.graphql.Translator.translate$default(Translator.kt:15)
at org.neo4j.graphql.Translator.translate(Translator.kt)
at com.graphql.DataFetcherDemo.main(DataFetcherDemo.java:97)
Am i doing something wrong?
09-29-2022 01:07 AM
It is an enum not a string. GraphQL used to be more lenient before allowing strings also in places for Enums,
just remove the double quotes around born_ASC
All the sessions of the conference are now available online