@@ -39,24 +39,12 @@ def cycle_introspection(sdl_string):
39
39
# it should get a result identical to what was returned by the server
40
40
second_introspection = introspection_from_schema (client_schema )
41
41
42
- hack_to_remove_standard_types (second_introspection )
43
- hack_to_remove_standard_types (initial_introspection )
44
-
45
42
# If the client then runs the introspection query against the client-side
46
43
# schema, it should get a result identical to what was returned by the server.
47
44
assert initial_introspection == second_introspection
48
45
return print_schema (client_schema )
49
46
50
47
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
-
60
48
def describe_type_system_build_schema_from_introspection ():
61
49
def builds_a_simple_schema ():
62
50
sdl = dedent (
@@ -139,6 +127,21 @@ def uses_built_in_scalars_when_possible():
139
127
custom_scalar = schema .get_type ("CustomScalar" )
140
128
assert client_schema .get_type ("CustomScalar" ) is not custom_scalar
141
129
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
+
142
145
def builds_a_schema_with_a_recursive_type_reference ():
143
146
sdl = dedent (
144
147
"""
@@ -325,10 +328,8 @@ def builds_a_schema_with_an_enum():
325
328
326
329
introspection = introspection_from_schema (schema )
327
330
client_schema = build_client_schema (introspection )
328
- second_introspection = introspection_from_schema (client_schema )
329
331
330
- hack_to_remove_standard_types (second_introspection )
331
- hack_to_remove_standard_types (introspection )
332
+ second_introspection = introspection_from_schema (client_schema )
332
333
assert second_introspection == introspection
333
334
334
335
client_food_enum = client_schema .get_type ("Food" )
0 commit comments