]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
docs: Resolve issues with 'events'
authorStephen Finucane <stephen@that.guru>
Thu, 16 Apr 2020 12:45:28 +0000 (13:45 +0100)
committerStephen Finucane <stephen@that.guru>
Sat, 18 Apr 2020 10:57:28 +0000 (11:57 +0100)
Four things to change here:

- The response is any array that can contain any type of event, not one
  of them.
- The 'actor' field is nullable.
- The 'cover' field of the 'cover-created' event is an embedded cover
  letter, not a string.
- The specifications for the 'current_delegate' and 'previous_delegate'
  fields of the 'patch-delegated' field were apparently invalid.

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_event.py

index 28c18495ec703df3f785363b28bd9dd6f64f2dca..9fcafd0a1a84163117088dfb6c6fa0f0b811786e 100644 (file)
@@ -379,7 +379,7 @@ paths:
               schema:
                 type: array
                 items:
-                  oneOf:
+                  anyOf:
                     - $ref: '#/components/schemas/EventCoverCreated'
                     - $ref: '#/components/schemas/EventPatchCreated'
                     - $ref: '#/components/schemas/EventPatchCompleted'
@@ -1636,6 +1636,7 @@ components:
           title: Actor
           description: The user that caused/created this event.
           readOnly: true
+          nullable: true
           allOf:
             - $ref: '#/components/schemas/UserEmbedded'
         payload:
@@ -1651,9 +1652,7 @@ components:
             payload:
               properties:
                 cover:
-                  title: Cover
-                  type: string
-                  readOnly: true
+                  $ref: '#/components/schemas/CoverLetterEmbedded'
     EventPatchCreated:
       allOf:
         - $ref: '#/components/schemas/EventBase'
@@ -1729,13 +1728,9 @@ components:
                 patch:
                   $ref: '#/components/schemas/PatchEmbedded'
                 previous_delegate:
-                  allOf:
-                    - $ref: '#/components/schemas/UserEmbedded'
-                    - title: Previous delegate
+                  $ref: '#/components/schemas/UserEmbedded'
                 current_delegate:
-                  allOf:
-                    - $ref: '#/components/schemas/UserEmbedded'
-                    - title: Current delegate
+                  $ref: '#/components/schemas/UserEmbedded'
     EventCheckCreated:
       allOf:
         - $ref: '#/components/schemas/EventBase'
index 13cc27820c053176f57529ca31c9af62fa27f5e2..e587cd7402680127eae28cfda36f7d59fc0fde8e 100644 (file)
@@ -390,7 +390,7 @@ paths:
               schema:
                 type: array
                 items:
-                  oneOf:
+                  anyOf:
                     - $ref: '#/components/schemas/EventCoverCreated'
                     - $ref: '#/components/schemas/EventPatchCreated'
                     - $ref: '#/components/schemas/EventPatchCompleted'
@@ -1703,6 +1703,7 @@ components:
           title: Actor
           description: The user that caused/created this event.
           readOnly: true
+          nullable: true
           allOf:
             - $ref: '#/components/schemas/UserEmbedded'
 {% endif %}
@@ -1719,9 +1720,7 @@ components:
             payload:
               properties:
                 cover:
-                  title: Cover
-                  type: string
-                  readOnly: true
+                  $ref: '#/components/schemas/CoverLetterEmbedded'
     EventPatchCreated:
       allOf:
         - $ref: '#/components/schemas/EventBase'
@@ -1799,13 +1798,9 @@ components:
                 patch:
                   $ref: '#/components/schemas/PatchEmbedded'
                 previous_delegate:
-                  allOf:
-                    - $ref: '#/components/schemas/UserEmbedded'
-                    - title: Previous delegate
+                  $ref: '#/components/schemas/UserEmbedded'
                 current_delegate:
-                  allOf:
-                    - $ref: '#/components/schemas/UserEmbedded'
-                    - title: Current delegate
+                  $ref: '#/components/schemas/UserEmbedded'
     EventCheckCreated:
       allOf:
         - $ref: '#/components/schemas/EventBase'
index 92801ec62296d72203bd2c1f0b807de99d280f49..e946c9e8e294f636d17e1eade77ab5f0785d7695 100644 (file)
@@ -270,7 +270,7 @@ paths:
               schema:
                 type: array
                 items:
-                  oneOf:
+                  anyOf:
                     - $ref: '#/components/schemas/EventCoverCreated'
                     - $ref: '#/components/schemas/EventPatchCreated'
                     - $ref: '#/components/schemas/EventPatchCompleted'
@@ -1440,9 +1440,7 @@ components:
             payload:
               properties:
                 cover:
-                  title: Cover
-                  type: string
-                  readOnly: true
+                  $ref: '#/components/schemas/CoverLetterEmbedded'
     EventPatchCreated:
       allOf:
         - $ref: '#/components/schemas/EventBase'
@@ -1500,13 +1498,9 @@ components:
                 patch:
                   $ref: '#/components/schemas/PatchEmbedded'
                 previous_delegate:
-                  allOf:
-                    - $ref: '#/components/schemas/UserEmbedded'
-                    - title: Previous delegate
+                  $ref: '#/components/schemas/UserEmbedded'
                 current_delegate:
-                  allOf:
-                    - $ref: '#/components/schemas/UserEmbedded'
-                    - title: Current delegate
+                  $ref: '#/components/schemas/UserEmbedded'
     EventCheckCreated:
       allOf:
         - $ref: '#/components/schemas/EventBase'
index d57b5356bac088f28069dce8caf0827d4bd5a672..614a7fb82f34ff6f9e8d9b325ad5c1871e9809cd 100644 (file)
@@ -270,7 +270,7 @@ paths:
               schema:
                 type: array
                 items:
-                  oneOf:
+                  anyOf:
                     - $ref: '#/components/schemas/EventCoverCreated'
                     - $ref: '#/components/schemas/EventPatchCreated'
                     - $ref: '#/components/schemas/EventPatchCompleted'
@@ -1465,9 +1465,7 @@ components:
             payload:
               properties:
                 cover:
-                  title: Cover
-                  type: string
-                  readOnly: true
+                  $ref: '#/components/schemas/CoverLetterEmbedded'
     EventPatchCreated:
       allOf:
         - $ref: '#/components/schemas/EventBase'
@@ -1543,13 +1541,9 @@ components:
                 patch:
                   $ref: '#/components/schemas/PatchEmbedded'
                 previous_delegate:
-                  allOf:
-                    - $ref: '#/components/schemas/UserEmbedded'
-                    - title: Previous delegate
+                  $ref: '#/components/schemas/UserEmbedded'
                 current_delegate:
-                  allOf:
-                    - $ref: '#/components/schemas/UserEmbedded'
-                    - title: Current delegate
+                  $ref: '#/components/schemas/UserEmbedded'
     EventCheckCreated:
       allOf:
         - $ref: '#/components/schemas/EventBase'
index f2ee2a85cfacef77e417f4cd2cc06fd226425f9a..9bab378042d4a9ed3ca052fb7c4b631c40745964 100644 (file)
@@ -379,7 +379,7 @@ paths:
               schema:
                 type: array
                 items:
-                  oneOf:
+                  anyOf:
                     - $ref: '#/components/schemas/EventCoverCreated'
                     - $ref: '#/components/schemas/EventPatchCreated'
                     - $ref: '#/components/schemas/EventPatchCompleted'
@@ -1636,6 +1636,7 @@ components:
           title: Actor
           description: The user that caused/created this event.
           readOnly: true
+          nullable: true
           allOf:
             - $ref: '#/components/schemas/UserEmbedded'
         payload:
@@ -1651,9 +1652,7 @@ components:
             payload:
               properties:
                 cover:
-                  title: Cover
-                  type: string
-                  readOnly: true
+                  $ref: '#/components/schemas/CoverLetterEmbedded'
     EventPatchCreated:
       allOf:
         - $ref: '#/components/schemas/EventBase'
@@ -1729,13 +1728,9 @@ components:
                 patch:
                   $ref: '#/components/schemas/PatchEmbedded'
                 previous_delegate:
-                  allOf:
-                    - $ref: '#/components/schemas/UserEmbedded'
-                    - title: Previous delegate
+                  $ref: '#/components/schemas/UserEmbedded'
                 current_delegate:
-                  allOf:
-                    - $ref: '#/components/schemas/UserEmbedded'
-                    - title: Current delegate
+                  $ref: '#/components/schemas/UserEmbedded'
     EventCheckCreated:
       allOf:
         - $ref: '#/components/schemas/EventBase'
index 54935d0b19d3de40f444311ed855508593ebc491..32e99366654634f0d89eeb540ba9f099eb744bdb 100644 (file)
@@ -115,7 +115,11 @@ class TestEventAPI(utils.APITestCase):
         # There should only be one
         self.assertEqual(1, len(resp.data))
 
-        resp = self.client.get(self.api_url(), {'category': 'foo-bar'})
+        resp = self.client.get(
+            self.api_url(),
+            {'category': 'foo-bar'},
+            validate_request=False,
+        )
         self.assertEqual(0, len(resp.data))
 
     def test_list_filter_patch(self):