Skip to content

Commit d9d8968

Browse files
committed
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 <[email protected]>
1 parent 9da8431 commit d9d8968

File tree

6 files changed

+62
-22
lines changed

6 files changed

+62
-22
lines changed

docs/api/schemas/latest/patchwork.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2532,19 +2532,27 @@ components:
25322532
properties:
25332533
state:
25342534
title: State
2535-
type: string
2535+
type: array
2536+
items:
2537+
type: string
25362538
readOnly: true
25372539
target_url:
25382540
title: Target URL
2539-
type: string
2541+
type: array
2542+
items:
2543+
type: string
25402544
readOnly: true
25412545
context:
25422546
title: Context
2543-
type: string
2547+
type: array
2548+
items:
2549+
type: string
25442550
readOnly: true
25452551
description:
25462552
title: Description
2547-
type: string
2553+
type: array
2554+
items:
2555+
type: string
25482556
readOnly: true
25492557
ErrorPatchUpdate:
25502558
type: object

docs/api/schemas/patchwork.j2

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,19 +2634,27 @@ components:
26342634
properties:
26352635
state:
26362636
title: State
2637-
type: string
2637+
type: array
2638+
items:
2639+
type: string
26382640
readOnly: true
26392641
target_url:
26402642
title: Target URL
2641-
type: string
2643+
type: array
2644+
items:
2645+
type: string
26422646
readOnly: true
26432647
context:
26442648
title: Context
2645-
type: string
2649+
type: array
2650+
items:
2651+
type: string
26462652
readOnly: true
26472653
description:
26482654
title: Description
2649-
type: string
2655+
type: array
2656+
items:
2657+
type: string
26502658
readOnly: true
26512659
ErrorPatchUpdate:
26522660
type: object

docs/api/schemas/v1.0/patchwork.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,19 +2153,27 @@ components:
21532153
properties:
21542154
state:
21552155
title: State
2156-
type: string
2156+
type: array
2157+
items:
2158+
type: string
21572159
readOnly: true
21582160
target_url:
21592161
title: Target URL
2160-
type: string
2162+
type: array
2163+
items:
2164+
type: string
21612165
readOnly: true
21622166
context:
21632167
title: Context
2164-
type: string
2168+
type: array
2169+
items:
2170+
type: string
21652171
readOnly: true
21662172
description:
21672173
title: Description
2168-
type: string
2174+
type: array
2175+
items:
2176+
type: string
21692177
readOnly: true
21702178
ErrorPatchUpdate:
21712179
type: object

docs/api/schemas/v1.1/patchwork.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,19 +2237,27 @@ components:
22372237
properties:
22382238
state:
22392239
title: State
2240-
type: string
2240+
type: array
2241+
items:
2242+
type: string
22412243
readOnly: true
22422244
target_url:
22432245
title: Target URL
2244-
type: string
2246+
type: array
2247+
items:
2248+
type: string
22452249
readOnly: true
22462250
context:
22472251
title: Context
2248-
type: string
2252+
type: array
2253+
items:
2254+
type: string
22492255
readOnly: true
22502256
description:
22512257
title: Description
2252-
type: string
2258+
type: array
2259+
items:
2260+
type: string
22532261
readOnly: true
22542262
ErrorPatchUpdate:
22552263
type: object

docs/api/schemas/v1.2/patchwork.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2532,19 +2532,27 @@ components:
25322532
properties:
25332533
state:
25342534
title: State
2535-
type: string
2535+
type: array
2536+
items:
2537+
type: string
25362538
readOnly: true
25372539
target_url:
25382540
title: Target URL
2539-
type: string
2541+
type: array
2542+
items:
2543+
type: string
25402544
readOnly: true
25412545
context:
25422546
title: Context
2543-
type: string
2547+
type: array
2548+
items:
2549+
type: string
25442550
readOnly: true
25452551
description:
25462552
title: Description
2547-
type: string
2553+
type: array
2554+
items:
2555+
type: string
25482556
readOnly: true
25492557
ErrorPatchUpdate:
25502558
type: object

patchwork/tests/api/test_check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def test_create_invalid_state(self):
147147
}
148148

149149
self.client.force_authenticate(user=self.user)
150-
resp = self.client.post(self.api_url(), check)
150+
resp = self.client.post(self.api_url(), check, validate_request=False)
151151
self.assertEqual(status.HTTP_400_BAD_REQUEST, resp.status_code)
152152
self.assertEqual(0, Check.objects.all().count())
153153

@@ -164,7 +164,7 @@ def test_create_missing_state(self):
164164
}
165165

166166
self.client.force_authenticate(user=self.user)
167-
resp = self.client.post(self.api_url(), check)
167+
resp = self.client.post(self.api_url(), check, validate_request=False)
168168
self.assertEqual(status.HTTP_400_BAD_REQUEST, resp.status_code)
169169
self.assertEqual(0, Check.objects.all().count())
170170

0 commit comments

Comments
 (0)