neo4j-graphql-js
neo4j-graphql-js copied to clipboard
Problem with to and from fields on type
I can't have fields from and to on types without each other. I believe that it is a bug in makeAugmentedSchema because the schema works fine with Apollo's makeExecutableSchema
minimal schema:
type Focus {
from: String!
}
type Query {
randomForRoot(param: String): String
}
type Mutation {
login(email: String!, password: String!): String!
}
It leads to:
Error: Relationship type Focus has a 'from' field but no corresponding 'to' field
Another error is that I can't have following type:
type Focus {
from: String!
to: String!
industries: [Industry!]!
}
which leads to Syntax Error: Expected Name, found }
strange enough I can have this definition:
type Focus {
from: String!
to: String!
random: String
industries: [Industry!]!
}
or I can have this one:
type Focus {
fromDate: String!
toDate: String!
industries: [Industry!]!
}
The from and to fields have special meaning in the context of relationships types (types with the @relation directive). See https://grandstack.io/docs/graphql-relationship-types.html#relationships-with-properties
It looks like we might be treating any field named to and from on any type as one of these special fields, even if it is not a relationship type. At a minimum we should verify the type has a @relation directive before treating it as one of these special fields.
https://github.com/neo4j-graphql/neo4j-graphql-js/issues/608