<https://lh3.googleusercontent.com/-g6KhCvvZz7Y/WhvGqks0q_I/AAAAAAAATGE/XSgZiXWIEi8fSr08M1EiWleQew5zYL5zwCLcBGAs/s1600/Screen%2BShot%2B2017-11-27%2Bat%2B12.02.24%2BAM.png> Hi friends,
Did anyone happen to know how to specify parameters (e.g. name, description, type, etc) for API endpoint in auto generated documentation? The "Documenting your views" section in the documentation (http://www.django-rest-framework.org/topics/documenting-your-api/#documenting-your-views) is very vague. It does not explain to how to document parameters for a class-based API view. Suppose I have a view like this: # users class UserView(APIView): @staticmethod def get(request): """ List users """ users = User.objects.all() return Response(UserSerializer(users, many=True).data) @staticmethod def post(request): serializer = UserSerializerCreate(data=request.data, context={'request': request}) if serializer.is_valid(): user = serializer.save() user.set_password(serializer.validated_data['password']) user.save() Profile(user=user).save() return Response(UserSerializer(user).data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) The post method requires a parameter called "password", which should be a string. I followed the tutorial in this section http://www.django-rest-framework.org/topics/documenting-your-api/#installation and set up the schema view. Obviously, the auto generated scheme does not include the parameter "password": <https://lh3.googleusercontent.com/-g6KhCvvZz7Y/WhvGqks0q_I/AAAAAAAATGE/XSgZiXWIEi8fSr08M1EiWleQew5zYL5zwCLcBGAs/s1600/Screen%2BShot%2B2017-11-27%2Bat%2B12.02.24%2BAM.png> I wonder if there is any way to specify the parameters for each API endpoint. I have been googling this for hours. All I found are workarounds, instead of official solution. -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
