[07/17] docs: Document the '/people' resource

Message ID 20181030111916.7342-8-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.
This introduces our first use of embedded serializers, which are
separate models from the main ones. Other than that, this is pretty
standard.

Signed-off-by: Stephen Finucane <stephen@that.guru>
---
 docs/api/schemas/patchwork.yaml | 109 ++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)

Patch

diff --git a/docs/api/schemas/patchwork.yaml b/docs/api/schemas/patchwork.yaml
index eabdc55d..f713f850 100644
--- a/docs/api/schemas/patchwork.yaml
+++ b/docs/api/schemas/patchwork.yaml
@@ -25,6 +25,56 @@  paths:
                 $ref: '#/components/schemas/Index'
       tags:
       - api
+  /api/people/:
+    get:
+      description: List people.
+      operationId: people_list
+      parameters:
+      - $ref: '#/components/parameters/Page'
+      - $ref: '#/components/parameters/PageSize'
+      - $ref: '#/components/parameters/Order'
+      - $ref: '#/components/parameters/Search'
+      responses:
+        '200':
+          description: ''
+          headers:
+            Link:
+              $ref: '#/components/headers/Link'
+          content:
+            application/json:
+              schema:
+                type: array
+                items:
+                  $ref: '#/components/schemas/Person'
+      tags:
+      - people
+  /api/people/{id}/:
+    get:
+      description: Show a person.
+      operationId: people_read
+      parameters:
+      - in: path
+        name: id
+        required: true
+        schema:
+          description: ''
+          title: ''
+          type: string
+      responses:
+        '200':
+          description: ''
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Person'
+        '404':
+          description: 'Not found'
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/Error'
+      tags:
+      - people
   /api/users/:
     get:
       description: List users.
@@ -254,6 +304,31 @@  components:
           type: string
           format: uri
           readOnly: true
+    Person:
+      type: object
+      properties:
+        id:
+          title: ID
+          type: integer
+          readOnly: true
+        url:
+          title: Url
+          type: string
+          format: uri
+          readOnly: true
+        name:
+          title: Name
+          type: string
+          readOnly: true
+          minLength: 1
+        email:
+          title: Email
+          type: string
+          format: email
+          readOnly: true
+          minLength: 1
+        user:
+          $ref: '#/components/schemas/UserEmbedded'
     User:
       type: object
       properties:
@@ -286,6 +361,40 @@  components:
           format: email
           readOnly: true
           minLength: 1
+    UserEmbedded:
+      type: object
+      properties:
+        id:
+          title: ID
+          type: integer
+          readOnly: true
+        url:
+          title: Url
+          type: string
+          format: uri
+          readOnly: true
+        username:
+          title: Username
+          type: string
+          readOnly: true
+          minLength: 1
+          maxLength: 150
+        first_name:
+          title: First name
+          type: string
+          maxLength: 30
+          readOnly: true
+        last_name:
+          title: Last name
+          type: string
+          maxLength: 150
+          readOnly: true
+        email:
+          title: Email address
+          type: string
+          format: email
+          readOnly: true
+          minLength: 1
     Error:
       type: object
       properties: