Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

289
Vistas
DRF 3.6: How to document input parameters in APIView (for automatic doc generation)?

I'm struggling with DRF 3.6 auto-generated interactive documentation to provide input parameters to fill in interactive mode.

As a result, I get an empty windows for my POST request (which would require 3 parameters actually):

enter image description here

With Swagger, I could do it directly in docstring with some YAML. Now, after browsing DRF documentation, I can't find the way to do it.

class ActivateCustomerView(APIView):

    permission_classes = (AllowAny,)

    def post(self, request):
        """ View dedicated to activating a pre-recorded customer 
            # Should I add some parameters here?
        """

        serializer = ActivateCustomerSerializer(data=request.data)
        serializer.is_valid(raise_exception=True)
        # ...
about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

I Got the answer from Tom Christie:

serializer_class by itself isn't enough - the view needs to implement get_serializer, see: https://github.com/encode/django-rest-framework/blob/master/rest_framework/schemas.py#L570

So in My case, adding this works well:

def get_serializer(self):
    return ActivateCustomerSerializer()
about 4 years ago · Santiago Trujillo Denunciar

0

EDIT: I forgot to answer regarding the input parameters. I believe that would be based on the serializer. Have you tried specifying your serializer_class?

With DRF's inbuilt documentation generator, you'd want to put your docstrings on the class level and include the request method as such:

class ActivateCustomerView(APIView):
    """
    post:
    View dedicated to activating a pre-recorded customer 
    # Should I add some parameters here?

    # if you have a get request
    get:
    # your docs for the get handler
    """

    permission_classes = (AllowAny,)

    def post(self, request):

        serializer = ActivateCustomerSerializer(data=request.data)
        serializer.is_valid(raise_exception=True)
        # ...
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda