Questions tagged [django-rest-swagger]

44 questions
18
votes
8 answers

django_rest_swagger - 'staticfiles' is not a registered tag library. Must be one of:

Have this error while trying to autogenerate API docs for django rest framework in django 2.2.4, from what I'm seeing in the logs it has something to do with the deprectation of the {% load staticfiles %} templateSyntaxError at / 'staticfiles'…
Lucas
  • 181
  • 1
  • 1
  • 6
14
votes
2 answers

Django swagger- How to disable DjangoFilterBackend query filters from delete, put methods?

I've created an AssetsFilter class: from django_filters import Filter from django_filters import rest_framework as filters from django_filters.fields import Lookup from .models import Assets class MyListFilter(Filter): def filter(self, qs,…
12
votes
6 answers

How can I create a partial search filter in Django REST framework?

I'm working with the Django REST framework library and I am trying to make a filter that can filter by first_name, last_name, or by both of them. This is my ContactViewSet.py: class ContactViewSet(viewsets.ModelViewSet): queryset =…
Naella
  • 425
  • 2
  • 6
  • 17
8
votes
1 answer

Json schema django rest framework, describe json field as json and not as string

I have an Api in DRF, describes with swagger. In my serializer i have a field like that : settings = serializers.DictField(child=serializers.JSONField()) Is it possible that in the swagger.json the field was describe as 'Json' and not as…
8
votes
1 answer

How to override get_swagger_view to enable django-rest-swagger to display all endpoints?

By default django-rest-swagger displays my views which do not require authentication(JWT Auth in this case). I tried to override the default get_swagger_view shortcut by adding IsAuthenticated in the permission classes to include the views which…
Rahul
  • 115
  • 10
8
votes
0 answers

Edit parameter description for Django REST swagger and other issues

I. I'm new to using Django REST Swagger for API documentation. I'm trying to understand how to edit a) 'Implementation Notes' and b) parameter descriptions. Image below - Here's my viewset for the 'Crash' model. class…
6
votes
4 answers

Django - ImportError: Could not import 'drf_yasg.generators.OpenAPISchemaGenerator' for API setting

I'm trying to add https://github.com/axnsan12/drf-yasg this library to our django application and getting the below error. permission_classes=(permissions.AllowAny,), File "/env/lib/python3.7/site-packages/drf_yasg/views.py", line 67, in…
Krishnadas PC
  • 5,981
  • 2
  • 53
  • 54
6
votes
5 answers

Django REST Swagger HTTPS requests

How configure django-rest-swagger to get a HTTPS requests? upd: SSL cert is present and ALL app working with it, but swagger make a http requests.
5
votes
3 answers

Django rest swagger document shows choose file as string

I am creating simple swagger documentation with django rest framework, django rest swagger. Python: 3.6 Django: 3.0.3 django-rest-swagger: 2.2.0 djangorestframework: 3.11.0 Here is Models.py class Image(models.Model): file =…
Softdev
  • 67
  • 8
5
votes
2 answers

Defining different schema for both get and post request - AutoSchema Django Rest Framework

I am trying to define AutoSchema (to be shown in django rest framework swagger) for my REST API in Django REST framework. There's this class that extends APIView. The class has both 'get' and 'post' methods. Like: class…
5
votes
2 answers

how to pass post parameter in Django rest swagger?

I have integrated swagger with django rest framework, but the swagger docs does not create a input box to post data for post request. I am using Function based views with decorator(@api_view) @api_view(['GET','POST']) @permission_classes((AllowAny,…
5
votes
1 answer

Render enums as dropdown in django-rest-swagger

I am trying to get the right query parameters shown in the swagger documentation produced by django-rest-swagger from rest_framework.filters import BaseFilterBackend from rest_framework.compat import coreapi, coreschema from django.utils.encoding…
blueFast
  • 41,341
  • 63
  • 198
  • 344
5
votes
2 answers

To add GET parameters in Swagger

Use django rest framework and django-rest-swagger in documentation of the methods it is not showing available GET parameters and the question is how can I set? code: # views.py @api_view(['GET']) def tests_api(request): """ :param request: …
5
votes
2 answers

Django Swagger and JSON API render issues

Using django-rest-framework-json-api I am able to create API end points that work as described within the documentation. Attempted to provide API documentation using django-rest-swagger is not so easy. 1: Swagger uses media_type =…
oden
  • 3,461
  • 1
  • 31
  • 33
4
votes
1 answer

Swagger Django [No operations defined in spec]

I have been trying to integrate Swagger with Django Application and encounter this error: No operations defined in spec! My project structure is App views.py urls.py .. App2 settings.py urls.py .. I am using drf_yasg for…
1
2 3