Skip to content

Commit 9873cd0

Browse files
committed
Schema types should be built immediately instead of lazily when get_type_map() is called. This should allow us to raise exceptions upon construction of the schema, instead of later execution.
1 parent f1302a3 commit 9873cd0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

graphql/core/type/schema.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class GraphQLSchema(object):
2727
def __init__(self, query, mutation=None):
2828
self.query = query
2929
self.mutation = mutation
30-
self._type_map = None
30+
self._type_map = self._build_type_map()
3131
self._directives = None
3232

3333
def get_query_type(self):
@@ -37,12 +37,10 @@ def get_mutation_type(self):
3737
return self.mutation
3838

3939
def get_type_map(self):
40-
if self._type_map is None:
41-
self._type_map = self._build_type_map()
4240
return self._type_map
4341

4442
def get_type(self, name):
45-
return self.get_type_map().get(name)
43+
return self._type_map.get(name)
4644

4745
def get_directives(self):
4846
if self._directives is None:

0 commit comments

Comments
 (0)