Custom DQL resolver for field define in GraphQL schema

Hi,

Thanks for your response.

I tried to use the definition that you mentioned and:

  1. filter is reserved - but this is not a huge problem

  2. it seems that Dgraph does not accept the object as the input types for custom resolvers:

    {"errors":[{"message":"resolving updateGQLSchema failed because input:29: Type InterfaceRevision; Field implementations; @custom directive, body template must use fields defined within the type, found `customFilter`.\n (Locations: [{Line: 3, Column: 4}])","extensions":{"code":"Error"}}]}
    

    So only simple type such as String, Int etc are accepted?

  3. And what about custom queries? Let supposed I have such schema:

    type Tweets {
    	id: ID!
    	text: String! @search(by: [fulltext])
    	users: [User!]
    	timestamp: DateTime! @search
    }
    type User {
    	screen_name: String! @id
    	followers: Int @search
    	customResolver: [Tweets] @custom(http: {
    		url:  "http://host.docker.internal:8888/custom-business-logic",
    		method: POST
    		body: "{id:$id, filter:$filter}"
    	})
    	tweets: [Tweets] @hasInverse(field: users)
    }
    

    and I want to create a custom resolver with my own business logic. The problem that I’m currently facing is that I need to return the whole Tweets array with all nested fields from my custom resolver as I do not know which fields were requested by the user. This is quite problematic as I need to do sth like

    	{
    	 AllNodes(func: type(Tweets)) @filter(..custom filter..) {
    		expand(_all_) {
    		  expand(_all_) {
    			expand(_all_) {
    			  expand(_all_)
    			}
    		  }
    		}
    	  }
    	}
    

    With such approach, there is a lot of over fetched data. I just want to return the uids of Tweets so the rest can be resolved by Dgraph nested resolver.

    How to achieve that?

    Similar problem was described by donovan: Creating custom resolvers for Dgraph GraphQL - #15 by donovan

Cheers!