@@ -40,6 +40,7 @@ import {
40
40
type EnumValueDefinitionNode ,
41
41
type DirectiveDefinitionNode ,
42
42
type ScalarTypeDefinitionNode ,
43
+ type ScalarTypeExtensionNode ,
43
44
} from '../language/ast' ;
44
45
45
46
import { assertValidSDLExtension } from '../validation/validate' ;
@@ -329,9 +330,14 @@ export function extendSchemaImpl(
329
330
function extendScalarType ( type : GraphQLScalarType ) : GraphQLScalarType {
330
331
const config = type . toConfig ( ) ;
331
332
const extensions = typeExtensionsMap [ config . name ] || [ ] ;
333
+ const specifiedBys = [
334
+ config . specifiedBy ,
335
+ ...extensions . map ( getSpecifiedBy ) ,
336
+ ] . filter ( Boolean ) ;
332
337
333
338
return new GraphQLScalarType ( {
334
339
...config ,
340
+ specifiedBy : specifiedBys [ specifiedBys . length - 1 ] ,
335
341
extensionASTNodes : concatMaybeArrays (
336
342
config . extensionASTNodes ,
337
343
extensions ,
@@ -729,7 +735,9 @@ function getDeprecationReason(
729
735
/**
730
736
* Given a scalar node, returns the string value for the specified by.
731
737
*/
732
- function getSpecifiedBy ( node : ScalarTypeDefinitionNode ) : ?string {
738
+ function getSpecifiedBy (
739
+ node : ScalarTypeDefinitionNode | ScalarTypeExtensionNode ,
740
+ ) : ?string {
733
741
const specified = getDirectiveValues ( GraphQLSpecifiedDirective , node ) ;
734
742
return specified && ( specified . by : any ) ;
735
743
}
0 commit comments