[15/17] docs: Document the '/patches/{patchID}/checks' resource

Message ID 20181030111916.7342-16-stephen@that.guru
State New
Headers show
Series
  • Add OpenAPI 3.0.0 REST API spec
Related show

Commit Message

Stephen Finucane Oct. 30, 2018, 11:19 a.m.
Signed-off-by: Stephen Finucane <stephen@that.guru>
---
 docs/api/schemas/patchwork.yaml | 235 ++++++++++++++++++++++++++++++++
 1 file changed, 235 insertions(+)

Patch

diff --git a/docs/api/schemas/patchwork.yaml b/docs/api/schemas/patchwork.yaml
index bb66c8a9..c2064985 100644
--- a/docs/api/schemas/patchwork.yaml
+++ b/docs/api/schemas/patchwork.yaml
@@ -411,6 +411,140 @@  paths:
                 $ref: '#/components/schemas/Error'
       tags:
       - comments
+  /api/patches/{patch_id}/checks/:
+    get:
+      description: List checks.
+      operationId: checks_list
+      parameters:
+      - in: path
+        name: patch_id
+        required: true
+        schema:
+          description: ''
+          title: ''
+          type: string
+      - $ref: '#/components/parameters/Page'
+      - $ref: '#/components/parameters/PageSize'
+      - $ref: '#/components/parameters/Order'
+      - $ref: '#/components/parameters/Search'
+      - $ref: '#/components/parameters/BeforeFilter'
+      - $ref: '#/components/parameters/SinceFilter'
+      - in: query
+        name: user
+        schema:
+          description: ''
+          title: ''
+          type: string
+      - in: query
+        name: state
+        schema:
+          description: ''
+          title: ''
+          type: string
+      - in: query
+        name: context
+        schema:
+          description: ''
+          title: ''
+          type: string
+      responses:
+        '200':
+          description: ''
+          headers:
+            Link:
+              $ref: '#/components/headers/Link'
+          content:
+            application/json:
+              schema:
+                type: array
+                items:
+                  $ref: '#/components/schemas/Check'
+        '404':
+          description: 'Not found'
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Error'
+      tags:
+      - checks
+    post:
+      description: Create a check.
+      operationId: checks_create
+      parameters:
+      - in: path
+        name: patch_id
+        required: true
+        schema:
+          description: ''
+          title: ''
+          type: string
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CheckUpdate'
+      responses:
+        '200':
+          description: ''
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Check'
+        '400':
+          description: 'Invalid Request'
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorCheckCreate'
+        '403':
+          description: 'Forbidden'
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Error'
+        '404':
+          description: 'Not found'
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Error'
+      tags:
+      - checks
+  /api/patches/{patch_id}/checks/{check_id}/:
+    get:
+      description: Show a check.
+      operationId: checks_read
+      parameters:
+      - in: path
+        name: patch_id
+        required: true
+        schema:
+          description: ''
+          title: ''
+          type: string
+      - in: path
+        name: check_id
+        required: true
+        schema:
+          description: ''
+          title: ''
+          type: string
+      responses:
+        '200':
+          description: ''
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Check'
+        '404':
+          description: 'Not found'
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Error'
+      tags:
+      - checks
   /api/people/:
     get:
       description: List people.
@@ -950,6 +1084,88 @@  components:
           type: string
           format: uri
           readOnly: true
+    Check:
+      type: object
+      properties:
+        id:
+          title: ID
+          type: integer
+          readOnly: true
+        url:
+          title: Url
+          type: string
+          format: uri
+          readOnly: true
+        user:
+          $ref: '#/components/schemas/UserEmbedded'
+        date:
+          title: Date
+          type: string
+          format: date-time
+          readOnly: true
+        state:
+          title: State
+          description: The state of the check.
+          type: string
+          enum:
+          - pending
+          - success
+          - warning
+          - fail
+        target_url:
+          title: Target URL
+          description: The target URL to associate with this check. This should be specific
+            to the patch.
+          type: string
+          format: uri
+          maxLength: 200
+          x-nullable: true
+        context:
+          title: Context
+          description: A label to discern check from checks of other testing systems.
+          type: string
+          format: slug
+          pattern: ^[-a-zA-Z0-9_]+$
+          maxLength: 255
+          minLength: 1
+        description:
+          title: Description
+          description: A brief description of the check.
+          type: string
+          x-nullable: true
+    CheckUpdate:
+      type: object
+      properties:
+        state:
+          title: State
+          description: The state of the check.
+          type: string
+          enum:
+          - pending
+          - success
+          - warning
+          - fail
+        target_url:
+          title: Target url
+          description: The target URL to associate with this check. This should be specific
+            to the patch.
+          type: string
+          format: uri
+          maxLength: 200
+          x-nullable: true
+        context:
+          title: Context
+          description: A label to discern check from checks of other testing systems.
+          type: string
+          format: slug
+          pattern: ^[-a-zA-Z0-9_]+$
+          maxLength: 255
+          minLength: 1
+        description:
+          title: Description
+          description: A brief description of the check.
+          type: string
+          x-nullable: true
     CommentList:
       type: object
       properties:
@@ -1627,6 +1843,25 @@  components:
           title: Detail
           type: string
           readOnly: true
+    ErrorCheckCreate:
+      type: object
+      properties:
+        state:
+          title: State
+          type: string
+          readOnly: true
+        target_url:
+          title: Target URL
+          type: string
+          readOnly: true
+        context:
+          title: Context
+          type: string
+          readOnly: true
+        description:
+          title: Description
+          type: string
+          readOnly: true
     ErrorPatchUpdate:
       type: object
       properties: