Skip to content

MethodDataFetcher cannot call static method anymore #180

@tdraier

Description

@tdraier

I have an issue with changes in #175 - all my fields defined by static method ( which I use on root query fields ) are now broken. The behaviour of MethodDataFetcher is changed and I don't understand the new logic.
First the test on isStatic has been removed, so code is now going into the second case, trying to instantiate an instance of my class. This returns null as it's not intended to be built.
Next, obj==null, environment.getSource() is the root context, so getGraphQLFieldValue() is called and it throws an exception "No GraphQL field found".

I would expect it to simply call method.invoke(null, invocationArgs(environment, container))

I could fix this by rewriting all code - removing static and adding a constructor with a root context to all classes where it's needed, but it would be good to keep compatibility here ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions