Skip to content

Commit f114784

Browse files
committed
Preserve deprecation_reason on GraphQLInputFields
This was already fine, we only added the test. Replicates graphql/graphql-js@2df59f1
1 parent 3f40fc2 commit f114784

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/type/test_definition.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,6 +1690,23 @@ def rejects_an_input_field_with_an_incorrect_ast_node():
16901690
msg = str(exc_info.value)
16911691
assert msg == "Input field AST node must be an InputValueDefinitionNode."
16921692

1693+
def deprecation_reason_is_preserved_on_fields():
1694+
input_obj_type = GraphQLInputObjectType(
1695+
"someInputObject",
1696+
{
1697+
"deprecatedField": GraphQLInputField(
1698+
ScalarType, deprecation_reason="not used anymore"
1699+
)
1700+
},
1701+
)
1702+
deprecated_field = input_obj_type.fields["deprecatedField"]
1703+
assert (
1704+
input_obj_type.to_kwargs()["fields"]["deprecatedField"] is deprecated_field
1705+
)
1706+
deprecation_reason = deprecated_field.deprecation_reason
1707+
assert deprecation_reason == "not used anymore"
1708+
assert deprecated_field.to_kwargs()["deprecation_reason"] is deprecation_reason
1709+
16931710

16941711
def describe_type_system_list():
16951712
types = [

0 commit comments

Comments
 (0)