Skip to content

Commit 4c5b6fb

Browse files
Divyendu Singhtimsuchanek
Divyendu Singh
authored andcommittedJul 11, 2018
fix: Use defaultMergedResolver from graphql-tools (#264)
* Use defaultMergedResolver from graphql-tools 1. defaultMergedResolver is also an alias aware resolver and can be used in place of customFieldResolver - #216 2. We still need an alias aware resolver for this - https://github.com/graphcool/prisma/issues/1896 and defaultMergedResolver serves as one having no need for us to maintain a customFieldResolver 3. This is an ongoing disucssion to permanently mitigate this issue - dotansimha/graphql-binding#80 * resolve yarn.lock conflict
1 parent ee0c03f commit 4c5b6fb

File tree

5 files changed

+7
-27
lines changed

5 files changed

+7
-27
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"graphql-playground-middleware-express": "1.6.3",
6262
"graphql-playground-middleware-lambda": "1.6.1",
6363
"graphql-subscriptions": "^0.5.8",
64-
"graphql-tools": "^2.23.1",
64+
"graphql-tools": "^2.24.0",
6565
"subscriptions-transport-ws": "^0.9.8"
6666
},
6767
"devDependencies": {

‎src/customFieldResolver.ts

-18
This file was deleted.

‎src/index.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ import {
2121
import { importSchema } from 'graphql-import'
2222
import { deflate } from 'graphql-deduplicator'
2323
import expressPlayground from 'graphql-playground-middleware-express'
24-
import { makeExecutableSchema, addMockFunctionsToSchema } from 'graphql-tools'
24+
import { makeExecutableSchema, addMockFunctionsToSchema, defaultMergedResolver } from 'graphql-tools'
2525
import { applyMiddleware as applyFieldMiddleware } from 'graphql-middleware'
2626
import { createServer, Server as HttpServer } from 'http'
2727
import { createServer as createHttpsServer, Server as HttpsServer } from 'https'
2828
import * as path from 'path'
29-
import customFieldResolver from './customFieldResolver'
3029
import { SubscriptionServer } from 'subscriptions-transport-ws'
3130

3231
import {
@@ -262,11 +261,11 @@ export class GraphQLServer {
262261
formatError: this.options.formatError || defaultErrorFormatter,
263262
logFunction: this.options.logFunction,
264263
rootValue: this.options.rootValue,
265-
validationRules:
264+
validationRules: this.options.validationRules,
266265
typeof this.options.validationRules === 'function'
267266
? this.options.validationRules(request, response)
268267
: this.options.validationRules,
269-
fieldResolver: this.options.fieldResolver || customFieldResolver,
268+
fieldResolver: this.options.fieldResolver || defaultMergedResolver,
270269
formatParams: this.options.formatParams,
271270
formatResponse: formatResponse(request),
272271
debug: this.options.debug,

‎src/lambda.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ import * as fs from 'fs'
33
import { GraphQLSchema } from 'graphql'
44
import { importSchema } from 'graphql-import'
55
import lambdaPlayground from 'graphql-playground-middleware-lambda'
6-
import { makeExecutableSchema } from 'graphql-tools'
6+
import { makeExecutableSchema, defaultMergedResolver } from 'graphql-tools'
77
import { deflate } from 'graphql-deduplicator'
88
import * as path from 'path'
9-
import customFieldResolver from './customFieldResolver'
109

1110
import { LambdaOptions, LambdaProps } from './types'
1211

@@ -121,7 +120,7 @@ export class GraphQLServerLambda {
121120
logFunction: this.options.logFunction,
122121
rootValue: this.options.rootValue,
123122
validationRules: this.options.validationRules,
124-
fieldResolver: this.options.fieldResolver || customFieldResolver,
123+
fieldResolver: this.options.fieldResolver || defaultMergedResolver,
125124
formatParams: this.options.formatParams,
126125
formatResponse: formatResponse(event),
127126
debug: this.options.debug,

‎yarn.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -1873,7 +1873,7 @@ graphql-subscriptions@^0.5.8:
18731873
dependencies:
18741874
iterall "^1.2.1"
18751875

1876-
graphql-tools@^2.23.1:
1876+
graphql-tools@^2.23.1, graphql-tools@^2.24.0:
18771877
version "2.24.0"
18781878
resolved "https://registry.yarnpkg.com/graphql-tools/-/graphql-tools-2.24.0.tgz#bbacaad03924012a0edb8735a5e65df5d5563675"
18791879
dependencies:

0 commit comments

Comments
 (0)