By default, django rest swagger doesn't displayed the Serializer in DELETE method. But, for some reason I need to implement prevent deletion & force deletion case.
So, basicly to implement it, we need to add e.g this example inside the request body:
{
"forceDelete": true
}
I'm trying to update the serializer inside get_serializer_class function, but it still doesn't work properly.
class ForceDeleteSerializer(serializers.Serializer):
force_delete = serializers.BooleanField(default=False)
class GroupViewSet(ModelViewSet):
permission_classes = (IsOrganizationAdmin,)
serializer_class = GroupSerializer
search_fields = ('display_name',)
def get_serializer_class(self):
if self.action == 'destroy':
return ForceDeleteSerializer
return self.serializer_class

Finally, as suggested by @LinhNguyen to use
drf-yasg, and usingswagger_auto_schemait worked.