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

Bugfix: call `resolver` function in `DjangoConnectionField` as documented #1529

Open PoByBolek opened 2 months ago

PoByBolek commented 2 months ago

This fixes a bug in that DjangoConnectionField doesn't call its resolver function despite it being documented in the Graphene docs: "Resolvers outside the class".

# currently, this will never be called :(
def resolve_ships(root, info):
    return [ShipModel()]

class Query(ObjectType):
    ships = DjangoConnectionField(Ship, resolver=resolve_ships)

I also fixed some warnings and running the tests now treats warnings as errors. But I really only care about c127aec75b33617b8eb10c84fb0733654ce70bf3 here 😄

PoByBolek commented 2 months ago

I just noticed that this is basically a duplicate of #1513 :sweat_smile:

PoByBolek commented 1 month ago

@sjdemartini @kiendang any thoughts on this?