You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from my_serializers import PasswordSerializer
from rest_framework_docs.utils import func_serializer
class UserViewSet(viewsets.ViewSet):
@func_serializer(serializer_class=PasswordSerializer)
@detail_route(methods=['post'])
def set_password(self, request, pk=None):
serializer = PasswordSerializer(data=request.data)
I wonder if you are keen on extending your library with something like this? I think it's a handy feature.
The downside of this is that we have to change application code to support documentation generation. Another approach is to use docstring, something like
We can allow setting the regex pattern to grep for this in the docstring. To get the module from the above docstring, the regex pattern is r'(?<=\:serializer\:\s)(.+)(?=\b)'
I've implemented something like this on my fork
I wonder if you are keen on extending your library with something like this? I think it's a handy feature.
The downside of this is that we have to change application code to support documentation generation. Another approach is to use docstring, something like
I think I like the first approach better.
The text was updated successfully, but these errors were encountered: