@@ -40,9 +40,6 @@ function cycleIntrospection(sdlString) {
40
40
const clientSchema = buildClientSchema ( initialIntrospection ) ;
41
41
const secondIntrospection = introspectionFromSchema ( clientSchema ) ;
42
42
43
- hackToRemoveStandardTypes ( secondIntrospection ) ;
44
- hackToRemoveStandardTypes ( initialIntrospection ) ;
45
-
46
43
/**
47
44
* If the client then runs the introspection query against the client-side
48
45
* schema, it should get a result identical to what was returned by the server
@@ -51,14 +48,6 @@ function cycleIntrospection(sdlString) {
51
48
return printSchema ( clientSchema ) ;
52
49
}
53
50
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
-
62
51
describe ( 'Type System: build schema from introspection' , ( ) => {
63
52
it ( 'builds a simple schema' , ( ) => {
64
53
const sdl = dedent `
@@ -138,6 +127,20 @@ describe('Type System: build schema from introspection', () => {
138
127
expect ( clientSchema . getType ( 'CustomScalar' ) ) . not . to . equal ( customScalar ) ;
139
128
} ) ;
140
129
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
+
141
144
it ( 'builds a schema with a recursive type reference' , ( ) => {
142
145
const sdl = dedent `
143
146
schema {
@@ -329,10 +332,8 @@ describe('Type System: build schema from introspection', () => {
329
332
330
333
const introspection = introspectionFromSchema ( schema ) ;
331
334
const clientSchema = buildClientSchema ( introspection ) ;
332
- const secondIntrospection = introspectionFromSchema ( clientSchema ) ;
333
335
334
- hackToRemoveStandardTypes ( secondIntrospection ) ;
335
- hackToRemoveStandardTypes ( introspection ) ;
336
+ const secondIntrospection = introspectionFromSchema ( clientSchema ) ;
336
337
expect ( secondIntrospection ) . to . deep . equal ( introspection ) ;
337
338
338
339
const clientFoodEnum = clientSchema . getType ( 'Food' ) ;
0 commit comments