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_, graphene_type=type_,
name=type_._meta.name, name=type_._meta.name,
description=type_._meta.description, description=type_._meta.description,
# TODO: container_type not supported by core-next (is this needed?) out_type=type_._meta.container,
# container_type=type_._meta.container,
fields=partial( fields=partial(
self.construct_fields_for_type, map_, type_, is_input_type=True self.construct_fields_for_type, map_, type_, is_input_type=True
), ),
@ -345,8 +344,7 @@ class GrapheneGraphQLSchema(GraphQLSchema):
_field = GraphQLInputField( _field = GraphQLInputField(
field_type, field_type,
default_value=field.default_value, default_value=field.default_value,
# TODO: out_name not (yet) supported by core-next out_name=name,
# out_name=name,
description=field.description, description=field.description,
) )
else: else:
@ -357,8 +355,7 @@ class GrapheneGraphQLSchema(GraphQLSchema):
processed_arg_name = arg.name or self.get_name(arg_name) processed_arg_name = arg.name or self.get_name(arg_name)
args[processed_arg_name] = GraphQLArgument( args[processed_arg_name] = GraphQLArgument(
arg_type, arg_type,
# TODO: out_name not (yet) supported by core-next out_name=arg_name,
# out_name=arg_name,
description=arg.description, description=arg.description,
default_value=INVALID default_value=INVALID
if isinstance(arg.type, NonNull) 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(): def test_inputobjecttype_of_input():
class Child(InputObjectType): class Child(InputObjectType):
first_name = String() first_name = String()
@ -134,5 +133,6 @@ def test_inputobjecttype_of_input():
} }
""" """
) )
assert not result.errors assert not result.errors
assert result.data == {"isChild": True} assert result.data == {"isChild": True}

View File

@ -90,8 +90,7 @@ def test_objecttype():
GraphQLString, GraphQLString,
description="Argument description", description="Argument description",
default_value="x", 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, GraphQLString,
description="Argument description", description="Argument description",
default_value="x", 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"] other_graphql_type = type_map["OtherObjectType"]
inner_graphql_type = type_map["MyInnerObjectType"] inner_graphql_type = type_map["MyInnerObjectType"]
# TODO: create_container not supported by core-next container = graphql_type.out_type(
container = graphql_type.create_container(
{ {
"bar": "oh!", "bar": "oh!",
"baz": inner_graphql_type.create_container( "baz": inner_graphql_type.out_type(
{ {
"some_other_field": [ "some_other_field": [
other_graphql_type.create_container({"thingy": 1}), other_graphql_type.out_type({"thingy": 1}),
other_graphql_type.create_container({"thingy": 2}), other_graphql_type.out_type({"thingy": 2}),
] ]
} }
), ),
@ -235,8 +232,7 @@ def test_objecttype_camelcase():
"barFoo": GraphQLArgument( "barFoo": GraphQLArgument(
GraphQLString, GraphQLString,
default_value=None, 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( "bar_foo": GraphQLArgument(
GraphQLString, GraphQLString,
default_value=None, default_value=None,
# TODO: out_name not (yet) supported by core-next out_name="bar_foo"
# out_name="bar_foo"
) )
} }