Added auto_camelcase checking in Schema/Typemap

This commit is contained in:
Syrus Akbary 2016-09-08 22:50:23 -07:00
parent aaf7abe831
commit 05d71aac75
2 changed files with 9 additions and 2 deletions

View File

@ -19,12 +19,14 @@ class Schema(GraphQLSchema):
'''
def __init__(self, query=None, mutation=None, subscription=None,
directives=None, types=None, executor=None, middlewares=None):
directives=None, types=None, executor=None, middlewares=None,
auto_camelcase=True):
self._query = query
self._mutation = mutation
self._subscription = subscription
self.types = types
self._executor = executor
self.auto_camelcase = auto_camelcase
if directives is None:
directives = [
GraphQLIncludeDirective,
@ -97,4 +99,4 @@ class Schema(GraphQLSchema):
]
if self.types:
initial_types += self.types
self._type_map = TypeMap(initial_types)
self._type_map = TypeMap(initial_types, auto_camelcase=self.auto_camelcase)

View File

@ -40,6 +40,11 @@ def resolve_type(resolve_type_func, map, root, args, info):
class TypeMap(GraphQLTypeMap):
def __init__(self, types, auto_camelcase=True):
if not auto_camelcase:
raise Exception("Disabling auto_camelcase is not *yet* supported, but will be soon!")
super(TypeMap, self).__init__(types)
@classmethod
def reducer(cls, map, type):
if not type: