title: Django 2.x drf-yasg how to create API in a custom method (like in swagger)
body: <p>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 doesnt break anything in the mobile.</p>
  
  <p>Previously, it looks like this (django-rest-swagger==2.1.1)</p>
  
  <p><a href="https://i.imgur.com/0rkqXys.png" rel="noreferrer"><img src="https://i.imgur.com/0rkqXys.png" alt="old deprecated swagger 2.1.1"></a>
  here is the old code snippet that works nicely in Django 1.11.7 and django-rest-swagger==2.1.1:</p>
  
  <pre><code>using swagger_schema.py
  https://gist.github.com/axilaris/2f72fef8f30c56d5befe9e31cd76eb50
  
  
  in url.py:
  
  from rest_framework_swagger.views import get_swagger_view
  from myapp.swagger_schema import SwaggerSchemaView
  
  
  urlpatterns = [  
     url(r'^swaggerdoc/', SwaggerSchemaView.as_view()),
     url(r'^api/v1/general/get_countries$', api.get_countries, name='get_countries'),
  
  
  in api.py:
  @api_view(['POST'])
  def get_countries(request):
      # ----- YAML below for Swagger -----
      """
      description: countries list
      parameters:
        - name: token
          type: string
          required: true
          location: form   
      """
      ......
      return Response(countries_list, status=status.HTTP_200_OK)
  </code></pre>
  
  <p>My question is how to do it in drf-yasg similarly, as I want to migrate this code and dont break anything on the mobile.</p>
  
  <p>probably try to do this on this latest stable releases:</p>
  
  <pre><code>djangorestframework==3.9
  drf-yasg==1.16.1
  </code></pre>