Questions tagged [drf-yasg]

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

97 questions
21
votes
1 answer

django rest framework - How to add post parameters to api document(drf_yasg)?

x_param = openapi.Parameter('x', in_=openapi.IN_FORM, description='srring', type=openapi.TYPE_STRING) y_param = openapi.Parameter('y', in_=openapi.IN_FORM, description='string', …
SungHo Kim
  • 261
  • 2
  • 6
10
votes
2 answers

How to dinstinctly document possible REST actions in ViewSet docstring?

The DRF docs mention this: Note that when using viewsets the basic docstring is used for all generated views. To provide descriptions for each view, such as for the the list and retrieve views, use docstring sections as described in Schemas…
rrauenza
  • 5,161
  • 4
  • 27
  • 45
8
votes
2 answers

Django, drf-yasg - how to add description to tags?

Swagger documentation says you can do that: https://swagger.io/docs/specification/grouping-operations-with-tags/ But unfortunately drf-yasg not implementing this feature: https://github.com/axnsan12/drf-yasg/issues/454 It is said, that I can add…
frenzy
  • 1,231
  • 1
  • 13
  • 18
8
votes
1 answer

Authenticating Swagger API docs (drf-yasg)

I've setup DRF-YASG but am unable to figure out how to configure it to show Views that require Authentication. Below is the configuration. schema_view = get_schema_view( openapi.Info( title="Swagger Doc", …
lukik
  • 3,213
  • 4
  • 36
  • 72
7
votes
1 answer

Problem reusing serializers with django and drf-yasg

I am using django, django drf and drf-yasg to generate write my BE and generate documentation. I have a model called User and a serializer for a user: class UserSerializer(serializers.ModelSerializer): class Meta: model =…
Belgi
  • 13,002
  • 21
  • 50
  • 63
7
votes
2 answers

How can I configure "HTTPS" schemes with the drf-yasg auto-generated swagger page?

I know in a traditional swagger YAML file, we can define the schemes with: schemes: - http - https //OR schemes: [http, https] However, how can I do the same thing with auto-generated swagger page with the drf-yasg library? Now, the generated…
R.yan
  • 1,694
  • 7
  • 29
7
votes
1 answer

DRF YASG Customizing

I'm trying to customize my api documentation buuild with yasg. First off, I would like to determine the naming of my own sections, and what endpoints should be included in this section. It seems that the naming of sections is based on the first…
6
votes
1 answer

drf-spectacular is using the wrong AutoSchema to generate Swagger

Previously I was using drf-yasg but want to update to use OpenAPI 3. I am trying to switch over to drf-spectacular. Following the instruction, I ran pip install drf-spectacular, I've removed all references to the drf-yasg package, and updated…
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 Redoute
  • 1,733
  • 2
  • 16
  • 44
6
votes
1 answer

What do these arguments mean in swagger_auto_schema (Django)?

The project uses a swagger. There is the following code. @swagger_auto_schema( manual_parameters=[ Parameter('download', IN_QUERY, 'Set `Content-Disposition=attachment` to make browser to download file' …
unknown
  • 63
  • 1
  • 5
  • 26
6
votes
1 answer

drf-yasg document input and output serializer for GET request

I'd like to document input schemas and output schemas for GET request with drf-yasg. It doesn't seem to be easy. @swagger_auto_schema( manual_parameters=[ openapi.Parameter('cart_id', in_=openapi.IN_QUERY, …
eugene
  • 33,301
  • 47
  • 188
  • 382
6
votes
1 answer

DRF - `write_only=True` displays in response schema

I'm using drf-yasg to document my APIs. However, I'm running into a problem I've a serializer in which one of the fields is set to write_only=True. class XYZSerializer(serializers.ModelSerializer): status =…
PythonEnthusiast
  • 14,299
  • 33
  • 103
  • 218
5
votes
1 answer

Getting "AssertionError: duplicate Parameters found" when I hit /swagger url

I am implementing swagger using drf-yasg for django rest framework APIs in my project. I follow the quick start section of drf-yasg. When I hit /swagger gets AssertionError: duplicate Parameters found. Below is my code and traceback. urls.py from…
5
votes
2 answers

How change Schemes from HTTP to HTTPS in drf_yasg?

I'm using drf_yasg for swagger documentation. When I publish my DRF app behind AWS Application Load Balancer and set listener to listen on 443 HTTPS and redirect to my EC2 on which DRF is running, swagger UI is trying to send a request to endpoint…
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
  • 2,835
  • 5
  • 43
  • 97
1
2 3 4 5 6 7