Automated generation of real Swagger/OpenAPI 2.0 schemas from Django Rest Framework code
Questions tagged [drf-yasg]
189 questions
0
votes
0 answers
How to customize drf-yasg / drf-spectacular open api schema for aws gateway integration?
I have a requirement to integrate all the api urls in my django service with AWS gateway.
I tried importing the open api spec(swagger json) generated by drf-yasg/drf-spectacular into aws. But this seems create only the resources and methods for the…

Ravish Mallya
- 47
- 5
0
votes
1 answer
Automatic documentation of api roles and permissions (django rest framework)
I have a Django project with various REST APIs. The permission to access those APIs are defined throught rest_framework permission classes and django.contrib.auth.models Permission model.
The documentation of those apis is automatically generated…

Shad
- 11
- 4
0
votes
0 answers
DRF-YASG different authorization for different routes
I've setup DRF-YASG but am unable to figure out how tell it that is should use different authorizations for different routs.
E.g.: My token endpoint(to POST,GET,DELETE api tokens) only accepts basic authentication
but all the other views only work…

Luca G
- 1
0
votes
3 answers
controling two tables in views
I'm new in django rest framework and i faced this problem
I have two tables Order,Payment I want to get all orders that didn't have payment in the view how can i do this
Models
class Payment(models.Model):
created_at =…

Adnan
- 23
- 4
0
votes
0 answers
Add Content-Disposition header to drf-yasg
I have a django APIView with swagger documentation using drf-yasg.
Anytime I make a post request to the API i get this error response
{
"detail": "Missing filename. Request should include a Content-Disposition header with a filename…

se7en
- 671
- 4
- 18
0
votes
1 answer
drf_yasg manual parameters configuration
I am working with drf_yasg for the very first time and I am curious to know what does IN_QUERY and the other options provided by OPENAPI do. I can't find an explanation for the purpose of these options in the documentation.

Shangazi Mkubwa
- 45
- 1
- 9
0
votes
2 answers
Django Action Append Slash
I am making development, and my POST request come like config/alert and I am trying to catch it with action decorater below.BUT Django does not catch it It wants config/alert/ but It is not possible to change incoming url add the…

Dogac Topay
- 3
- 1
- 2
0
votes
1 answer
unable to specify the fields in drf queryset using drf-yasg
class ABC(generics.ListCreateApiView):
@swagger_auto_schema(
operation_description="THIS API IS TO CREATE MESSAGES IN A LIST ",
auto_schema=AcceptFormDataSchema,
request_body=MessageGetSerializer
…

ast
- 1
0
votes
0 answers
Swagger - Multiple responses with the same http status code with drf-yasg
I have endpoint that may return json or excel file:
class ReportView(GenericAPIView):
@swagger_auto_schema(
responses={
200: openapi.Schema(
type=openapi.TYPE_FILE,
title='Report.xlsx'
),
200:…

Альберт Александров
- 807
- 1
- 15
- 27
0
votes
1 answer
Django DRF How to force login on swagger
I'm using Django Rest Framework in a project with swagger for documentation.
Swagger UI can be accessed by everyone who knows its URL. Is that possible to add an authentication method so only people with the right access can see and read swagger…

paulogil2010
- 135
- 2
- 12
0
votes
1 answer
cannot access the passed file from swagger ui inside django debugger(pdb)
created an api and added swagger to the api with the help of the package
drf-yasg
the current updated version 1.20.0, then added code like this
success_res_data = openapi.Schema(type=openapi.TYPE_OBJECT, properties={'status':…

Avin Mathew
- 336
- 11
- 25
0
votes
1 answer
drf_yasg swagger_auto_schema move from views
In my project's views classes I use swagger_auto_schema decorator to customize swagger possible responses. My question is this: "Is this a way to move all these decorators from my class based views to other place like module or python file?". I'm…

Dmitriy Lunev
- 177
- 2
- 12
0
votes
2 answers
drf_yasg only renders filterset parameters on list view
I have defined a filterset for a DRF ViewSet. drf_yasg correctly renders all the filterset fields as parameters in Swagger for the list endpoint, but not for any other endpoints.
Any idea why?
views.py:
from rest_framework import mixins,…

trubliphone
- 4,132
- 3
- 42
- 66
0
votes
1 answer
drf-yasg, How to add model choices on api doc?
I have a model like this:
class User(AbstractUser):
PERMISSION_CHOICES = [
(0, 'boss'),
(1, 'leader'),
(2, 'bro'),
(3, 'sis'),
]
permission = models.SmallIntegerField(
_('permission'),
…

我要改名叫嘟嘟
- 109
- 7
0
votes
1 answer
How to use swagger_auto_schema in a class based view with no serializer_class and how to add custom authentication permission to it?
I have a class based view as:
class ClassBasedView(GenericAPIView):
@swagger_auto_schema(responses={201: 'Created'})
@authorize(myCustomPermission)
def post(self, *args, **kwargs) -> Response:
// code.....
return…

csin ha
- 11
- 2