-
Notifications
You must be signed in to change notification settings - Fork 821
New Connection API #347
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
New Connection API #347
Conversation
graphene/relay/connection.py
Outdated
if isinstance(resolved, connection_type): | ||
return resolved | ||
|
||
on_resolve = partial(connection_type.connection_resolver, args=args, context=context, info=info) | ||
if isinstance(resolved, Promise): |
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.
The only minor problem I have with this is that the instance check does not allow for duck-typing, which goes in line with graphql-python/graphql-core#91 and is a quite common principle in python.
graphene/relay/connection.py
Outdated
@classmethod | ||
def connection_resolver(cls, resolver, connection_type, root, args, context, info): | ||
resolved = resolver(root, args, context, info) | ||
|
||
on_resolve = partial(cls.resolve_connection, connection_type, args) | ||
if isinstance(resolved, connection_type): |
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.
Support for duck-typing would be nice here as well but I think it would probably be far less used and more a nit-pick from my side.
Liking the direction this is heading so far :) |
Hello @syrusakbary I get this error -> |
Hey guys. I'm wondering what the status is on this PR. It seems like some of the documented Connection APIs might be out of date? I'm getting errors that look like this when I try to declare a property with type
|
Closing in favor of #500 |
This PR improves the
relay.Connection
APIs in Graphene.Is inspired on the work of @Globegitter in #288 and following #304.
Things that this PR should achieve:
.Connection
creation in Nodes in pro of cleaner and more explicit codegraphql-relay
dependency.Related issues
#304 #180 #62