Questions tagged [drf-yasg]

Automated generation of real Swagger/OpenAPI 2.0 schemas from Django Rest Framework code

189 questions
7
votes
2 answers

drf-yasg How to show sample response with with api?

How can I add example responses -- (openapi doc) to my swagger doc using drf-yasg package?
TNN
  • 391
  • 1
  • 5
  • 12
7
votes
3 answers

How to disable "Django Login" page when trying to access swagger api in browser?

I am getting a blank page with just a "Django Login" link when trying to access generated swagger docs. I am using drf_yasg library to render swagger documentation. Code to generate swagger docs is similar to mentioned in swagger docs. …
Saurabh Saxena
  • 1,327
  • 2
  • 13
  • 26
7
votes
1 answer

drf_yasg doesn't take TYPE_ARRAY as a valid type

the drf_yasg swagger generator doesnt take TYPE_ARRAY as a valid parameter type. the implementation is as follows from drf_yasg import openapi param1 = openapi.Parameter('param_name', in_=openapi.IN_QUERY, …
anubysh
  • 576
  • 6
  • 18
6
votes
1 answer

drf-yasg provides wrong paths to URIs

In my application I need to have multiple Swagger pages with grouped endpoints for multiple clients. One of my clients (paths) supplies mobile app API, another supplies web client API. URL patterns are kept in 2 different urls.py accordingly. I'm…
Stan Reduta
  • 3,292
  • 5
  • 31
  • 55
5
votes
1 answer

DRF Serializer Fields are not showing in Openapi Schemas

I set up openapi with the drf-yasg package for my DRF API but for some reason, all endpoints for POST or PUT in my documentation are not showing the necessary fields required. How can I set it up to show the necessary fields required to send data to…
Jordan Rob
  • 322
  • 2
  • 16
5
votes
2 answers

How to set data type of path parameter in drf-yasg

I use Django, the DRF, drf-yasg and Swagger Codegen to automatically build TypeScript code to access my REST API. In the Django backend I added a path to be served with the DRF: rest_router =…
romor
  • 1,181
  • 15
  • 22
5
votes
2 answers

Openapi 3 with Django drf

I am using Django with Django-Drf to write a restful BE. I am also using drf-yasg to generate the swagger scheme for my service. Unfortunately, drf-yasg does not yet support OpenApi3, and it doesn't look like it's going to in the foreseeable future.…
Belgi
  • 14,542
  • 22
  • 58
  • 68
5
votes
1 answer

drf-yasg, easier way to see only certain end points?

We have many apps and endpoints and its easier to expose certain endpoints to clients through yasg when we work on certain features. Currently I'm defining separate urlpatterns for swagger in each app and aggregate it from upper url . Do the…
eugene
  • 39,839
  • 68
  • 255
  • 489
5
votes
1 answer

Django 2.x drf-yasg how to create API in a custom method (like in swagger)

I am migrating my Django 1.11.7 to 2.x. One of the problems is django-rest-swagger, it is now deprecated. And drf-yasg should now be the way for the API documentation and creation. I need to do it in a similar way of creating custom api as so it…
Axil
  • 3,606
  • 10
  • 62
  • 136
5
votes
3 answers

How to make swagger schema for file upload API in django-rest-framework using drf-yasg?

I am not able to find any support for making a schema for the file upload API. The Swagger UI must have a button allowing a tester to upload a file for testing purposes. I am using firebase as a database so serializers and models don't come into the…
Tough Guy
  • 53
  • 1
  • 4
5
votes
3 answers

Django Rest Framework Swagger stopped working

Just tried to rebuild a container with DRF and drf-yasg. The exact same commit was passing all tests fine but is now falling over with the following exception: ImportError: Could not import 'rest_framework.schemas.coreapi.AutoSchema' for API setting…
Stuart Buckingham
  • 1,574
  • 16
  • 25
5
votes
0 answers

How to generate schema for multiple choice filter?

In our API we have an endpoint to list locations. We allow filtering on location type, and we allow multiple values for this filter. For example: GET /location/?type=hotel&type=airport For filtering we are using django-filter. However, drf-yasg…
5
votes
2 answers

Serialize model fields into nested object/dict

Imagine the following model: class Person(models.Model): name = models.CharField() address_streetname = models.CharField() address_housenumber = models.CharField() address_zip = models.CharField() I have a django rest framework…
nikora
  • 817
  • 1
  • 14
  • 29
4
votes
2 answers

Django drf-yasg swagger required header LOCALE parameter for every route

Is it possible to make header locale parameter required for every URL in application. Can i achieve it to set it up in global configuration or in every view method and if yes how can i do this?
I.Jokhadze
  • 456
  • 2
  • 8
  • 27
4
votes
1 answer

How to extend FastAPI docs with another swagger docs?

I decided to make a micro-services gateway in Python's FastApi framework. My authorization service is written in Django and there are already generated by drf-yasg package swagger docs. I was thinking if there is a way to somehow import auth's…
Daniel Kusy
  • 322
  • 1
  • 3
  • 16
1
2
3
12 13