docs: openapi schema fixes for auto-categorization commits

This commit is contained in:
Julian Lam
2025-08-25 12:05:50 -04:00
parent 165af50dc8
commit c0248ca52b
6 changed files with 105 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
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

@@ -48,6 +48,8 @@ get:
type: string type: string
order: order:
type: number type: number
isLocal:
type: boolean
subCategoriesPerPage: subCategoriesPerPage:
type: number type: number
children: children:

View File

@@ -16,4 +16,25 @@ get:
instanceCount: instanceCount:
type: number type: number
description: The number of ActivityPub-enabled instances that this forum knows about. 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/CommonProps.yaml#/CommonProps - $ref: ../../../components/schemas/CommonProps.yaml#/CommonProps

View File

@@ -0,0 +1,36 @@
post:
tags:
- admin
summary: create auto-categorization rule
description: This operation creates a new auto-categorization rule that is applied to new remote content received via ActivityPub.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
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
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/rulesObject.yaml#/RulesObject

View File

@@ -0,0 +1,25 @@
delete:
tags:
- admin
summary: delete auto-categorization rule
description: This operation deletes a previously set-up auto-categorization rule
parameters:
- in: path
name: rid
schema:
type: string
required: true
description: a valid rule ID
example: 4eb506f8-a173-4693-a41b-e23604bc973a
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/rulesObject.yaml#/RulesObject

View File

@@ -72,7 +72,6 @@ categoriesController.getAll = async function (req, res) {
let categoriesData = await categories.getCategoriesFields(cids, fields); let categoriesData = await categories.getCategoriesFields(cids, fields);
({ categories: categoriesData } = await plugins.hooks.fire('filter:admin.categories.get', { categories: categoriesData, fields: fields })); ({ categories: categoriesData } = await plugins.hooks.fire('filter:admin.categories.get', { categories: categoriesData, fields: fields }));
// Append remote categories
categoriesData = categoriesData.map((category) => { categoriesData = categoriesData.map((category) => {
category.isLocal = utils.isNumber(category.cid); category.isLocal = utils.isNumber(category.cid);
return category; return category;