-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] don't generate resolvers for fields handled by the parent #332
Comments
Update: I think what i'm looking for is an option to explicit not auto generate certain keys in the interface because I know i'm using the parent resolver |
Related issue also, For graphs using federation, if I declare a type as defined in another subgraph i.e. |
Hi @laytong , Apologies, I couldn't get to this earlier.
I think this is the way implementing type resolvers work. In my observations, interfaces don't have field-level resolvers that like types. I believe the generated types may generate resolver types for interfaces which is could be wrong. Let me confirm with the codegen team
Good news this bug is fixed in latest version v0.11. Could you please update and try again? |
Hey, thanks for getting around to this.
Awesome i'll check this out.
Could be an implementation specific detail? perhaps apollo server specific? The frustration for me is that if everytime I regenerate my file, these child resolvers will keep coming back perhaps this can be resolved with a directive? |
So I have the following definition in my schema file as a field on another type type User @key(fields: "userId", resolvable: false) @tag(name: "internal") {
userId: ID!
} it still generates the resolver entry on the new version import type { UserResolvers } from "./../../types.generated.js";
export const User: UserResolvers = {
/* Implement User resolver logic here */
}; |
Hi @laytong , I think if I have a reproducible repo, it would help me understand the issue better. To be honest, Federation support is a bit patchy at the moment, which is something I'm aiming to improve in the upcoming versions 🙂 |
When I have a series of types that implement a parent interface. I only want the field resolver to generate for the parent by default.
i.e.
when I generate the resolvers. I want to have a top level resolver for say
sound
defined onAnimal
but i get empty resolvers generated for
Cat
andDog
and if i delete them they will just be regenerated everytime I regen for new changes.Am i missing an existing setting or feature to handle this?
this would be exclusive to
interface
andimplements
relationshipsDescribe alternatives you've considered
At the moment i have to rewrite the logic in the child resolver every time.
Additional context
I am also making use of Mappers if that has any impact?
The text was updated successfully, but these errors were encountered: