diff --git a/CHANGELOG.md b/CHANGELOG.md index cb76509d893b..7f0507ea8655 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -131,9 +131,14 @@ non-ascii paths while adding files from "Connected file share" (issue #4428) - Missing source tag in project annotations () - Creating a task with a Git repository via the SDK () +- Queries via the low-level API using the `multipart/form-data` Content-Type with string fields + () + +### Security - `Project.import_dataset` not waiting for completion correctly () + ## \[2.2.0] - 2022-09-12 ### Added - Added ability to delete frames from a job based on () diff --git a/cvat-sdk/gen/templates/openapi-generator/api_client.mustache b/cvat-sdk/gen/templates/openapi-generator/api_client.mustache index 0cf16488f099..2bc4838ff864 100644 --- a/cvat-sdk/gen/templates/openapi-generator/api_client.mustache +++ b/cvat-sdk/gen/templates/openapi-generator/api_client.mustache @@ -126,8 +126,8 @@ class ApiClient(object): self.default_headers['User-Agent'] = value def _serialize_post_parameter(self, obj): - if isinstance(obj, (str, int, float, none_type, bool)): - return ('', json.dumps(obj), 'application/json') + if isinstance(obj, (str, int, float, bool)): + return str(obj) elif isinstance(obj, io.IOBase): return self._serialize_file(obj) raise ApiValueError( diff --git a/tests/python/rest_api/test_tasks.py b/tests/python/rest_api/test_tasks.py index 10e80719f61b..8c03474e33f7 100644 --- a/tests/python/rest_api/test_tasks.py +++ b/tests/python/rest_api/test_tasks.py @@ -491,6 +491,40 @@ def test_can_create_task_with_defined_start_and_stop_frames(self): (task, _) = api_client.tasks_api.retrieve(task_id) assert task.size == 4 + def test_can_create_task_with_sorting_method(self): + task_spec = { + "name": f"test {self._USERNAME} to create a task with a custom sorting method", + "labels": [ + { + "name": "car", + "color": "#ff00ff", + "attributes": [], + } + ], + } + + image_files = generate_image_files(15) + + task_data = { + "client_files": image_files[5:] + image_files[:5], # perturb the order + "image_quality": 70, + "sorting_method": "natural", + } + + # Besides testing that the sorting method is applied, this also checks for + # regressions of . + task_id = self._test_create_task( + self._USERNAME, task_spec, task_data, content_type="multipart/form-data" + ) + + # check that the frames were sorted again + with make_api_client(self._USERNAME) as api_client: + data_meta, _ = api_client.tasks_api.retrieve_data_meta(task_id) + + # generate_image_files produces files that are already naturally sorted + for image_file, frame in zip(image_files, data_meta.frames): + assert image_file.name == frame.name + def test_can_get_annotations_from_new_task_with_skeletons(self): spec = { "name": f"test admin1 to create a task with skeleton",