Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/graphql-modules/src/application/apollo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { wrapSchema } from '@graphql-tools/wrap';
import { DocumentNode, execute, GraphQLSchema } from 'graphql';
import { DocumentNode, execute, ExecutionArgs, GraphQLSchema } from 'graphql';
import { uniqueId } from '../shared/utils';
import { InternalAppContext } from './application';
import { ExecutionContextBuilder } from './context';
Expand Down Expand Up @@ -47,7 +47,9 @@ export function apolloSchemaCreator({
contextBuilder: ExecutionContextBuilder;
schema: GraphQLSchema;
}) {
const createApolloSchema = () => {
const createApolloSchema = ({
fieldResolver,
}: Pick<ExecutionArgs, 'fieldResolver'> = {}) => {
const sessions: Record<
string,
{
Expand Down Expand Up @@ -114,6 +116,7 @@ export function apolloSchemaCreator({
variableValues: input.variables as any,
rootValue: input.rootValue,
operationName: input.operationName,
fieldResolver,
}) as any
)
.finally(destroy);
Expand Down
5 changes: 4 additions & 1 deletion packages/graphql-modules/src/application/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
DocumentNode,
GraphQLSchema,
ExecutionResult,
ExecutionArgs,
} from 'graphql';
import type { Provider, Injector } from '../di';
import type { Resolvers, Module, MockedModule } from '../module/types';
Expand Down Expand Up @@ -70,7 +71,9 @@ export interface Application {
/**
* @deprecated Use `createApolloExecutor`, `createExecution` and `createSubscription` methods instead.
*/
createSchemaForApollo(): GraphQLSchema;
createSchemaForApollo(
options?: Pick<ExecutionArgs, 'fieldResolver'>
): GraphQLSchema;
/**
* Experimental
*/
Expand Down