Add documentation for authentication methods
Add swagger security definitions to settings and security parameters
to method annotations. Update the automated documentation file.
Issue: HIC-171
Change-Id: I34610f98186fb04664855ecbcfa3736b9c59c6c0
diff --git a/crashreports/rest_api_devices.py b/crashreports/rest_api_devices.py
index 96923b2..08f5681 100644
--- a/crashreports/rest_api_devices.py
+++ b/crashreports/rest_api_devices.py
@@ -12,19 +12,26 @@
from rest_framework.response import Response
from crashreports.models import Device, User
-from crashreports.permissions import HasRightsOrIsDeviceOwnerDeviceCreation
+from crashreports.permissions import (
+ HasRightsOrIsDeviceOwnerDeviceCreation,
+ SWAGGER_SECURITY_REQUIREMENTS_ALL,
+)
from crashreports.serializers import DeviceSerializer, DeviceCreateSerializer
from crashreports.response_descriptions import default_desc
@method_decorator(
name="get",
- decorator=swagger_auto_schema(operation_description="List devices"),
+ decorator=swagger_auto_schema(
+ operation_description="List devices",
+ security=SWAGGER_SECURITY_REQUIREMENTS_ALL,
+ ),
)
@method_decorator(
name="post",
decorator=swagger_auto_schema(
operation_description="Create a device",
+ security=SWAGGER_SECURITY_REQUIREMENTS_ALL,
responses=dict([default_desc(ValidationError)]),
),
)
@@ -42,6 +49,7 @@
name="get",
decorator=swagger_auto_schema(
operation_description="Get a device",
+ security=SWAGGER_SECURITY_REQUIREMENTS_ALL,
responses=dict([default_desc(NotFound)]),
),
)
@@ -49,6 +57,7 @@
name="put",
decorator=swagger_auto_schema(
operation_description="Update a device",
+ security=SWAGGER_SECURITY_REQUIREMENTS_ALL,
responses=dict([default_desc(NotFound), default_desc(ValidationError)]),
),
)
@@ -56,6 +65,7 @@
name="patch",
decorator=swagger_auto_schema(
operation_description="Make a partial update for a device",
+ security=SWAGGER_SECURITY_REQUIREMENTS_ALL,
responses=dict([default_desc(NotFound), default_desc(ValidationError)]),
),
)
@@ -63,6 +73,7 @@
name="delete",
decorator=swagger_auto_schema(
operation_description="Delete a device",
+ security=SWAGGER_SECURITY_REQUIREMENTS_ALL,
responses=dict([default_desc(NotFound)]),
),
)
@@ -88,6 +99,7 @@
@swagger_auto_schema(
method="post",
request_body=DeviceCreateSerializer,
+ security=[],
responses=dict(
[
default_desc(ValidationError),