mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-14 05:36:45 +03:00
Set clientMutationId to be camelCase as defined by the graphql relay specification. Fixed #86
This commit is contained in:
parent
2dbd2e89c3
commit
a0ac884bb2
|
@ -37,7 +37,7 @@ def test_mutation_arguments():
|
||||||
assert 'input' in schema.T(ChangeNumber.arguments)
|
assert 'input' in schema.T(ChangeNumber.arguments)
|
||||||
inner_type = ChangeNumber.input_type
|
inner_type = ChangeNumber.input_type
|
||||||
client_mutation_id_field = inner_type._meta.fields_map[
|
client_mutation_id_field = inner_type._meta.fields_map[
|
||||||
'client_mutation_id']
|
'clientMutationId']
|
||||||
assert issubclass(inner_type, graphene.InputObjectType)
|
assert issubclass(inner_type, graphene.InputObjectType)
|
||||||
assert isinstance(client_mutation_id_field.type, graphene.NonNull)
|
assert isinstance(client_mutation_id_field.type, graphene.NonNull)
|
||||||
assert isinstance(client_mutation_id_field.type.of_type, graphene.String)
|
assert isinstance(client_mutation_id_field.type.of_type, graphene.String)
|
||||||
|
|
|
@ -142,7 +142,7 @@ class Node(six.with_metaclass(NodeMeta, Interface)):
|
||||||
|
|
||||||
|
|
||||||
class MutationInputType(InputObjectType):
|
class MutationInputType(InputObjectType):
|
||||||
client_mutation_id = String(required=True)
|
clientMutationId = String(required=True)
|
||||||
|
|
||||||
|
|
||||||
class RelayMutationMeta(MutationMeta):
|
class RelayMutationMeta(MutationMeta):
|
||||||
|
@ -162,7 +162,7 @@ class RelayMutationMeta(MutationMeta):
|
||||||
|
|
||||||
|
|
||||||
class ClientIDMutation(six.with_metaclass(RelayMutationMeta, Mutation)):
|
class ClientIDMutation(six.with_metaclass(RelayMutationMeta, Mutation)):
|
||||||
client_mutation_id = String(required=True)
|
clientMutationId = String(required=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
@ -171,6 +171,6 @@ class ClientIDMutation(six.with_metaclass(RelayMutationMeta, Mutation)):
|
||||||
def mutate(cls, instance, args, info):
|
def mutate(cls, instance, args, info):
|
||||||
input = args.get('input')
|
input = args.get('input')
|
||||||
payload = cls.mutate_and_get_payload(input, info)
|
payload = cls.mutate_and_get_payload(input, info)
|
||||||
client_mutation_id = input.get('client_mutation_id')
|
client_mutation_id = input.get('clientMutationId') or input.get('client_mutation_id')
|
||||||
setattr(payload, 'client_mutation_id', client_mutation_id)
|
setattr(payload, 'clientMutationId', client_mutation_id)
|
||||||
return payload
|
return payload
|
||||||
|
|
Loading…
Reference in New Issue
Block a user