Changeset

4546:cfe196f88e96

mod_rest: Reorganise openapi spec to group stanza types Goal is to make openapi.yaml and schema-xmpp.json not differ too much.
author Kim Alvefur <zash@zash.se>
date Sun, 25 Apr 2021 16:20:32 +0200
parents 4545:f4ab80f72d63
children 4547:a9e997d5eb94
files mod_rest/res/openapi.yaml
diffstat 1 files changed, 95 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/mod_rest/res/openapi.yaml	Sun Apr 18 14:00:10 2021 +0200
+++ b/mod_rest/res/openapi.yaml	Sun Apr 25 16:20:32 2021 +0200
@@ -142,12 +142,28 @@
         kind: message
         to: alice@example.com
         state: active
+      oneOf:
+        - $ref: '#/components/schemas/message'
+        - $ref: '#/components/schemas/presence'
+        - $ref: '#/components/schemas/iq'
 
+    message:
+      type: object
       properties:
         kind:
-          $ref: '#/components/schemas/kind'
+          kind:
+          description: Which kind of stanza
+          type: string
+          enum:
+          - message
         type:
-          $ref: '#/components/schemas/type'
+          type: string
+          enum:
+          - chat
+          - error
+          - groupchat
+          - headline
+          - normal
         to:
           $ref: '#/components/schemas/to'
         from:
@@ -164,13 +180,6 @@
         thread:
           $ref: '#/components/schemas/thread'
 
-        show:
-          $ref: '#/components/schemas/show'
-        status:
-          $ref: '#/components/schemas/status'
-        priority:
-          $ref: '#/components/schemas/priority'
-
         state:
           $ref: '#/components/schemas/state'
         nick:
@@ -180,11 +189,83 @@
         replace:
           $ref: '#/components/schemas/replace'
 
+        html:
+          $ref: '#/components/schemas/html'
+        oob_url:
+          $ref: '#/components/schemas/oob_url'
+
+        error:
+          $ref: '#/components/schemas/error'
+
+    presence:
+      type: object
+      properties:
+        kind:
+          kind:
+          description: Which kind of stanza
+          type: string
+          enum:
+          - presence
+        type:
+          type: string
+          enum:
+            - available
+            - unavailable
+            - subscribe
+            - subscribed
+            - unsubscribe
+            - unsubscribed
+            - error
+        to:
+          $ref: '#/components/schemas/to'
+        from:
+          $ref: '#/components/schemas/from'
+        id:
+          $ref: '#/components/schemas/id'
+        lang:
+          $ref: '#/components/schemas/lang'
+
+        show:
+          $ref: '#/components/schemas/show'
+        status:
+          $ref: '#/components/schemas/status'
+        priority:
+          $ref: '#/components/schemas/priority'
+
+        nick:
+          $ref: '#/components/schemas/nick'
+        delay:
+          $ref: '#/components/schemas/delay'
+
         join:
           $ref: '#/components/schemas/join'
 
-        html:
-          $ref: '#/components/schemas/html'
+        error:
+          $ref: '#/components/schemas/error'
+
+    iq:
+      type: object
+      properties:
+        kind:
+          description: Which kind of stanza
+          type: string
+          enum:
+          - iq
+        type:
+          type: string
+          enum:
+          - get
+          - set
+          - result
+          - error
+        to:
+          $ref: '#/components/schemas/to'
+        from:
+          $ref: '#/components/schemas/from'
+        id:
+          $ref: '#/components/schemas/id'
+        lang:
+          $ref: '#/components/schemas/lang'
 
         ping:
           $ref: '#/components/schemas/ping'
@@ -197,16 +278,11 @@
         command:
           $ref: '#/components/schemas/command'
 
-        oob_url:
-          $ref: '#/components/schemas/oob_url'
+        stats:
+          $ref: '#/components/schemas/stats'
         payload:
           $ref: '#/components/schemas/payload'
-        dataform:
-          $ref: '#/components/schemas/dataform'
-        formdata:
-          $ref: '#/components/schemas/formdata'
-        stats:
-          $ref: '#/components/schemas/stats'
+
         error:
           $ref: '#/components/schemas/error'