@@ -350,6 +350,7 @@ export function extendSchema(
350
350
description : type . description ,
351
351
interfaces : ( ) => extendImplementedInterfaces ( type ) ,
352
352
fields : ( ) => extendFieldMap ( type ) ,
353
+ isTypeOf : type . isTypeOf ,
353
354
} ) ;
354
355
}
355
356
@@ -360,7 +361,7 @@ export function extendSchema(
360
361
name : type . name ,
361
362
description : type . description ,
362
363
fields : ( ) => extendFieldMap ( type ) ,
363
- resolveType : cannotExecuteClientSchema ,
364
+ resolveType : type . resolveType ,
364
365
} ) ;
365
366
}
366
367
@@ -369,7 +370,7 @@ export function extendSchema(
369
370
name : type . name ,
370
371
description : type . description ,
371
372
types : type . getTypes ( ) . map ( getTypeFromDef ) ,
372
- resolveType : cannotExecuteClientSchema ,
373
+ resolveType : type . resolveType ,
373
374
} ) ;
374
375
}
375
376
@@ -409,7 +410,7 @@ export function extendSchema(
409
410
deprecationReason : field . deprecationReason ,
410
411
type : extendFieldType ( field . type ) ,
411
412
args : keyMap ( field . args , arg => arg . name ) ,
412
- resolve : cannotExecuteClientSchema ,
413
+ resolve : field . resolve ,
413
414
} ;
414
415
} ) ;
415
416
@@ -430,7 +431,6 @@ export function extendSchema(
430
431
description : getDescription ( field ) ,
431
432
type : buildOutputFieldType ( field . type ) ,
432
433
args : buildInputValues ( field . arguments ) ,
433
- resolve : cannotExecuteClientSchema ,
434
434
} ;
435
435
} ) ;
436
436
} ) ;
@@ -475,7 +475,7 @@ export function extendSchema(
475
475
name : typeAST . name . value ,
476
476
description : getDescription ( typeAST ) ,
477
477
fields : ( ) => buildFieldMap ( typeAST ) ,
478
- resolveType : cannotExecuteClientSchema ,
478
+ resolveType : cannotExecuteExtendedSchema ,
479
479
} ) ;
480
480
}
481
481
@@ -484,15 +484,15 @@ export function extendSchema(
484
484
name : typeAST . name . value ,
485
485
description : getDescription ( typeAST ) ,
486
486
types : typeAST . types . map ( getObjectTypeFromAST ) ,
487
- resolveType : cannotExecuteClientSchema ,
487
+ resolveType : cannotExecuteExtendedSchema ,
488
488
} ) ;
489
489
}
490
490
491
491
function buildScalarType ( typeAST : ScalarTypeDefinition ) {
492
492
return new GraphQLScalarType ( {
493
493
name : typeAST . name . value ,
494
494
description : getDescription ( typeAST ) ,
495
- serialize : ( ) => null ,
495
+ serialize : id => id ,
496
496
// Note: validation calls the parse functions to determine if a
497
497
// literal value is correct. Returning null would cause use of custom
498
498
// scalars to always fail validation. Returning false causes them to
@@ -543,7 +543,6 @@ export function extendSchema(
543
543
type : buildOutputFieldType ( field . type ) ,
544
544
description : getDescription ( field ) ,
545
545
args : buildInputValues ( field . arguments ) ,
546
- resolve : cannotExecuteClientSchema ,
547
546
} )
548
547
) ;
549
548
}
@@ -588,6 +587,8 @@ export function extendSchema(
588
587
}
589
588
}
590
589
591
- function cannotExecuteClientSchema ( ) {
592
- throw new Error ( 'Client Schema cannot be used for execution.' ) ;
590
+ function cannotExecuteExtendedSchema ( ) {
591
+ throw new Error (
592
+ 'Extended Schema cannot use Interface or Union types for execution.'
593
+ ) ;
593
594
}
0 commit comments