Skip to content

The default_value of InputField should be INVALID #1111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
input IntroduceShipInput {
shipName: String!
factionId: String!
clientMutationId: String = null
clientMutationId: String
}

type IntroduceShipPayload {
Expand Down
4 changes: 2 additions & 2 deletions graphene/relay/tests/test_mutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ class Input(SharedFields):

@staticmethod
def mutate_and_get_payload(
self, info, shared, additional_field, client_mutation_id=None
self, info, shared="", additional_field="", client_mutation_id=None
):
edge_type = MyEdge
return OtherMutation(
name=(shared or "") + (additional_field or ""),
name=shared + additional_field,
my_node_edge=edge_type(cursor="1", node=MyNode(name="name")),
)

Expand Down
3 changes: 2 additions & 1 deletion graphene/types/inputfield.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from graphql import Undefined
from .mountedtype import MountedType
from .structures import NonNull
from .utils import get_type
Expand Down Expand Up @@ -48,7 +49,7 @@ def __init__(
self,
type,
name=None,
default_value=None,
default_value=Undefined,
deprecation_reason=None,
description=None,
required=False,
Expand Down
9 changes: 3 additions & 6 deletions graphene/types/tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,17 +262,14 @@ def resolve_test(self, info, **args):

result = test_schema.execute('{ test(aInput: {aField: "String!"} ) }', "Source!")
assert not result.errors
assert result.data == {
"test": '["Source!",{"a_input":{"a_field":"String!","recursive_field":null}}]'
}
assert result.data == {"test": '["Source!",{"a_input":{"a_field":"String!"}}]'}

result = test_schema.execute(
'{ test(aInput: {recursiveField: {aField: "String!"}}) }', "Source!"
)
assert not result.errors
assert result.data == {
"test": '["Source!",{"a_input":{"a_field":null,"recursive_field":'
'{"a_field":"String!","recursive_field":null}}}]'
"test": '["Source!",{"a_input":{"recursive_field":{"a_field":"String!"}}}]'
}


Expand Down Expand Up @@ -408,7 +405,7 @@ def resolve_all_containers(self, info):


def test_big_list_of_containers_multiple_fields_custom_resolvers_query_benchmark(
benchmark
benchmark,
):
class Container(ObjectType):
x = Int()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def run_tests(self):
keywords="api graphql protocol rest relay graphene",
packages=find_packages(exclude=["tests", "tests.*", "examples"]),
install_requires=[
"graphql-core>=3.0.0,<4",
"graphql-core>=3.0.3,<4",
"graphql-relay>=3.0.0,<4",
"aniso8601>=6,<9",
],
Expand Down
4 changes: 2 additions & 2 deletions tests_asyncio/test_relay_mutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class Input(SharedFields):

@staticmethod
def mutate_and_get_payload(
self, info, shared, additional_field, client_mutation_id=None
self, info, shared="", additional_field="", client_mutation_id=None
):
edge_type = MyEdge
return OtherMutation(
name=(shared or "") + (additional_field or ""),
name=shared + additional_field,
my_node_edge=edge_type(cursor="1", node=MyNode(name="name")),
)

Expand Down