Skip to content

Node.js based forum software built for the modern web

docs: update openapi schema for relays and rules

Julian Lama9a12a9f08b6
diff --git a/public/openapi/components/schemas/admin/relays.yaml b/public/openapi/components/schemas/admin/relays.yaml
new file mode 100644
index 0000000000..67bdd09b10
--- /dev/null
+++ b/public/openapi/components/schemas/admin/relays.yaml
@@ -0,0 +1,18 @@
+RelayObject:
+ type: object
+ properties:
+ url:
+ type: string
+ description: The relay actor endpoint
+ example: https://example.org/actor
+ state:
+ type: number
+ description: "The established state of the relay(0: pending; 1: one way receive; 2: bidirectional)"
+ enum: [0, 1, 2]
+ label:
+ type: string
+ description: A language key pertaining to the `state` value
+RelaysArray:
+ type: array
+ items:
+ $ref: '#/RelayObject'
\ No newline at end of file
diff --git a/public/openapi/components/schemas/admin/rules.yaml b/public/openapi/components/schemas/admin/rules.yaml
new file mode 100644
index 0000000000..282d6eff11
--- /dev/null
+++ b/public/openapi/components/schemas/admin/rules.yaml
@@ -0,0 +1,23 @@
+RuleObject:
+ type: object
+ properties:
+ rid:
+ type: string
+ description: a valid rule ID
+ example: 4eb506f8-a173-4693-a41b-e23604bc973a
+ type:
+ type: string
+ description: The auto-categorization rule type
+ example: hashtag
+ value:
+ type: string
+ description: The value that incoming content will be matched against (used alongside `type`)
+ example: 'example'
+ cid:
+ type: number
+ description: The category ID of a local category
+ example: 1
+RulesArray:
+ type: array
+ items:
+ $ref: '#/RuleObject'
\ No newline at end of file
diff --git a/public/openapi/components/schemas/admin/rulesObject.yaml b/public/openapi/components/schemas/admin/rulesObject.yaml
deleted file mode 100644
index 6b8db905ff..0000000000
--- a/public/openapi/components/schemas/admin/rulesObject.yaml
+++ /dev/null
@@ -1,21 +0,0 @@
-RulesObject:
- type: array
- items:
- type: object
- properties:
- rid:
- type: string
- description: a valid rule ID
- example: 4eb506f8-a173-4693-a41b-e23604bc973a
- type:
- type: string
- description: The auto-categorization rule type
- example: hashtag
- value:
- type: string
- description: The value that incoming content will be matched against (used alongside `type`)
- example: 'example'
- cid:
- type: number
- description: The category ID of a local category
- example: 1
\ No newline at end of file
diff --git a/public/openapi/read/admin/settings/activitypub.yaml b/public/openapi/read/admin/settings/activitypub.yaml
index 892c56030f..5ce26a5820 100644
--- a/public/openapi/read/admin/settings/activitypub.yaml
+++ b/public/openapi/read/admin/settings/activitypub.yaml
@@ -17,24 +17,7 @@ get:
type: number
description: The number of ActivityPub-enabled instances that this forum knows about.
rules:
- type: array
- items:
- type: object
- properties:
- rid:
- type: string
- description: a valid rule ID
- example: 4eb506f8-a173-4693-a41b-e23604bc973a
- type:
- type: string
- description: The auto-categorization rule type
- example: hashtag
- value:
- type: string
- description: The value that incoming content will be matched against (used alongside `type`)
- example: 'example'
- cid:
- type: number
- description: The category ID of a local category
- example: 1
+ $ref: ../../../components/schemas/admin/rules.yaml#/RulesArray
+ relays:
+ $ref: ../../../components/schemas/admin/relays.yaml#/RelayArray
- $ref: ../../../components/schemas/CommonProps.yaml#/CommonProps
\ No newline at end of file
diff --git a/public/openapi/write/admin/activitypub/relays.yaml b/public/openapi/write/admin/activitypub/relays.yaml
new file mode 100644
index 0000000000..6c8ac89f5a
--- /dev/null
+++ b/public/openapi/write/admin/activitypub/relays.yaml
@@ -0,0 +1,28 @@
+post:
+ tags:
+ - admin
+ summary: add relay
+ description: This operation establishes a connection to a remote relay for content discovery purposes
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ url:
+ type: string
+ description: The relay actor endpoint
+ example: https://example.org/actor
+ responses:
+ '200':
+ description: rule successfully created
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ status:
+ $ref: ../../../components/schemas/Status.yaml#/Status
+ response:
+ $ref: ../../../components/schemas/admin/relays.yaml#/RelaysArray
diff --git a/public/openapi/write/admin/activitypub/relays/url.yaml b/public/openapi/write/admin/activitypub/relays/url.yaml
new file mode 100644
index 0000000000..c108e65680
--- /dev/null
+++ b/public/openapi/write/admin/activitypub/relays/url.yaml
@@ -0,0 +1,25 @@
+delete:
+ tags:
+ - admin
+ summary: remove relay
+ description: This operation removes a pre-established relay connection
+ parameters:
+ - in: path
+ name: url
+ schema:
+ type: string
+ required: true
+ description: The relay actor endpoint
+ example: https://example.org/actor
+ responses:
+ '200':
+ description: rule successfully deleted
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ status:
+ $ref: ../../../../components/schemas/Status.yaml#/Status
+ response:
+ $ref: ../../../../components/schemas/admin/relays.yaml#/RelayArray
diff --git a/public/openapi/write/admin/activitypub/rules.yaml b/public/openapi/write/admin/activitypub/rules.yaml
index b4ce4816ef..8a74425101 100644
--- a/public/openapi/write/admin/activitypub/rules.yaml
+++ b/public/openapi/write/admin/activitypub/rules.yaml
@@ -33,4 +33,4 @@ post:
status:
$ref: ../../../components/schemas/Status.yaml#/Status
response:
- $ref: ../../../components/schemas/admin/rulesObject.yaml#/RulesObject
+ $ref: ../../../components/schemas/admin/rules.yaml#/RulesArray
diff --git a/public/openapi/write/admin/activitypub/rules/rid.yaml b/public/openapi/write/admin/activitypub/rules/rid.yaml
index 189f6863a4..08243c16a2 100644
--- a/public/openapi/write/admin/activitypub/rules/rid.yaml
+++ b/public/openapi/write/admin/activitypub/rules/rid.yaml
@@ -22,4 +22,4 @@ delete:
status:
$ref: ../../../../components/schemas/Status.yaml#/Status
response:
- $ref: ../../../../components/schemas/admin/rulesObject.yaml#/RulesObject
+ $ref: ../../../../components/schemas/admin/rules.yaml#/RulesArray