Skip to content

Adding a resolver with the same parentType as itself #1607

Closed Answered by srinivasankavitha
jeffcrow5 asked this question in Q&A
Discussion options

You must be logged in to vote

I just tried this scenario and it works fine for the schema below:

type Query {
   movies: [Movie]
}

type Movie {
    title: String
    director: String
    similar: Movie
    related: [Movie]
}

With data fetchers defined as

 @DgsQuery
    public List<Movie> movies(DataFetchingEnvironment dfe) {
        List<Movie> movies = new ArrayList<>();
        ...
        return movies;
    }

    
    @DgsData(parentType = "Movie")
    public String director() {
        return "some director";
    }

    @DgsData(parentType = "Movie")
    public Movie similar() {
       ...
        return new ActionMovie();
    }

    @DgsData(parentType = "Movie")
    public List<Movie> related() {
        List…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@jeffcrow5
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by jeffcrow5
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants