Questions tagged [django-swagger]

39 questions
28
votes
2 answers

Django rest APIs, automate documentation?

I tried documenting the APIs while writing viewsets and using django rest docs. I am having the following problems: if I try to send values for reverse related field, it takes list of values, but when sending the data in Form-data, it comes as a…
26
votes
1 answer

How to generate list of response messages in Django REST Swagger?

I have upgraded Django REST Framework to 3.5.0 yesterday because I need nice schema generation. I am using Django REST Swagger to document my API but don't know how to list all possible response messages that an API endpoint provides. It seems that…
Erika
  • 905
  • 1
  • 8
  • 15
23
votes
3 answers

Django REST Framework + Django REST Swagger + ImageField

I created a simple Model with an ImageField and I wanna make an api view with django-rest-framework + django-rest-swagger, that is documented and is able to upload the file. Here is what I got: models.py from django.utils import timezone from…
jarussi
  • 1,491
  • 1
  • 13
  • 25
18
votes
3 answers

Django Rest Framework: How to enable swagger docs for function based views

I went through Django REST Swagger 2.1.2 documentation. When I tried with class based views, it was working fine. But i did not find any reference on how to enable swagger for function based views as shown below: @api_view(['GET', 'POST']) def…
Abijith Mg
  • 2,647
  • 21
  • 35
8
votes
1 answer

Why Django Swagger is not showing docs for urls that has permissions IsAuthenticated?

In my api default permmision class is 'rest_framework.permissions.IsAuthenticated' and django swagger is not showing docs for any url. My REST_FRAMEWORK settings is: REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES':…
Deepak
  • 121
  • 5
8
votes
1 answer

Where does Django REST Swagger generate a schema file?

I want to modify the Swagger documentation generated by Django REST Swagger. I'd like to find the API definition or schema file(s) that Django REST Swagger generates. I haven't been able to find those files. Is there something like a YAML or JSON…
pdesjardins
  • 106
  • 4
6
votes
1 answer

Django REST Swagger: How to use security section in Swagger settings?

I'm trying to build the Swagger settings for SecurityDefinition in order to get the following result in openapi.json: "securityDefinitions": { "password": { "type": "oauth2", "tokenUrl": "http://example.com/oauth/token", "flow":…
Dimitris Makris
  • 461
  • 5
  • 16
5
votes
1 answer

Django OAuth Toolkit and Django Rest Swagger Integration

I'm using OAuthToolkit and DjangoRestSwagger. I've created an application using Django Admin, and now I've client_id and client_secret. I want to generate the token using client_id and client_secret. Currently, I use curl to generate the token. curl…
Praful Bagai
  • 16,684
  • 50
  • 136
  • 267
5
votes
4 answers

How to document function-based views parameters?

I'm developing a REST API with Django 1.11 and Django REST Framework 3.7. I installed Django REST Swagger 2.1 to generate the documentation. I'm using a function-based view like this: from rest_framework.decorators import api_view,…
GuiTeK
  • 1,561
  • 5
  • 20
  • 39
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
5
votes
0 answers

Nested URL not showing in Django Rest Swagger

I'm trying to document my Django REST API using Django Rest Swagger. My main url conf looks like this: urlpatterns =[ url(r'^tickers/', include('tickerapi.urls')), ] and tickerapi/urls: schema_view = get_swagger_view(title='Ticker…
4
votes
2 answers

Django Swagger not showing urls without permission Class

I am setting up Django-rest-swagger for my project. I have following settings for Django-restframework. REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'oauth2_provider.contrib.rest_framework.OAuth2Authentication', ), …
Muhammad Hassan
  • 14,086
  • 7
  • 32
  • 54
4
votes
2 answers

django_rest_framwork occured "TypeError: 'Link' object does not support item assignment"

A project using Django, DRF, swagger. url config below: schema_view = get_swagger_view(title='Pastebin API') urlpatterns = [ url(r'^$', schema_view), url(r'store', include('store.urls')), ... # other urls using…
3
votes
1 answer

Django REST Swagger not showing POST methods

I'm having problem with Django REST Swagger. I've created a simple viewset for users using DRF (just for showing my problem), where AppUser is my custom user model and it is not showing the POST method in my documentation, but I can call it with…
matho285
  • 61
  • 1
  • 8
3
votes
2 answers

Is it better to use GenericAPIView or basic APIView while writing class based views (CBV) with Django Rest Framework (DRF)

I have been coding using django for the past year or so and most of my work was writing API's to connect to the React-based frontend. In most of my tutorials I see people using GenericAPIViews for the basics, but I don't find anything substantial…
Mehran
  • 1,264
  • 10
  • 27
1
2 3