-
Notifications
You must be signed in to change notification settings - Fork 154
Support for non node types on cypher directives #6199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 944c8f6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
944c8f6
to
739025c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments to think about?
/** | ||
* Interfaces without `@node` are not supported yet because there is no way to access "__resolveTree", as the information of the concrete type returned by the cypher field is not available | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen in this case? Will we throw a validation error? Or just some weird indecipherable error?
const Movie = testHelper.createUniqueType("Movie"); | ||
|
||
const typeDefs = /* GraphQL */ ` | ||
type Movie @node { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@node
shouldn't he here right?
type Movie @node { | |
type Movie { |
type ${Link} { | ||
movieId: String! | ||
url: String! | ||
name: String! | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this kind of case where the Cypher might return a more complex object?
type ${Link} { | |
movieId: String! | |
url: String! | |
name: String! | |
} | |
type ${Link} { | |
movieId: String! | |
url: String! | |
name: String! | |
somethingElse: SomethingElse! | |
} | |
type ${SomethingElse} { | |
something: String! | |
} |
if (attributeType instanceof InterfaceEntity || attributeType instanceof UnionEntity) { | ||
throw new Error("@cypher field target cannot be an interface or an union"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should be keeping this given the skipped test?
Description
Add support for
@cypher
directive of fields targeting types that do not use the@node
directive. For example:This approach has some limitations, particularly with non-node interfaces and unions