Changeset

4889:52522c71ad1a

mod_rest: Add XEP-0363 HTTP Upload to schemas
author Kim Alvefur <zash@zash.se>
date Wed, 09 Feb 2022 00:34:36 +0100
parents 4888:dc7c9ae15f43
children 4890:347894e08b4f
files mod_rest/res/openapi.yaml mod_rest/res/schema-xmpp.json
diffstat 2 files changed, 166 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_rest/res/openapi.yaml	Tue Feb 08 13:51:41 2022 +0100
+++ b/mod_rest/res/openapi.yaml	Wed Feb 09 00:34:36 2022 +0100
@@ -338,6 +338,10 @@
           $ref: '#/components/schemas/register'
         extdisco:
           $ref: '#/components/schemas/extdisco'
+        upload_request:
+          $ref: '#/components/schemas/upload_request'
+        upload_slot:
+          $ref: '#/components/schemas/upload_slot'
 
         error:
           $ref: '#/components/schemas/error'
@@ -1081,6 +1085,72 @@
       - username
       - password
 
+    upload_slot:
+      type: object
+      xml:
+        name: slot
+        namespace: urn:xmpp:http:upload:0
+      properties:
+        put:
+          type: object
+          properties:
+            url:
+              type: string
+              format: uri
+              xml:
+                attribute: true
+            headers:
+              type: array
+              items:
+                type: object
+                required:
+                - name
+                - value
+                xml:
+                  name: header
+                properties:
+                  name:
+                    type: string
+                    enum:
+                    - Authorization
+                    - Cookie
+                    - Expires
+                    xml:
+                      attribute: true
+                  value:
+                    type: string
+                    xml:
+                      text: true
+        get:
+          type: object
+          properties:
+            url:
+              type: string
+              format: uri
+              xml:
+                attribute: true
+    upload_request:
+      type: object
+      required:
+      - filename
+      - size
+      xml:
+        name: request
+        namespace: urn:xmpp:http:upload:0
+      properties:
+        filename:
+          type: string
+          xml:
+            attribute: true
+        content-type:
+          xml:
+            attribute: true
+            name: content-type
+        size:
+          type: integer
+          xml:
+            attribute: true
+
     error:
       description: Description of something gone wrong. See the Stanza Errors section in RFC 6120.
       type: object
--- a/mod_rest/res/schema-xmpp.json	Tue Feb 08 13:51:41 2022 +0100
+++ b/mod_rest/res/schema-xmpp.json	Wed Feb 09 00:34:36 2022 +0100
@@ -535,6 +535,102 @@
             "type" : {
                "$ref" : "#/_common/type"
             },
+            "upload_request" : {
+               "properties" : {
+                  "content-type" : {
+                     "xml" : {
+                        "attribute" : true,
+                        "name" : "content-type"
+                     }
+                  },
+                  "filename" : {
+                     "type" : "string",
+                     "xml" : {
+                        "attribute" : true
+                     }
+                  },
+                  "size" : {
+                     "type" : "integer",
+                     "xml" : {
+                        "attribute" : true
+                     }
+                  }
+               },
+               "required" : [
+                  "filename",
+                  "size"
+               ],
+               "type" : "object",
+               "xml" : {
+                  "name" : "request",
+                  "namespace" : "urn:xmpp:http:upload:0"
+               }
+            },
+            "upload_slot" : {
+               "properties" : {
+                  "get" : {
+                     "properties" : {
+                        "url" : {
+                           "format" : "uri",
+                           "type" : "string",
+                           "xml" : {
+                              "attribute" : true
+                           }
+                        }
+                     },
+                     "type" : "object"
+                  },
+                  "put" : {
+                     "properties" : {
+                        "headers" : {
+                           "items" : {
+                              "properties" : {
+                                 "name" : {
+                                    "enum" : [
+                                       "Authorization",
+                                       "Cookie",
+                                       "Expires"
+                                    ],
+                                    "type" : "string",
+                                    "xml" : {
+                                       "attribute" : true
+                                    }
+                                 },
+                                 "value" : {
+                                    "type" : "string",
+                                    "xml" : {
+                                       "text" : true
+                                    }
+                                 }
+                              },
+                              "required" : [
+                                 "name",
+                                 "value"
+                              ],
+                              "type" : "object",
+                              "xml" : {
+                                 "name" : "header"
+                              }
+                           },
+                           "type" : "array"
+                        },
+                        "url" : {
+                           "format" : "uri",
+                           "type" : "string",
+                           "xml" : {
+                              "attribute" : true
+                           }
+                        }
+                     },
+                     "type" : "object"
+                  }
+               },
+               "type" : "object",
+               "xml" : {
+                  "name" : "slot",
+                  "namespace" : "urn:xmpp:http:upload:0"
+               }
+            },
             "version" : {
                "description" : "Ask about software version information",
                "properties" : {