@@ -40,9 +40,6 @@ function cycleIntrospection(sdlString) {
4040 const clientSchema = buildClientSchema ( initialIntrospection ) ;
4141 const secondIntrospection = introspectionFromSchema ( clientSchema ) ;
4242
43- hackToRemoveStandardTypes ( secondIntrospection ) ;
44- hackToRemoveStandardTypes ( initialIntrospection ) ;
45-
4643 /**
4744 * If the client then runs the introspection query against the client-side
4845 * schema, it should get a result identical to what was returned by the server
@@ -51,14 +48,6 @@ function cycleIntrospection(sdlString) {
5148 return printSchema ( clientSchema ) ;
5249}
5350
54- // Temporary hack to remove always presented standard types should be removed in 15.0
55- function hackToRemoveStandardTypes ( introspection ) {
56- ( introspection . __schema : any ) . types = introspection . __schema . types . filter (
57- ( { name } ) =>
58- [ 'ID' , 'Float' , 'Int' , 'Boolean' , 'String' ] . indexOf ( name ) === - 1 ,
59- ) ;
60- }
61-
6251describe ( 'Type System: build schema from introspection' , ( ) => {
6352 it ( 'builds a simple schema' , ( ) => {
6453 const sdl = dedent `
@@ -138,6 +127,20 @@ describe('Type System: build schema from introspection', () => {
138127 expect ( clientSchema . getType ( 'CustomScalar' ) ) . not . to . equal ( customScalar ) ;
139128 } ) ;
140129
130+ it ( 'include standard type only if it is used' , ( ) => {
131+ const schema = buildSchema ( `
132+ type Query {
133+ foo: String
134+ }
135+ ` ) ;
136+ const introspection = introspectionFromSchema ( schema ) ;
137+ const clientSchema = buildClientSchema ( introspection ) ;
138+
139+ expect ( clientSchema . getType ( 'Int' ) ) . to . equal ( undefined ) ;
140+ expect ( clientSchema . getType ( 'Float' ) ) . to . equal ( undefined ) ;
141+ expect ( clientSchema . getType ( 'ID' ) ) . to . equal ( undefined ) ;
142+ } ) ;
143+
141144 it ( 'builds a schema with a recursive type reference' , ( ) => {
142145 const sdl = dedent `
143146 schema {
@@ -329,10 +332,8 @@ describe('Type System: build schema from introspection', () => {
329332
330333 const introspection = introspectionFromSchema ( schema ) ;
331334 const clientSchema = buildClientSchema ( introspection ) ;
332- const secondIntrospection = introspectionFromSchema ( clientSchema ) ;
333335
334- hackToRemoveStandardTypes ( secondIntrospection ) ;
335- hackToRemoveStandardTypes ( introspection ) ;
336+ const secondIntrospection = introspectionFromSchema ( clientSchema ) ;
336337 expect ( secondIntrospection ) . to . deep . equal ( introspection ) ;
337338
338339 const clientFoodEnum = clientSchema . getType ( 'Food' ) ;
0 commit comments