Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

Add option to disable generating defaultResolvers #350

Closed
koenpunt opened this issue Dec 17, 2018 · 2 comments · Fixed by #437
Closed

Add option to disable generating defaultResolvers #350

koenpunt opened this issue Dec 17, 2018 · 2 comments · Fixed by #437

Comments

@koenpunt
Copy link
Contributor

I can totally understand the use of the generated defaultResolvers, but it would be nice to have an option to disable them.

For example a project I'm working on doesn't use them, but now when I rename a property of a type, I have to generate the resolver types just because the defaultResolvers are using invalid properties.

@jasonkuhrt
Copy link
Member

but now when I rename a property of a type, I have to generate the resolver types just because the defaultResolvers are using invalid properties.

If I understand correctly, take the following example, imagine I'm not using the default resolvers and imagine I change my model type such that it affects the parent herein... that could cause parent.first and parent.last to become invalid.

export namespace HumanNameResolvers {
  export const defaultResolvers = {
    first: (parent: HumanName) => parent.first,
    last: (parent: HumanName) => parent.last,
  }

  //...

  export interface Type {
    first: (
          parent: HumanName,
          args: {},
          ctx: Context,
          info: GraphQLResolveInfo
        ) => string | Promise<string>)
      

    last: (
          parent: HumanName,
          args: {},
          ctx: Context,
          info: GraphQLResolveInfo
        ) => string | Promise<string>)
      
  }
}

@jasonkuhrt
Copy link
Member

Should work in the upcoming release:

# graphqlgen.yml
default-resolvers: false

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants