mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-11-04 18:07:48 +03:00 
			
		
		
		
	Fixed argument types
This commit is contained in:
		
							parent
							
								
									41648b5a94
								
							
						
					
					
						commit
						862fa6f312
					
				| 
						 | 
					@ -59,7 +59,7 @@ class MirroredType(OrderedType):
 | 
				
			||||||
class ArgumentType(MirroredType):
 | 
					class ArgumentType(MirroredType):
 | 
				
			||||||
    def as_argument(self):
 | 
					    def as_argument(self):
 | 
				
			||||||
        from .argument import Argument
 | 
					        from .argument import Argument
 | 
				
			||||||
        return Argument(self.__class__, _creation_counter=self.creation_counter, *self.args, **self.kwargs)
 | 
					        return Argument(self, _creation_counter=self.creation_counter, *self.args, **self.kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class FieldType(MirroredType):
 | 
					class FieldType(MirroredType):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,15 +1,24 @@
 | 
				
			||||||
import six
 | 
					import six
 | 
				
			||||||
from collections import OrderedDict
 | 
					from collections import OrderedDict
 | 
				
			||||||
 | 
					from functools import wraps
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from graphql.core.type import GraphQLField, GraphQLInputObjectField
 | 
					from graphql.core.type import GraphQLField, GraphQLInputObjectField
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from .base import LazyType, OrderedType
 | 
					from .base import LazyType, OrderedType
 | 
				
			||||||
from .argument import ArgumentsGroup
 | 
					from .argument import ArgumentsGroup
 | 
				
			||||||
from .definitions import NonNull
 | 
					from .definitions import NonNull
 | 
				
			||||||
from ...utils import to_camel_case
 | 
					from ...utils import to_camel_case, ProxySnakeDict
 | 
				
			||||||
from ..types import BaseObjectType, InputObjectType
 | 
					from ..types import BaseObjectType, InputObjectType
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def make_args_snake_case(resolver):
 | 
				
			||||||
 | 
					    @wraps(resolver)
 | 
				
			||||||
 | 
					    def wrapped_resolver(instance, args, info):
 | 
				
			||||||
 | 
					        return resolver(instance, ProxySnakeDict(args), info)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return wrapped_resolver
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Empty(object):
 | 
					class Empty(object):
 | 
				
			||||||
    pass
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -72,6 +81,7 @@ class Field(OrderedType):
 | 
				
			||||||
            arguments = type_objecttype.get_arguments()
 | 
					            arguments = type_objecttype.get_arguments()
 | 
				
			||||||
            resolver = getattr(type_objecttype, 'mutate')
 | 
					            resolver = getattr(type_objecttype, 'mutate')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        resolver = make_args_snake_case(resolver)
 | 
				
			||||||
        assert type, 'Internal type for field %s is None' % str(self)
 | 
					        assert type, 'Internal type for field %s is None' % str(self)
 | 
				
			||||||
        return GraphQLField(type, args=schema.T(arguments), resolver=resolver,
 | 
					        return GraphQLField(type, args=schema.T(arguments), resolver=resolver,
 | 
				
			||||||
                            description=description,)
 | 
					                            description=description,)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user