graphql
graphql copied to clipboard
Add arguments on interface relational-field of object type
Given the following schema (taken from the tests):
interface MovieNode @auth(rules: [{allow: "*", operations: [READ]}]) {
id: ID
movies: [Movie!]! @relationship(type: "HAS_MOVIE", direction: OUT)
customQuery: [Movie] @cypher(statement: """
MATCH (m:Movie)
RETURN m
""")
}
type Movie implements MovieNode @auth(rules: [{allow: "*", operations: [READ]}]) {
id: ID
nodes: [MovieNode]
movies: [Movie!]! @relationship(type: "HAS_MOVIE", direction: OUT)
customQuery: [Movie] @cypher(statement: """
MATCH (m:Movie)
RETURN m
""")
}
The following type is generated among others:
interface MovieNode {
customQuery: [Movie]
id: ID
movies: [Movie!]!
moviesConnection: MovieNodeMoviesConnection!
}
I would suggest to add arguments to the interface relation-field in case the type of the field is not an interface or union but a concrete node (object type):
interface MovieNode {
customQuery: [Movie]
id: ID
movies(options: MovieOptions, where: MovieWhere): [Movie!]!
moviesConnection(after: String, first: Int, sort: [MovieNodeMoviesConnectionSort!], where: MovieNodeMoviesConnectionWhere): MovieNodeMoviesConnection!
}
This enhancement cannot be done for relation-fields of type union or interface, since input types are not allowed to implement interfaces (by GraphQL spec)