django-rest-swagger can't seem to work for me. I can't get it to document anything beyond a title

Viewed 3935

It seems like django-rest-swagger dropped support for the YAML documentation, and replaced it with a vague non-documented way to do things. I've spent the last 48 hours trying to understand how I can have it document the parameters that go into my post methods.

For instance: I have this:

class user_addresses(APIView):
    """
    get all addresses or post a new one
    """
    authentication_classes = ([JSONWebTokenAuthentication])

    def get(self, request, format=None):
        addresses = Address.objects.filter(owner_id=request.user.id)
        print (addresses)
        serializer = address_serializer(addresses, many=True)
        return Response(serializer.data)

    def post(self, request, format=None):
        serializer = address_serializer(data=request.data)
        if serializer.is_valid():
            serializer.save()
            return Response({'success': True,
                            'result': serializer.validated_data},
                            status=status.HTTP_201_CREATED)
        return Response({'success': False,
                        'result': serializer.errors},
                        status=status.HTTP_400_BAD_REQUEST)

But the django-rest-swagger will show it as:

All the parameters ignored and there's nothing I can add to it besides the title in my code comment.

Can someone point me in the direction of something that works where I can define all the rich data that swagger allows, like the post field names, if they're mandatory or not. etc. i'm just going crazy here running in circle and can't find anything but complaints that there's no way to do this.

2 Answers
Related