core-next now provides out_type and out_name

This commit is contained in:
Christoph Zwerschke 2019-06-30 21:31:49 +02:00 committed by Mel van Londen
parent 5991c6efca
commit d259bf6113
3 changed files with 12 additions and 20 deletions

View File

@ -296,8 +296,7 @@ class GrapheneGraphQLSchema(GraphQLSchema):
graphene_type=type_,
name=type_._meta.name,
description=type_._meta.description,
# TODO: container_type not supported by core-next (is this needed?)
# container_type=type_._meta.container,
out_type=type_._meta.container,
fields=partial(
self.construct_fields_for_type, map_, type_, is_input_type=True
),
@ -345,8 +344,7 @@ class GrapheneGraphQLSchema(GraphQLSchema):
_field = GraphQLInputField(
field_type,
default_value=field.default_value,
# TODO: out_name not (yet) supported by core-next
# out_name=name,
out_name=name,
description=field.description,
)
else:
@ -357,8 +355,7 @@ class GrapheneGraphQLSchema(GraphQLSchema):
processed_arg_name = arg.name or self.get_name(arg_name)
args[processed_arg_name] = GraphQLArgument(
arg_type,
# TODO: out_name not (yet) supported by core-next
# out_name=arg_name,
out_name=arg_name,
description=arg.description,
default_value=INVALID
if isinstance(arg.type, NonNull)

View File

@ -105,7 +105,6 @@ def test_generate_inputobjecttype_inherit_abstracttype_reversed():
]
# TOOD: I think this fails because container_type is not supported in core-next
def test_inputobjecttype_of_input():
class Child(InputObjectType):
first_name = String()
@ -134,5 +133,6 @@ def test_inputobjecttype_of_input():
}
"""
)
assert not result.errors
assert result.data == {"isChild": True}

View File

@ -90,8 +90,7 @@ def test_objecttype():
GraphQLString,
description="Argument description",
default_value="x",
# TODO: out_name not (yet) supported by core-next
# out_name="bar",
out_name="bar",
)
}
@ -148,8 +147,7 @@ def test_interface():
GraphQLString,
description="Argument description",
default_value="x",
# TODO: out_name not (yet) supported by core-next
# out_name="bar",
out_name="bar",
)
}
@ -182,15 +180,14 @@ def test_inputobject():
other_graphql_type = type_map["OtherObjectType"]
inner_graphql_type = type_map["MyInnerObjectType"]
# TODO: create_container not supported by core-next
container = graphql_type.create_container(
container = graphql_type.out_type(
{
"bar": "oh!",
"baz": inner_graphql_type.create_container(
"baz": inner_graphql_type.out_type(
{
"some_other_field": [
other_graphql_type.create_container({"thingy": 1}),
other_graphql_type.create_container({"thingy": 2}),
other_graphql_type.out_type({"thingy": 1}),
other_graphql_type.out_type({"thingy": 2}),
]
}
),
@ -235,8 +232,7 @@ def test_objecttype_camelcase():
"barFoo": GraphQLArgument(
GraphQLString,
default_value=None,
# TODO: out_name not (yet) supported by core-next
# out_name="bar_foo"
out_name="bar_foo"
)
}
@ -262,8 +258,7 @@ def test_objecttype_camelcase_disabled():
"bar_foo": GraphQLArgument(
GraphQLString,
default_value=None,
# TODO: out_name not (yet) supported by core-next
# out_name="bar_foo"
out_name="bar_foo"
)
}