-
-
Notifications
You must be signed in to change notification settings - Fork 677
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
Add directives support to Interfaces #744
Add directives support to Interfaces #744
Conversation
Codecov Report
@@ Coverage Diff @@
## master #744 +/- ##
=======================================
Coverage 95.34% 95.35%
=======================================
Files 80 80
Lines 1483 1485 +2
Branches 295 295
=======================================
+ Hits 1414 1416 +2
Misses 66 66
Partials 3 3
Continue to review full report at Codecov.
|
Sorry @Superd22 for no response for this PR for over 2 months, I've totally forgot about this 😞
I think that's ok. If there will be some use cases for separating interfaces from object types, we can always add some global or scoped config for that 😉 |
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.
Looks great, thanks! ❤️
8bfb3b6
to
5c1a25a
Compare
I've added changelog entry and updated docs 😉 Merging 🚀 |
Co-authored-by: Michał Lytek <michal.wojciech.lytek@gmail.com>
This PR adds support for using
@Directive
on InterfaceType (and its fields).Directives are supported on interface as per GraphQL specs and that support is widely implemented, see Apollo for example.
Possible caveats
In this proposed implementation, any ObjectType implementing the interface (more precisely, whose typescript class extends the typescript class of the interface) will inherit its directives. This seems in line with the current behavior of TypeGraphQL.
Nevertheless, as it stands, users would not be able to only add directive to the interface and not the objects implementing it.
I'd love insights about this behavior and if you think that's a problem.