@@ -39,24 +39,12 @@ def cycle_introspection(sdl_string):
3939 # it should get a result identical to what was returned by the server
4040 second_introspection = introspection_from_schema (client_schema )
4141
42- hack_to_remove_standard_types (second_introspection )
43- hack_to_remove_standard_types (initial_introspection )
44-
4542 # If the client then runs the introspection query against the client-side
4643 # schema, it should get a result identical to what was returned by the server.
4744 assert initial_introspection == second_introspection
4845 return print_schema (client_schema )
4946
5047
51- # Temporary hack to remove always presented standard types - should be removed in 15.0
52- def hack_to_remove_standard_types (introspection ):
53- introspection ["__schema" ]["types" ] = [
54- type_
55- for type_ in introspection ["__schema" ]["types" ]
56- if type_ ["name" ] not in ("ID" , "Float" , "Int" , "Boolean" , "String" )
57- ]
58-
59-
6048def describe_type_system_build_schema_from_introspection ():
6149 def builds_a_simple_schema ():
6250 sdl = dedent (
@@ -139,6 +127,21 @@ def uses_built_in_scalars_when_possible():
139127 custom_scalar = schema .get_type ("CustomScalar" )
140128 assert client_schema .get_type ("CustomScalar" ) is not custom_scalar
141129
130+ def include_standard_type_only_if_it_is_used ():
131+ schema = build_schema (
132+ """
133+ type Query {
134+ foo: String
135+ }
136+ """
137+ )
138+ introspection = introspection_from_schema (schema )
139+ client_schema = build_client_schema (introspection )
140+
141+ assert client_schema .get_type ("Int" ) is None
142+ assert client_schema .get_type ("Float" ) is None
143+ assert client_schema .get_type ("ID" ) is None
144+
142145 def builds_a_schema_with_a_recursive_type_reference ():
143146 sdl = dedent (
144147 """
@@ -325,10 +328,8 @@ def builds_a_schema_with_an_enum():
325328
326329 introspection = introspection_from_schema (schema )
327330 client_schema = build_client_schema (introspection )
328- second_introspection = introspection_from_schema (client_schema )
329331
330- hack_to_remove_standard_types (second_introspection )
331- hack_to_remove_standard_types (introspection )
332+ second_introspection = introspection_from_schema (client_schema )
332333 assert second_introspection == introspection
333334
334335 client_food_enum = client_schema .get_type ("Food" )
0 commit comments