Pattern around fieldsWithResolvers #799
-
Hi,
Thus, I did add option In my DB I have AuthorId in the Book table so I get it alone with the Book which I can pass into Author resolver to fetch Author. But now I dont have authorId in the book so in Author resolver I have to join fetch user from bookId which isnt great.
So is there a way to keep Author object as it in Book or add authorId into book instead, both which can be used to get authorId from BookResolver? Also, is there a way to generate resolvers for all complex types, without me adding Thanks! 🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Seems to be associated with #606 be similar, |
Beta Was this translation helpful? Give feedback.
-
@thisarattr thanks for your request.
The idea behind removing the field from the POJO (if it is present in fieldsWithResolvers) was that this field will be "resolved" by a separate Resolver method (in your case
We currently have the following flexibility around generating resolvers:
|
Beta Was this translation helpful? Give feedback.
-
Hello, @kobylynskyi!
|
Beta Was this translation helpful? Give feedback.
@thisarattr thanks for your request.
The idea behind removing the field from the POJO (if it is present in fieldsWithResolvers) was that this field will be "resolved" by a separate Resolver method (in your case
author
method inBookResolver
class), and not be taken from the POJO class.At the first glance, I am ok with keeping the field in the POJO while generating a separate TypeResolver interface.
We need to think about consequences if we remove this filtering:
graphql-java-codegen/src/main/java/com/kobylynskyi/graphql/codegen/mapper/Fie…