-
-
Notifications
You must be signed in to change notification settings - Fork 574
feat(interface): input type cannot inherit an interface type #1254
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
Conversation
dd620d7
to
2d4791b
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1254 +/- ##
==========================================
+ Coverage 95.04% 95.06% +0.01%
==========================================
Files 514 515 +1
Lines 33539 33583 +44
Branches 1735 1736 +1
==========================================
+ Hits 31878 31924 +46
+ Misses 1379 1377 -2
Partials 282 282 🚀 New features to boost your workflow:
|
Thanks for adding the Here's a preview of the changelog: Starting with this release, Strawberry will throw an error if one of your input The following code, for example, will now throw an error: import strawberry
@strawberry.interface
class SomeInterface:
some_field: str
@strawberry.input
class SomeInput(SomeInterface):
another_field: int Here's the tweet text:
|
Hi @scratchmex would you be able to rebase this PR and address the comments made by Bryce? 😊 no worries if not I can't take a look at some point in future :) |
52822f6
to
f566442
Compare
CodSpeed Performance ReportMerging #1254 will not alter performanceComparing Summary
|
@patrick91 I rebased this PR, addressed all feedback, and turned the exception into a |
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.
Awesome! Thank you @DoctorJohn! <3
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.
PR Summary
Added validation to prevent GraphQL input types from inheriting interface types, aligning with GraphQL specification constraints.
- Added new
InvalidSuperclassInterfaceError
instrawberry/exceptions/invalid_superclass_interface.py
for proper error handling - Implemented validation in
strawberry/types/object_type.py
to catch interface inheritance attempts by input types - Added comprehensive error documentation in
docs/errors/invalid-superclass-interface.md
with clear examples - Added test cases in
tests/schema/test_input.py
to verify error handling for both single and multiple interface inheritance
6 files reviewed, 2 comments
Edit PR Review Bot Settings | Greptile
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Description
raises the exception
InvalidSuperclassInterface
:also works when inheriting from multiple interfaces:
Types of Changes
Issues Fixed or Closed by This PR
Checklist