I can't upload a file

I am writing an application in django, drf, I use drf_spectacular for documentation, the problem is downloading the file through the documentation, I do not need to process the file or store it, I just want to upload it and send it to another service.

class PFX_key(serializers.Serializer):
    file = serializers.FileField()
    pin = serializers.IntegerField(required=False)
    description = serializers.CharField(required=False)
    @action(detail=False, methods=['post'], parser_classes=[MultiPartParser,], serializer_class=serializers.PFX_key)
    def load_pfx_key(self, request: Request) -> Response:
        serializer = self.serializer_class(data=request.data)
            datatools.send_pfx_key(serializer.validated_data, self.request.user.username)
        except Exception as ex:
            raise ex
        return Response()

The logic is fully working, all I need is the ability to upload files via drf_spectacular so that the fronts can work with it.

I've tried adding different parameters, one of them even seems to fit the needs: OpenApiTypes.BINARY, but I get an error

Please correct the following validation errors and try again.

For 'file': Value must be a string.

Back to Top