# HG changeset patch # User Kim Alvefur # Date 1619360432 -7200 # Node ID cfe196f88e968a0d3da908e9621b8148361fbf59 # Parent f4ab80f72d637425dbc4b2a1a119bc1f0c1e7b6c mod_rest: Reorganise openapi spec to group stanza types Goal is to make openapi.yaml and schema-xmpp.json not differ too much. diff -r f4ab80f72d63 -r cfe196f88e96 mod_rest/res/openapi.yaml --- 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'