Hello,
I have the following graph:
(Client)<-[:HAS_BOSS]-(Client)-[:MADE]->(Order)
and I am using infer schema so I have the types resolved.
interface Client {
id: String!
login: String!
location: Point
name: String!
}
And 2 implementations:
type ClientA implements Client{
id: String!
login: String!
location: Point
name: String!
}
and
type ClientB implements Client{
id: String!
login: String!
location: Point
name: String!
}
Order is:
type Order {
id: String!
value: Float
madeBy: [Client] @relation(name: "MADE", direction: IN)
}
Then I have my custom type defined in my schema.graphql:
type Metric {
key: String!
value: Float!
}
Metric does not exist in graph.
Because of my UI requirements I have a special Query type
type Query {
volume(login: String): [Metric] @cypher(statement: """
MATCH (c:Client{login:$login})-[r:MADE]->(o:Order) RETURN {key:"vol", value: round(sum(o.value),2)}
""")
locations(login: String): [Client] @cypher(statement: """
MATCH (p:Client {login:$login})<-[:HAS_BOSS*1..]-(per:Client) RETURN {name: per.name, location: per.location}
""")
}
My understanding is that returned map will be auto-converted to a declared return type.
And indeed:
query{
volume(login: "c48") {
key
value
}
}
returns a correct result, but:
query{
locations(login: "c4"){
name
location{
latitude
longitude
}
}
}
crashes with:
"message": "Expected a Node, got: Map{name -> String(\"Kevin\"), location -> point({x: -89.262739, y: 46.050772, crs: 'wgs-84'})}"
What could be the problem? Can I declare interface (Client) as a return type and have it auto-constructed from map (that I return in cypher query)?
Thanks