def get_deprecation_reason ( node : Union [ EnumValueDefinitionNode , FieldDefinitionNode ] ) -> Optional [ str ] : from . . execution import get_directive_values deprecated = get_directive_values ( GraphQLDeprecatedDirective , node ) return deprecated [ "reason" ] if deprecated else None
python how to mark as deprecated
Given a field or enum value node get deprecation reason as string .
def get_deprecation_reason(
    node: Union[EnumValueDefinitionNode, FieldDefinitionNode]
) -> Optional[str]:
    """Given a field or enum value node, get deprecation reason as string."""
    from ..execution import get_directive_values

    deprecated = get_directive_values(GraphQLDeprecatedDirective, node)
    return deprecated["reason"] if deprecated else None