types: add option for strict connection types#1504
Merged
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1504 +/- ##
=======================================
Coverage 96.01% 96.01%
=======================================
Files 51 51
Lines 1755 1755
=======================================
Hits 1685 1685
Misses 70 70
☔ View full report in Codecov by Sentry. |
erikwrede
requested changes
Jun 4, 2023
Member
erikwrede
left a comment
There was a problem hiding this comment.
Thanks for the PR! Can you please add some test cases for this, testing the schema generation? 😊
Contributor
Author
|
@erikwrede does that look like what you meant? |
Contributor
Author
|
@erikwrede it looks like the checks will never complete because the python 3.6 test workflow no longer exists after https://github.com/graphql-python/graphene/pull/1507/files but the GitHub repo settings still require that workflow to run |
erikwrede
approved these changes
Jul 26, 2023
garobrik
added a commit
to techmatters/terraso-backend
that referenced
this pull request
Jul 26, 2023
garobrik
added a commit
to techmatters/terraso-backend
that referenced
this pull request
Jul 26, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a
strict_typesmeta option to the relayConnectionclass to simplify the use case identified in this issue: graphql-python/graphene-django#901Default of
Falseis the old behavior, and when set toTruegeneratedTConnectiontypes will be typed asedges: [TEdge!]!instead ofedges: [TEdge]!andTEdgewill havenode: T!instead ofnode: T.This avoids duplicating logic and string descriptions for subclasses which just want to implement this common behavior. If this behavior is deemed desirable by default it would be trivial to flip the flag's default or remove it entirely. It only make the types stricter so it oughtn't break any existing code (though it will cause unexpected changes to user's schema's nonetheless, which is why I kept the default to
False).