-
-
Notifications
You must be signed in to change notification settings - Fork 509
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
rename _type_definition
to __strawberry_definition__
#2836
rename _type_definition
to __strawberry_definition__
#2836
Conversation
_type_definition
to __strawberry_definition__
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2836 +/- ##
==========================================
+ Coverage 96.30% 96.36% +0.06%
==========================================
Files 206 207 +1
Lines 8911 8949 +38
Branches 1641 1644 +3
==========================================
+ Hits 8582 8624 +42
+ Misses 208 206 -2
+ Partials 121 119 -2 |
Thanks for adding the Here's a preview of the changelog: This release renames Here's the preview release card for twitter: Here's the tweet text:
|
_type_definition
to __strawberry_definition__
_type_definition
to __strawberry_object__
Once again great work @nrbnlulu!! Just left two minor comments, the rest looks good to me 🚀 |
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.
This is an awesome change in general! :)
Made some minor suggestions
@@ -151,6 +152,12 @@ def _process_type( | |||
_fields=fields, | |||
is_type_of=is_type_of, | |||
) | |||
# TODO: remove when deprecating _type_definition | |||
DeprecatedDescriptor( | |||
DEPRECATION_MESSAGES._TYPE_DEFINITION, |
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.
Wouldn't it be simpler/better to just put the message in here directly, instead of defining and importing DEPRECATION_MESSAGES
?
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.
I use it 3 times, would be duplicated ig.. it also easier to remove it afterwards I think.
@@ -340,7 +344,7 @@ def get_graphql_input_fields( | |||
) | |||
|
|||
def from_input_object(self, object_type: type) -> GraphQLInputObjectType: |
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.
Just notice that from_input_object
is the only converter that receives a type instead of StrawberryObjectDefinition
@patrick91 should we try to normalize this? Don't know if in this PR, but since the breaking change is happening it would be nice. Either this function should receive the object definition, like the others (e.g. from_object, from_interface, etc), or those others should receive the type
directly (even typing it as type: WithObjectDefinition
)
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.
let's do in another PR 😊
Co-authored-by: Thiago Bellini Ribeiro <hackedbellini@gmail.com>
Co-authored-by: Thiago Bellini Ribeiro <hackedbellini@gmail.com>
for more information, see https://pre-commit.ci
# Conflicts: # tests/schema/test_extensions.py
Co-authored-by: Thiago Bellini Ribeiro <hackedbellini@gmail.com>
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.
Thank you so much for doing this! <3
Description
Rename
_type_definition
to__strawberry_definition__
.I understand that @BryceBeagle intended that
StrawberryObject
would be merged withTypeDefinition
somehow in the future.Currently I exposed
WithStrawberryDefinition
as a protocol that only includes__strawberry_definition__
in it. If in the future it would be a real type the annotations are already in place.I am not very sure about the nameAs discussed on discord every strawberry decorated type would have this dunder. Follow #2841 for more details.__strawberry_object__
since it can beInputObject
/Interface
/ObjectType
and enums use
_enum_definition
, open to suggestions...TODO:
_type_definition
backward compat with warning.Types of Changes
Issues Fixed or Closed by This PR
Checklist