docs: update openapi schema for relays and rules

This commit is contained in:
Julian Lam
2025-08-27 14:16:24 -04:00
parent 40973ca7d1
commit a9a12a9f08
8 changed files with 99 additions and 43 deletions

View File

@@ -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'

View File

@@ -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'

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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