From d9d8968c7c6afbbdac1fb81c34a08bc2dc6e6b8b Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 16 Apr 2020 10:02:36 +0100 Subject: docs: Resolve issues with 'patches' Two issues: - Errors are reported as a mapping of the field name to an array of errors, not a string. - We were attempting to validate an invalid request. Signed-off-by: Stephen Finucane --- docs/api/schemas/latest/patchwork.yaml | 16 ++++++++++++---- docs/api/schemas/patchwork.j2 | 16 ++++++++++++---- docs/api/schemas/v1.0/patchwork.yaml | 16 ++++++++++++---- docs/api/schemas/v1.1/patchwork.yaml | 16 ++++++++++++---- docs/api/schemas/v1.2/patchwork.yaml | 16 ++++++++++++---- patchwork/tests/api/test_check.py | 4 ++-- 6 files changed, 62 insertions(+), 22 deletions(-) diff --git a/docs/api/schemas/latest/patchwork.yaml b/docs/api/schemas/latest/patchwork.yaml index 0ebcbf4..794140a 100644 --- a/docs/api/schemas/latest/patchwork.yaml +++ b/docs/api/schemas/latest/patchwork.yaml @@ -2532,19 +2532,27 @@ components: properties: state: title: State - type: string + type: array + items: + type: string readOnly: true target_url: title: Target URL - type: string + type: array + items: + type: string readOnly: true context: title: Context - type: string + type: array + items: + type: string readOnly: true description: title: Description - type: string + type: array + items: + type: string readOnly: true ErrorPatchUpdate: type: object diff --git a/docs/api/schemas/patchwork.j2 b/docs/api/schemas/patchwork.j2 index 56ecd83..867add9 100644 --- a/docs/api/schemas/patchwork.j2 +++ b/docs/api/schemas/patchwork.j2 @@ -2634,19 +2634,27 @@ components: properties: state: title: State - type: string + type: array + items: + type: string readOnly: true target_url: title: Target URL - type: string + type: array + items: + type: string readOnly: true context: title: Context - type: string + type: array + items: + type: string readOnly: true description: title: Description - type: string + type: array + items: + type: string readOnly: true ErrorPatchUpdate: type: object diff --git a/docs/api/schemas/v1.0/patchwork.yaml b/docs/api/schemas/v1.0/patchwork.yaml index 680d4d6..b697ce9 100644 --- a/docs/api/schemas/v1.0/patchwork.yaml +++ b/docs/api/schemas/v1.0/patchwork.yaml @@ -2153,19 +2153,27 @@ components: properties: state: title: State - type: string + type: array + items: + type: string readOnly: true target_url: title: Target URL - type: string + type: array + items: + type: string readOnly: true context: title: Context - type: string + type: array + items: + type: string readOnly: true description: title: Description - type: string + type: array + items: + type: string readOnly: true ErrorPatchUpdate: type: object diff --git a/docs/api/schemas/v1.1/patchwork.yaml b/docs/api/schemas/v1.1/patchwork.yaml index d5e441f..45790c8 100644 --- a/docs/api/schemas/v1.1/patchwork.yaml +++ b/docs/api/schemas/v1.1/patchwork.yaml @@ -2237,19 +2237,27 @@ components: properties: state: title: State - type: string + type: array + items: + type: string readOnly: true target_url: title: Target URL - type: string + type: array + items: + type: string readOnly: true context: title: Context - type: string + type: array + items: + type: string readOnly: true description: title: Description - type: string + type: array + items: + type: string readOnly: true ErrorPatchUpdate: type: object diff --git a/docs/api/schemas/v1.2/patchwork.yaml b/docs/api/schemas/v1.2/patchwork.yaml index a6b811f..e02c612 100644 --- a/docs/api/schemas/v1.2/patchwork.yaml +++ b/docs/api/schemas/v1.2/patchwork.yaml @@ -2532,19 +2532,27 @@ components: properties: state: title: State - type: string + type: array + items: + type: string readOnly: true target_url: title: Target URL - type: string + type: array + items: + type: string readOnly: true context: title: Context - type: string + type: array + items: + type: string readOnly: true description: title: Description - type: string + type: array + items: + type: string readOnly: true ErrorPatchUpdate: type: object diff --git a/patchwork/tests/api/test_check.py b/patchwork/tests/api/test_check.py index 24451ab..f5edd69 100644 --- a/patchwork/tests/api/test_check.py +++ b/patchwork/tests/api/test_check.py @@ -147,7 +147,7 @@ class TestCheckAPI(utils.APITestCase): } self.client.force_authenticate(user=self.user) - resp = self.client.post(self.api_url(), check) + resp = self.client.post(self.api_url(), check, validate_request=False) self.assertEqual(status.HTTP_400_BAD_REQUEST, resp.status_code) self.assertEqual(0, Check.objects.all().count()) @@ -164,7 +164,7 @@ class TestCheckAPI(utils.APITestCase): } self.client.force_authenticate(user=self.user) - resp = self.client.post(self.api_url(), check) + resp = self.client.post(self.api_url(), check, validate_request=False) self.assertEqual(status.HTTP_400_BAD_REQUEST, resp.status_code) self.assertEqual(0, Check.objects.all().count()) -- cgit v1.2.3