Skip to content

Node.js based forum software built for the modern web

fix(writeapi): fix components, + tag object schema

Julian Lam9f9e3c1582cc
diff --git a/public/openapi/components/schemas/PostObject.yaml b/public/openapi/components/schemas/PostObject.yaml
index 04c7e40937..563d682905 100644
--- a/public/openapi/components/schemas/PostObject.yaml
+++ b/public/openapi/components/schemas/PostObject.yaml
@@ -85,6 +85,22 @@ PostObject:
nullable: true
titleRaw:
type: string
+ oldTitle:
+ type: string
+ isMainPost:
+ type: boolean
+ renamed:
+ type: true
+ tags:
+ type: array
+ items:
+ $ref: ../../components/schemas/TagObject.yaml#/TagObject
+ required:
+ - uid
+ - tid
+ - cid
+ - title
+ - slug
category:
type: object
properties:
diff --git a/public/openapi/components/schemas/TagObject.yaml b/public/openapi/components/schemas/TagObject.yaml
new file mode 100644
index 0000000000..2b72c5a1c9
--- /dev/null
+++ b/public/openapi/components/schemas/TagObject.yaml
@@ -0,0 +1,19 @@
+TagObject:
+ type: object
+ properties:
+ value:
+ type: string
+ description: The tag name
+ score:
+ type: number
+ description: The number of topics containing this tag
+ valueEscaped:
+ type: string
+ color:
+ type: string
+ description: Six-character hexadecimal string (with `#` prepended)
+ example: "#ff0000"
+ bgColor:
+ type: string
+ description: Six-character hexadecimal string (with `#` prepended)
+ example: "#ff0000"
\ No newline at end of file
diff --git a/public/openapi/read/admin/manage/tags.yaml b/public/openapi/read/admin/manage/tags.yaml
index d0415b29fb..f42d4df021 100644
--- a/public/openapi/read/admin/manage/tags.yaml
+++ b/public/openapi/read/admin/manage/tags.yaml
@@ -14,22 +14,5 @@ get:
tags:
type: array
items:
- type: object
- properties:
- value:
- type: string
- description: The tag name
- score:
- type: number
- description: The number of topics containing this tag
- valueEscaped:
- type: string
- color:
- type: string
- description: Six-character hexadecimal string (with `#` prepended)
- example: "#ff0000"
- bgColor:
- type: string
- description: Six-character hexadecimal string (with `#` prepended)
- example: "#ff0000"
+ $ref: ../../../components/schemas/TagObject.yaml#/TagObject
- $ref: ../../../components/schemas/CommonProps.yaml#/CommonProps
\ No newline at end of file
diff --git a/public/openapi/read/tags.yaml b/public/openapi/read/tags.yaml
index 1627289401..05f407ef18 100644
--- a/public/openapi/read/tags.yaml
+++ b/public/openapi/read/tags.yaml
@@ -16,21 +16,7 @@ get:
type: array
description: An array of tags sorted by the most topics
items:
- type: object
- properties:
- value:
- type: string
- description: The raw tag
- score:
- type: number
- description: Number of topics tagged by this tag
- valueEscaped:
- type: string
- description: This is the escaped tag value, equal to validator.escape(value)
- color:
- type: string
- bgColor:
- type: string
+ $ref: ../components/schemas/TagObject.yaml#/TagObject
displayTagSearch:
type: boolean
nextStart:
diff --git a/public/openapi/read/tags/tag.yaml b/public/openapi/read/tags/tag.yaml
index 9a0a79f7a2..cae61daf61 100644
--- a/public/openapi/read/tags/tag.yaml
+++ b/public/openapi/read/tags/tag.yaml
@@ -200,18 +200,7 @@ get:
tags:
type: array
items:
- type: object
- properties:
- value:
- type: string
- valueEscaped:
- type: string
- color:
- type: string
- bgColor:
- type: string
- score:
- type: number
+ $ref: ../../components/schemas/TagObject.yaml#/TagObject
isOwner:
type: boolean
ignored:
diff --git a/public/openapi/read/topic/topic_id/slug/post_index.yaml b/public/openapi/read/topic/topic_id/slug/post_index.yaml
index d9374eff97..514f3065e5 100644
--- a/public/openapi/read/topic/topic_id/slug/post_index.yaml
+++ b/public/openapi/read/topic/topic_id/slug/post_index.yaml
@@ -89,18 +89,7 @@ get:
tags:
type: array
items:
- type: object
- properties:
- value:
- type: string
- valueEscaped:
- type: string
- color:
- type: string
- bgColor:
- type: string
- score:
- type: number
+ $ref: ../../../../components/schemas/TagObject.yaml#/TagObject
posts:
type: array
items:
diff --git a/public/openapi/read/unread.yaml b/public/openapi/read/unread.yaml
index f4eb7913bc..c6e8f16cf0 100644
--- a/public/openapi/read/unread.yaml
+++ b/public/openapi/read/unread.yaml
@@ -189,18 +189,7 @@ get:
tags:
type: array
items:
- type: object
- properties:
- value:
- type: string
- valueEscaped:
- type: string
- color:
- type: string
- bgColor:
- type: string
- score:
- type: number
+ $ref: ../components/schemas/TagObject.yaml#/TagObject
isOwner:
type: boolean
ignored:
diff --git a/public/openapi/write/posts/pid.yaml b/public/openapi/write/posts/pid.yaml
index 28a6bb0bde..2d439bd8f0 100644
--- a/public/openapi/write/posts/pid.yaml
+++ b/public/openapi/write/posts/pid.yaml
@@ -39,7 +39,14 @@ put:
status:
$ref: ../../components/schemas/Status.yaml#/Status
response:
- $ref: ../../components/schemas/PostObject.yaml#/PostObject
+ allOf:
+ - $ref: ../../components/schemas/PostObject.yaml#/PostObject
+ - type: object
+ properties:
+ edited:
+ type: boolean
+ deleterUid:
+ type: number
delete:
tags:
- posts