Skip to content

Commit

Permalink
Add imports to docs to make it easier to try (#528)
Browse files Browse the repository at this point in the history
* Add imports to docs to make it easier to try
  • Loading branch information
PetrDlouhy committed Oct 25, 2020
1 parent 6e956dd commit 342071d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/custom_spec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ Where you can use the :func:`@swagger_auto_schema <.swagger_auto_schema>` decora
operations, you have to add the decorator multiple times if you want to override different operations:

.. code-block:: python
from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from rest_framework.decorators import api_view
test_param = openapi.Parameter('test', openapi.IN_QUERY, description="test manual param", type=openapi.TYPE_BOOLEAN)
user_response = openapi.Response('response description', UserSerializer)
Expand Down Expand Up @@ -384,6 +388,8 @@ A second example, of a :class:`~.inspectors.FieldInspector` that removes the ``t

.. code-block:: python
from drf_yasg.inspectors import FieldInspector
class NoSchemaTitleInspector(FieldInspector):
def process_result(self, result, method_name, obj, **kwargs):
# remove the `title` attribute of all Schema objects
Expand Down

0 comments on commit 342071d

Please sign in to comment.