mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-11 04:07:16 +03:00
Added auto_camelcase checking in Schema/Typemap
This commit is contained in:
parent
aaf7abe831
commit
05d71aac75
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue
Block a user