diff --git a/CHANGELOG.md b/CHANGELOG.md index 98c803e2f536..c81e8b4ed8a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - Cloud storage unique_together limitation () +- Support for redundant request media types in the API + () ### Fixed - An invalid project/org handling in webhooks () diff --git a/cvat/apps/engine/tests/test_rest_api.py b/cvat/apps/engine/tests/test_rest_api.py index 00d6d0d48e91..36eac8b6dd73 100644 --- a/cvat/apps/engine/tests/test_rest_api.py +++ b/cvat/apps/engine/tests/test_rest_api.py @@ -747,7 +747,7 @@ def test_api_v2_users_id_no_auth(self): class UserPartialUpdateAPITestCase(UserAPITestCase): def _run_api_v2_users_id(self, user, user_id, data): with ForceLogin(user, self.client): - response = self.client.patch('/api/users/{}'.format(user_id), data=data) + response = self.client.patch('/api/users/{}'.format(user_id), data=data, format='json') return response diff --git a/cvat/apps/engine/views.py b/cvat/apps/engine/views.py index 86fb3a9ea258..38a57880f02e 100644 --- a/cvat/apps/engine/views.py +++ b/cvat/apps/engine/views.py @@ -33,8 +33,10 @@ from rest_framework import mixins, serializers, status, viewsets from rest_framework.decorators import action from rest_framework.exceptions import APIException, NotFound, ValidationError, PermissionDenied +from rest_framework.parsers import MultiPartParser from rest_framework.permissions import SAFE_METHODS from rest_framework.response import Response +from rest_framework.settings import api_settings from django_sendfile import sendfile import cvat.apps.dataset_manager as dm @@ -50,6 +52,7 @@ CloudProviderChoice, Location ) from cvat.apps.engine.models import CloudStorage as CloudStorageModel +from cvat.apps.engine.parsers import TusUploadParser from cvat.apps.engine.serializers import ( AboutSerializer, AnnotationFileSerializer, BasicUserSerializer, DataMetaReadSerializer, DataMetaWriteSerializer, DataSerializer, @@ -78,6 +81,8 @@ from cvat.apps.engine.cache import MediaCache from cvat.apps.events.handlers import handle_annotations_patch +_UPLOAD_PARSER_CLASSES = api_settings.DEFAULT_PARSER_CLASSES + [MultiPartParser] + @extend_schema(tags=['server']) class ServerViewSet(viewsets.ViewSet): serializer_class = None @@ -306,7 +311,7 @@ def perform_create(self, serializer, **kwargs): '405': OpenApiResponse(description='Format is not available'), }) @action(detail=True, methods=['GET', 'POST', 'OPTIONS'], serializer_class=None, - url_path=r'dataset/?$') + url_path=r'dataset/?$', parser_classes=_UPLOAD_PARSER_CLASSES) def dataset(self, request, pk): self._object = self.get_object() # force call of check_object_permissions() rq_id = f"import:dataset-for-project.id{pk}-by-{request.user}" @@ -367,7 +372,8 @@ def dataset(self, request, pk): @extend_schema(methods=['HEAD'], summary="Implements TUS file uploading protocol." ) - @action(detail=True, methods=['HEAD', 'PATCH'], url_path='dataset/'+UploadMixin.file_id_regex) + @action(detail=True, methods=['HEAD', 'PATCH'], url_path='dataset/'+UploadMixin.file_id_regex, + parser_classes=[TusUploadParser]) def append_dataset_chunk(self, request, pk, file_id): self._object = self.get_object() return self.append_tus_chunk(request, file_id) @@ -499,7 +505,8 @@ def export_backup(self, request, pk=None): '202': OpenApiResponse(description='Importing a backup file has been started'), }) @action(detail=False, methods=['OPTIONS', 'POST'], url_path=r'backup/?$', - serializer_class=ProjectFileSerializer(required=False)) + serializer_class=ProjectFileSerializer(required=False), + parser_classes=_UPLOAD_PARSER_CLASSES) def import_backup(self, request, pk=None): return self.deserialize(request, backup.import_project) @@ -514,7 +521,7 @@ def import_backup(self, request, pk=None): summary="Implements TUS file uploading protocol." ) @action(detail=False, methods=['HEAD', 'PATCH'], url_path='backup/'+UploadMixin.file_id_regex, - serializer_class=None) + serializer_class=None, parser_classes=[TusUploadParser]) def append_backup_chunk(self, request, file_id): return self.append_tus_chunk(request, file_id) @@ -731,7 +738,9 @@ def get_queryset(self): '201': OpenApiResponse(description='The task has been imported'), # or better specify {id: task_id} '202': OpenApiResponse(description='Importing a backup file has been started'), }) - @action(detail=False, methods=['OPTIONS', 'POST'], url_path=r'backup/?$', serializer_class=TaskFileSerializer(required=False)) + @action(detail=False, methods=['OPTIONS', 'POST'], url_path=r'backup/?$', + serializer_class=TaskFileSerializer(required=False), + parser_classes=_UPLOAD_PARSER_CLASSES) def import_backup(self, request, pk=None): return self.deserialize(request, backup.import_task) @@ -745,7 +754,8 @@ def import_backup(self, request, pk=None): @extend_schema(methods=['HEAD'], summary="Implements TUS file uploading protocol." ) - @action(detail=False, methods=['HEAD', 'PATCH'], url_path='backup/'+UploadMixin.file_id_regex) + @action(detail=False, methods=['HEAD', 'PATCH'], url_path='backup/'+UploadMixin.file_id_regex, + parser_classes=[TusUploadParser]) def append_backup_chunk(self, request, file_id): return self.append_tus_chunk(request, file_id) @@ -909,7 +919,8 @@ def upload_finished(self, request): responses={ '200': OpenApiResponse(description='Data of a specific type'), }) - @action(detail=True, methods=['OPTIONS', 'POST', 'GET'], url_path=r'data/?$') + @action(detail=True, methods=['OPTIONS', 'POST', 'GET'], url_path=r'data/?$', + parser_classes=_UPLOAD_PARSER_CLASSES) def data(self, request, pk): self._object = self.get_object() # call check_object_permissions as well if request.method == 'POST' or request.method == 'OPTIONS': @@ -945,7 +956,8 @@ def data(self, request, pk): @extend_schema(methods=['HEAD'], summary="Implements TUS file uploading protocol." ) - @action(detail=True, methods=['HEAD', 'PATCH'], url_path='data/'+UploadMixin.file_id_regex) + @action(detail=True, methods=['HEAD', 'PATCH'], url_path='data/'+UploadMixin.file_id_regex, + parser_classes=[TusUploadParser]) def append_data_chunk(self, request, pk, file_id): self._object = self.get_object() return self.append_tus_chunk(request, file_id) @@ -1032,7 +1044,7 @@ def append_data_chunk(self, request, pk, file_id): '204': OpenApiResponse(description='The annotation has been deleted'), }) @action(detail=True, methods=['GET', 'DELETE', 'PUT', 'PATCH', 'POST', 'OPTIONS'], url_path=r'annotations/?$', - serializer_class=None) + serializer_class=None, parser_classes=_UPLOAD_PARSER_CLASSES) def annotations(self, request, pk): self._object = self.get_object() # force call of check_object_permissions() if request.method == 'GET': @@ -1106,7 +1118,8 @@ def annotations(self, request, pk): operation_id='tasks_annotations_file_retrieve_status', summary="Implements TUS file uploading protocol." ) - @action(detail=True, methods=['HEAD', 'PATCH'], url_path='annotations/'+UploadMixin.file_id_regex) + @action(detail=True, methods=['HEAD', 'PATCH'], url_path='annotations/'+UploadMixin.file_id_regex, + parser_classes=[TusUploadParser]) def append_annotations_chunk(self, request, pk, file_id): self._object = self.get_object() return self.append_tus_chunk(request, file_id) @@ -1428,7 +1441,7 @@ def upload_finished(self, request): '204': OpenApiResponse(description='The annotation has been deleted'), }) @action(detail=True, methods=['GET', 'DELETE', 'PUT', 'PATCH', 'POST', 'OPTIONS'], url_path=r'annotations/?$', - serializer_class=LabeledDataSerializer) + serializer_class=LabeledDataSerializer, parser_classes=_UPLOAD_PARSER_CLASSES) def annotations(self, request, pk): self._object = self.get_object() # force call of check_object_permissions() if request.method == 'GET': @@ -1506,7 +1519,8 @@ def annotations(self, request, pk): @extend_schema(methods=['HEAD'], summary="Implements TUS file uploading protocol." ) - @action(detail=True, methods=['HEAD', 'PATCH'], url_path='annotations/'+UploadMixin.file_id_regex) + @action(detail=True, methods=['HEAD', 'PATCH'], url_path='annotations/'+UploadMixin.file_id_regex, + parser_classes=[TusUploadParser]) def append_annotations_chunk(self, request, pk, file_id): self._object = self.get_object() return self.append_tus_chunk(request, file_id) @@ -2077,6 +2091,10 @@ class CloudStorageViewSet(viewsets.GenericViewSet, mixins.ListModelMixin, lookup_fields = {'owner': 'owner__username', 'name': 'display_name'} iam_organization_field = 'organization' + # Multipart support is necessary here, as CloudStorageWriteSerializer + # contains a file field (key_file). + parser_classes = _UPLOAD_PARSER_CLASSES + def get_serializer_class(self): if self.request.method in ('POST', 'PATCH'): return CloudStorageWriteSerializer diff --git a/cvat/schema.yml b/cvat/schema.yml index d14e91c227ff..6325ebbf0681 100644 --- a/cvat/schema.yml +++ b/cvat/schema.yml @@ -47,15 +47,6 @@ paths: application/json: schema: $ref: '#/components/schemas/LoginSerializerExRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/LoginSerializerExRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/LoginSerializerExRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/LoginSerializerExRequest' required: true security: - sessionAuth: [] @@ -140,15 +131,6 @@ paths: application/json: schema: $ref: '#/components/schemas/PasswordChangeRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PasswordChangeRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/PasswordChangeRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PasswordChangeRequest' required: true security: - sessionAuth: [] @@ -193,15 +175,6 @@ paths: application/json: schema: $ref: '#/components/schemas/PasswordResetSerializerExRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PasswordResetSerializerExRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/PasswordResetSerializerExRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PasswordResetSerializerExRequest' required: true security: - sessionAuth: [] @@ -249,15 +222,6 @@ paths: application/json: schema: $ref: '#/components/schemas/PasswordResetConfirmRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PasswordResetConfirmRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/PasswordResetConfirmRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PasswordResetConfirmRequest' required: true security: - sessionAuth: [] @@ -298,15 +262,6 @@ paths: application/json: schema: $ref: '#/components/schemas/RegisterSerializerExRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/RegisterSerializerExRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/RegisterSerializerExRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/RegisterSerializerExRequest' required: true security: - sessionAuth: [] @@ -375,15 +330,6 @@ paths: application/json: schema: $ref: '#/components/schemas/SigningRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/SigningRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/SigningRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/SigningRequest' required: true security: - sessionAuth: [] @@ -572,15 +518,9 @@ paths: manifests: - manifest.jsonl summary: Create GCS - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/CloudStorageWriteRequest' multipart/form-data: schema: $ref: '#/components/schemas/CloudStorageWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/CloudStorageWriteRequest' required: true security: - sessionAuth: [] @@ -710,15 +650,9 @@ paths: manifests: - manifest.jsonl summary: Create GCS - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PatchedCloudStorageWriteRequest' multipart/form-data: schema: $ref: '#/components/schemas/PatchedCloudStorageWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PatchedCloudStorageWriteRequest' security: - sessionAuth: [] csrfAuth: [] @@ -1047,15 +981,6 @@ paths: application/json: schema: $ref: '#/components/schemas/CommentWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/CommentWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/CommentWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/CommentWriteRequest' required: true security: - sessionAuth: [] @@ -1141,15 +1066,6 @@ paths: application/json: schema: $ref: '#/components/schemas/PatchedCommentWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PatchedCommentWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/PatchedCommentWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PatchedCommentWriteRequest' security: - sessionAuth: [] csrfAuth: [] @@ -1311,15 +1227,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ClientEventsRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/ClientEventsRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/ClientEventsRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/ClientEventsRequest' required: true security: - sessionAuth: [] @@ -1429,15 +1336,6 @@ paths: application/json: schema: $ref: '#/components/schemas/InvitationWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/InvitationWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/InvitationWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/InvitationWriteRequest' required: true security: - sessionAuth: [] @@ -1523,15 +1421,6 @@ paths: application/json: schema: $ref: '#/components/schemas/PatchedInvitationWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PatchedInvitationWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/PatchedInvitationWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PatchedInvitationWriteRequest' security: - sessionAuth: [] csrfAuth: [] @@ -1702,15 +1591,6 @@ paths: application/json: schema: $ref: '#/components/schemas/IssueWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/IssueWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/IssueWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/IssueWriteRequest' required: true security: - sessionAuth: [] @@ -1796,15 +1676,6 @@ paths: application/json: schema: $ref: '#/components/schemas/PatchedIssueWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PatchedIssueWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/PatchedIssueWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PatchedIssueWriteRequest' security: - sessionAuth: [] csrfAuth: [] @@ -2045,15 +1916,6 @@ paths: application/json: schema: $ref: '#/components/schemas/PatchedJobWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PatchedJobWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/PatchedJobWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PatchedJobWriteRequest' security: - sessionAuth: [] csrfAuth: [] @@ -2217,15 +2079,9 @@ paths: application/json: schema: $ref: '#/components/schemas/AnnotationFileRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/AnnotationFileRequest' multipart/form-data: schema: $ref: '#/components/schemas/AnnotationFileRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/AnnotationFileRequest' required: true security: - sessionAuth: [] @@ -2279,15 +2135,9 @@ paths: application/json: schema: $ref: '#/components/schemas/JobAnnotationsUpdateRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/JobAnnotationsUpdateRequest' multipart/form-data: schema: $ref: '#/components/schemas/JobAnnotationsUpdateRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/JobAnnotationsUpdateRequest' security: - sessionAuth: [] csrfAuth: [] @@ -2341,15 +2191,9 @@ paths: application/json: schema: $ref: '#/components/schemas/PatchedLabeledDataRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PatchedLabeledDataRequest' multipart/form-data: schema: $ref: '#/components/schemas/PatchedLabeledDataRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PatchedLabeledDataRequest' security: - sessionAuth: [] csrfAuth: [] @@ -2430,18 +2274,6 @@ paths: - jobs requestBody: content: - application/json: - schema: - type: string - format: binary - application/x-www-form-urlencoded: - schema: - type: string - format: binary - multipart/form-data: - schema: - type: string - format: binary application/offset+octet-stream: schema: type: string @@ -2589,15 +2421,6 @@ paths: application/json: schema: $ref: '#/components/schemas/PatchedDataMetaWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PatchedDataMetaWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/PatchedDataMetaWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PatchedDataMetaWriteRequest' security: - sessionAuth: [] csrfAuth: [] @@ -2924,15 +2747,6 @@ paths: application/json: schema: $ref: '#/components/schemas/PatchedLabelRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PatchedLabelRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/PatchedLabelRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PatchedLabelRequest' security: - sessionAuth: [] csrfAuth: [] @@ -3091,15 +2905,6 @@ paths: application/json: schema: $ref: '#/components/schemas/OnlineFunctionCallRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/OnlineFunctionCallRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/OnlineFunctionCallRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/OnlineFunctionCallRequest' security: - sessionAuth: [] csrfAuth: [] @@ -3356,15 +3161,6 @@ paths: application/json: schema: $ref: '#/components/schemas/PatchedMembershipWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PatchedMembershipWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/PatchedMembershipWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PatchedMembershipWriteRequest' security: - sessionAuth: [] csrfAuth: [] @@ -3519,15 +3315,6 @@ paths: application/json: schema: $ref: '#/components/schemas/OrganizationWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/OrganizationWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/OrganizationWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/OrganizationWriteRequest' required: true security: - sessionAuth: [] @@ -3613,15 +3400,6 @@ paths: application/json: schema: $ref: '#/components/schemas/PatchedOrganizationWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PatchedOrganizationWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/PatchedOrganizationWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PatchedOrganizationWriteRequest' security: - sessionAuth: [] csrfAuth: [] @@ -3786,15 +3564,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ProjectWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/ProjectWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/ProjectWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/ProjectWriteRequest' required: true security: - sessionAuth: [] @@ -3880,15 +3649,6 @@ paths: application/json: schema: $ref: '#/components/schemas/PatchedProjectWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PatchedProjectWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/PatchedProjectWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PatchedProjectWriteRequest' security: - sessionAuth: [] csrfAuth: [] @@ -4250,15 +4010,9 @@ paths: application/json: schema: $ref: '#/components/schemas/DatasetWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/DatasetWriteRequest' multipart/form-data: schema: $ref: '#/components/schemas/DatasetWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/DatasetWriteRequest' security: - sessionAuth: [] csrfAuth: [] @@ -4307,18 +4061,6 @@ paths: - projects requestBody: content: - application/json: - schema: - type: string - format: binary - application/x-www-form-urlencoded: - schema: - type: string - format: binary - multipart/form-data: - schema: - type: string - format: binary application/offset+octet-stream: schema: type: string @@ -4413,15 +4155,9 @@ paths: application/json: schema: $ref: '#/components/schemas/BackupWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/BackupWriteRequest' multipart/form-data: schema: $ref: '#/components/schemas/BackupWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/BackupWriteRequest' security: - sessionAuth: [] csrfAuth: [] @@ -4462,18 +4198,6 @@ paths: - projects requestBody: content: - application/json: - schema: - type: string - format: binary - application/x-www-form-urlencoded: - schema: - type: string - format: binary - multipart/form-data: - schema: - type: string - format: binary application/offset+octet-stream: schema: type: string @@ -4941,15 +4665,6 @@ paths: application/json: schema: $ref: '#/components/schemas/TaskWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/TaskWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/TaskWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/TaskWriteRequest' required: true security: - sessionAuth: [] @@ -5035,15 +4750,6 @@ paths: application/json: schema: $ref: '#/components/schemas/PatchedTaskWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PatchedTaskWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/PatchedTaskWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PatchedTaskWriteRequest' security: - sessionAuth: [] csrfAuth: [] @@ -5245,15 +4951,9 @@ paths: application/json: schema: $ref: '#/components/schemas/TaskAnnotationsWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/TaskAnnotationsWriteRequest' multipart/form-data: schema: $ref: '#/components/schemas/TaskAnnotationsWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/TaskAnnotationsWriteRequest' security: - sessionAuth: [] csrfAuth: [] @@ -5306,15 +5006,9 @@ paths: application/json: schema: $ref: '#/components/schemas/TaskAnnotationsUpdateRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/TaskAnnotationsUpdateRequest' multipart/form-data: schema: $ref: '#/components/schemas/TaskAnnotationsUpdateRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/TaskAnnotationsUpdateRequest' security: - sessionAuth: [] csrfAuth: [] @@ -5368,15 +5062,9 @@ paths: application/json: schema: $ref: '#/components/schemas/PatchedLabeledDataRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PatchedLabeledDataRequest' multipart/form-data: schema: $ref: '#/components/schemas/PatchedLabeledDataRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PatchedLabeledDataRequest' security: - sessionAuth: [] csrfAuth: [] @@ -5461,18 +5149,6 @@ paths: - tasks requestBody: content: - application/json: - schema: - type: string - format: binary - application/x-www-form-urlencoded: - schema: - type: string - format: binary - multipart/form-data: - schema: - type: string - format: binary application/offset+octet-stream: schema: type: string @@ -5663,15 +5339,9 @@ paths: application/json: schema: $ref: '#/components/schemas/DataRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/DataRequest' multipart/form-data: schema: $ref: '#/components/schemas/DataRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/DataRequest' required: true security: - sessionAuth: [] @@ -5717,18 +5387,6 @@ paths: - tasks requestBody: content: - application/json: - schema: - type: string - format: binary - application/x-www-form-urlencoded: - schema: - type: string - format: binary - multipart/form-data: - schema: - type: string - format: binary application/offset+octet-stream: schema: type: string @@ -5813,15 +5471,6 @@ paths: application/json: schema: $ref: '#/components/schemas/PatchedDataMetaWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PatchedDataMetaWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/PatchedDataMetaWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PatchedDataMetaWriteRequest' security: - sessionAuth: [] csrfAuth: [] @@ -6049,15 +5698,9 @@ paths: application/json: schema: $ref: '#/components/schemas/TaskFileRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/TaskFileRequest' multipart/form-data: schema: $ref: '#/components/schemas/TaskFileRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/TaskFileRequest' required: true security: - sessionAuth: [] @@ -6099,18 +5742,6 @@ paths: - tasks requestBody: content: - application/json: - schema: - type: string - format: binary - application/x-www-form-urlencoded: - schema: - type: string - format: binary - multipart/form-data: - schema: - type: string - format: binary application/offset+octet-stream: schema: type: string @@ -6280,15 +5911,6 @@ paths: application/json: schema: $ref: '#/components/schemas/PatchedUserRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PatchedUserRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/PatchedUserRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PatchedUserRequest' security: - sessionAuth: [] csrfAuth: [] @@ -6488,15 +6110,6 @@ paths: application/json: schema: $ref: '#/components/schemas/WebhookWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/WebhookWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/WebhookWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/WebhookWriteRequest' required: true security: - sessionAuth: [] @@ -6582,15 +6195,6 @@ paths: application/json: schema: $ref: '#/components/schemas/WebhookWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/WebhookWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/WebhookWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/WebhookWriteRequest' required: true security: - sessionAuth: [] @@ -6636,15 +6240,6 @@ paths: application/json: schema: $ref: '#/components/schemas/PatchedWebhookWriteRequest' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/PatchedWebhookWriteRequest' - multipart/form-data: - schema: - $ref: '#/components/schemas/PatchedWebhookWriteRequest' - application/offset+octet-stream: - schema: - $ref: '#/components/schemas/PatchedWebhookWriteRequest' security: - sessionAuth: [] csrfAuth: [] diff --git a/cvat/settings/base.py b/cvat/settings/base.py index 4d1d56113051..4aae54079a46 100644 --- a/cvat/settings/base.py +++ b/cvat/settings/base.py @@ -147,9 +147,6 @@ def add_ssh_keys(): REST_FRAMEWORK = { 'DEFAULT_PARSER_CLASSES': [ 'rest_framework.parsers.JSONParser', - 'rest_framework.parsers.FormParser', - 'rest_framework.parsers.MultiPartParser', - 'cvat.apps.engine.parsers.TusUploadParser', ], 'DEFAULT_RENDERER_CLASSES': [ 'cvat.apps.engine.renderers.CVATAPIRenderer',