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.31k stars 769 forks source link

Allow using a custom resolver function on DjangoConnectionField #1513

Open mb1511 opened 7 months ago

mb1511 commented 7 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.