Skip to content

feat(graphql): add support for transforming the resolvers #3503

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

Merged

Conversation

JoshVee
Copy link

@JoshVee JoshVee commented Mar 3, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

The GraphQLFactory discovers all the resolvers using the ResolversExplorerService and ScalarsExplorerService. These resolvers are then converted into a schema using makeExecutableSchema().

Issue Number: N/A

What is the new behavior?

This PR introduces a new option on GqlModuleOptions to support transforming the resolvers before creating the schema. This follows a similar pattern to the existing transformSchemas option.

Being able to transform resolvers enables resolver composition, which in our case is needed to migrate from an existing GraphQL implementation to NestJS - eg. https://the-guild.dev/graphql/tools/docs/resolvers-composition.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Resolver composition example

image

Sorry, something went wrong.

@JoshVee JoshVee changed the title feat(@nestjs/graphql): add support for transforming the resolvers feat(graphql): add support for transforming the resolvers Mar 3, 2025

Verified

This commit was signed with the committer’s verified signature.
pquentin Quentin Pradet
@JoshVee JoshVee force-pushed the joshvee-resolver-transformation branch from 0de0134 to d8008ec Compare March 3, 2025 12:30
@JoshVee
Copy link
Author

JoshVee commented Mar 3, 2025

@kamilmysliwiec do you see any issues with this approach?

@kamilmysliwiec
Copy link
Member

LGTM

@kamilmysliwiec kamilmysliwiec merged commit 9d99863 into nestjs:master Mar 24, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants