Skip to content

Support for MethodFieldResolver with only DataFetchingEnvironment. #304

Open

Description

@abhi-rao
  1. method <name>(object, *fieldArgs [, DataFetchingEnvironment])
  2. method is<Name>(object, *fieldArgs [, DataFetchingEnvironment]), only if the field returns a Boolean
  3. method get<Name>(object, *fieldArgs [, DataFetchingEnvironment])
  4. method getField<Name>(object, *fieldArgs [, DataFetchingEnvironment])
  5. field <name>

Currently only the above fieldResolvers are supported.
But there are use cases where are in using local context would be the only requirement.
Can methods with the following definition be supported?

method (is|get|getField)?<Name>(*fieldArgs, DataFetchingEnvironment) is supported.

The following hypothetical example shows that while loading imageBlob, we would want to know just the type of files supported. Since the parent of imageBlob is the image this data won't be available. Just the localContext is needed. In these cases, there is only need for DataFetchingEnvironment. So support for the above mentioned methodResolver would be cleaner.

type Folder {
    supportedFileTypes: [String!]!
    images: [Image!]!
}
type Image {
    imageBlob: String
}

Activity

  1. ieugen commented on Sep 3, 2019

    @ieugen

    I also have some places where I don't want / need my inputs to be deserialized into the data object.
    Since I need to know if a property of the input was specified or not. Java does not allow me to test for missing property since the property will be null.

    For this case I do my own deserialization as a Map and check with contains().

  2. vojtapol commented on Feb 4, 2020

    @vojtapol
    Member

    I think this make sense. I also came across a need like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions