Skip to content

Commit

Permalink
Add overriden path parameter example
Browse files Browse the repository at this point in the history
  • Loading branch information
axnsan12 committed Jan 11, 2018
1 parent 57d77cc commit 6a478e1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions testproj/snippets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
from inflection import camelize
from rest_framework import generics

from drf_yasg import openapi
from drf_yasg.inspectors import SwaggerAutoSchema
from drf_yasg.utils import swagger_auto_schema
from snippets.models import Snippet
from snippets.serializers import SnippetSerializer

Expand Down Expand Up @@ -53,6 +55,14 @@ def patch(self, request, *args, **kwargs):
"""patch method docstring"""
return super(SnippetDetail, self).patch(request, *args, **kwargs)

@swagger_auto_schema(manual_parameters=[
openapi.Parameter(
name='id', in_=openapi.IN_PATH,
type=openapi.TYPE_INTEGER,
description="path parameter override",
required=True
)
])
def delete(self, request, *args, **kwargs):
"""delete method docstring"""
return super(SnippetDetail, self).patch(request, *args, **kwargs)
7 changes: 6 additions & 1 deletion tests/reference.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,12 @@ paths:
delete:
operationId: snippetsDelete
description: delete method docstring
parameters: []
parameters:
- name: id
in: path
description: path parameter override
required: true
type: integer
responses:
'204':
description: ''
Expand Down

0 comments on commit 6a478e1

Please sign in to comment.