<commit_before>from rest_framework.decorators import api_view
from rest_framework.response import Response

from .utils import absolute_reverse

@api_view(('GET',))
def root(request, format=None):

    if request.user and not request.user.is_anonymous():
        user = request.user
        # TODO: Use user serializer
        current_user = {
            'id': user.pk,
            'fullname': user.fullname,
        }
    else:
        current_user = None
    return Response({
        'message': 'Welcome to the OSF API v2',
        'current_user': current_user,
        'links': {
            'nodes': absolute_reverse('nodes:node-list'),
            'users': absolute_reverse('users:user-list'),
        }
    })<commit_msg>Use UserSerializer to serialize current user in the root response<commit_after>from rest_framework.decorators import api_view
from rest_framework.response import Response

from .utils import absolute_reverse
from api.users.serializers import UserSerializer

@api_view(('GET',))
def root(request, format=None):

    if request.user and not request.user.is_anonymous():
        user = request.user
        # TODO: Use user serializer
        current_user = UserSerializer(user).data
    else:
        current_user = None
    return Response({
        'meta': {
            'message': 'Welcome to the OSF API v2',
            'current_user': current_user,
        },
        'links': {
            'nodes': absolute_reverse('nodes:node-list'),
            'users': absolute_reverse('users:user-list'),
        }
    })
{'fraction_non_alphanumeric': 0.10686528497409327, 'fraction_numerical': 0.0012953367875647669, 'mean_word_length': 2.652482269503546, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2593225', 'n_tokens_mistral': 428, 'n_tokens_neox': 423, 'n_words': 113}