Skip to content

check for async callable object and function for relay resolver #1244

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

reallistic
Copy link
Contributor

This PR ensures that the relay resolve_wrapper can handle async functions and objects with an async __call__ method.

I ran into this issue trying to use the ariadne-auth authz.require_permission function alongside the connection class.
require_permission converts the decorated resolver into an instance of PermissionChecker which defines an async __call__ and is not picked up by inspect.iscoroutinefunction.

The helper function was inspired by starlette.

For now, I only added the helper to the connection object, that said, many of the existing usages of inspect.iscoroutinefunction will want to move to this helper.

@reallistic reallistic force-pushed the async_callable_object branch from 2f5e7fa to 3b1d13c Compare April 8, 2025 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant