Skip to content

Commit d1ffaef

Browse files
committed
Preserve deprecation_reason on GraphQLInputFields
Backport from 3.2 branch. This was already fine, we only added the test. Replicates graphql/graphql-js@1293dfa
1 parent 8832f5d commit d1ffaef

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/type/test_definition.py

+17
Original file line numberDiff line numberDiff line change
@@ -1730,6 +1730,23 @@ def rejects_an_input_field_with_an_incorrect_ast_node():
17301730
msg = str(exc_info.value)
17311731
assert msg == "Input field AST node must be an InputValueDefinitionNode."
17321732

1733+
def deprecation_reason_is_preserved_on_fields():
1734+
input_obj_type = GraphQLInputObjectType(
1735+
"someInputObject",
1736+
{
1737+
"deprecatedField": GraphQLInputField(
1738+
ScalarType, deprecation_reason="not used anymore"
1739+
)
1740+
},
1741+
)
1742+
deprecated_field = input_obj_type.fields["deprecatedField"]
1743+
assert (
1744+
input_obj_type.to_kwargs()["fields"]["deprecatedField"] is deprecated_field
1745+
)
1746+
deprecation_reason = deprecated_field.deprecation_reason
1747+
assert deprecation_reason == "not used anymore"
1748+
assert deprecated_field.to_kwargs()["deprecation_reason"] is deprecation_reason
1749+
17331750

17341751
def describe_type_system_list():
17351752
types = [

0 commit comments

Comments
 (0)