graphql-python / graphene-django

Build powerful, efficient, and flexible GraphQL APIs with seamless Django integration.
http://docs.graphene-python.org/projects/django/en/latest/
MIT License
4.28k stars 766 forks source link

Allow using a custom resolver function on DjangoConnectionField #1513

Open mb1511 opened 5 months ago

mb1511 commented 5 months ago

We ran into an issue the other day trying to add a custom resolver function to a DjangoConnectionField:

class Query(ObjectType)
    some_field = DjangoConnectionField(SomeType, resolver=some_resolver)

In this case the some_resolver function is simply ignored.

We managed to work around it by defining the resolver on the query using the default def resolve_{field}: pattern and just linked that to return the result of the function we wanted to use.

Admittedly, its a pretty niche use case, but still thought it would be nice to try and fix.