]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
docs: Resolve issues with 'patches'
authorStephen Finucane <stephen@that.guru>
Thu, 16 Apr 2020 09:02:36 +0000 (10:02 +0100)
committerStephen Finucane <stephen@that.guru>
Sat, 18 Apr 2020 10:57:28 +0000 (11:57 +0100)
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 <stephen@that.guru>
docs/api/schemas/latest/patchwork.yaml
docs/api/schemas/patchwork.j2
docs/api/schemas/v1.0/patchwork.yaml
docs/api/schemas/v1.1/patchwork.yaml
docs/api/schemas/v1.2/patchwork.yaml
patchwork/tests/api/test_check.py

index 0ebcbf4eb518d4e724df0b0b8cbf9f5e21c8b666..794140a377113c9f603ff0106984bdf057611bab 100644 (file)
@@ -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
index 56ecd83efaa167c73196bf29928db899c50596a9..867add9430d4f674356f7334aae4a199857a096d 100644 (file)
@@ -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
index 680d4d6ef1d0424cea7fff9798b728d22e7f2e86..b697ce9a5202616f1b78eba6971256bf769bfa23 100644 (file)
@@ -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
index d5e441f3d7379edfdf044e7f9b32b53af49875a8..45790c823497fb6f2320a27299abb14b55c2a4b3 100644 (file)
@@ -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
index a6b811f02ce8421a7fe765be09a349c8ccd6d9e8..e02c6123a8e7468270f34c86d4c349c9e51e813a 100644 (file)
@@ -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
index 24451aba09adee3d3e8098458e95f38407905c96..f5edd69c1000914074f8849d9007f8c2d9613f51 100644 (file)
@@ -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())