From 55d0a9ffeae3ec9f4c10788d1609572bd2af22f6 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 8 Apr 2020 22:06:22 -0400 Subject: [PATCH] fix(openapi): added CategoryObject component --- .../components/schemas/CategoryObject.yaml | 65 ++ public/openapi/read.yaml | 804 ++++++------------ 2 files changed, 323 insertions(+), 546 deletions(-) create mode 100644 public/openapi/components/schemas/CategoryObject.yaml diff --git a/public/openapi/components/schemas/CategoryObject.yaml b/public/openapi/components/schemas/CategoryObject.yaml new file mode 100644 index 0000000000..fa8af2d41d --- /dev/null +++ b/public/openapi/components/schemas/CategoryObject.yaml @@ -0,0 +1,65 @@ +CategoryObject: + type: object + properties: + cid: + type: number + description: A category identifier assigned upon category creation (this value cannot be changed) + name: + type: string + description: The category's name/title + description: + type: string + description: A variable-length description of the category (usually displayed underneath the category name) + descriptionParsed: + type: string + description: A variable-length description of the category (usually displayed underneath the category name). Unlike `description`, this value here will have been run through any parsers installed on the forum (e.g. Markdown) + icon: + type: string + description: A FontAwesome icon string + example: fa-comments-o + bgColor: + type: string + description: Theme-related, a six-character hexadecimal string representing the background colour of the category + color: + type: string + description: Theme-related, a six-character hexadecimal string representing the foreground/text colour of the category + slug: + type: string + description: An URL-safe variant of the category title. This value is automatically generated. + readOnly: true + parentCid: + type: number + description: The category identifier for the category that is the immediate ancestor of the current category + topic_count: + type: number + description: The number of topics in the category + post_count: + type: number + description: The number of posts in the category + disabled: + type: number + description: Whether or not this category is disabled. + order: + type: number + description: A number representing the category's place in the hierarchy + link: + type: string + description: If set, attempting to access the forum will go to this external link instead (theme-specific) + numRecentReplies: + type: number + description: The number of posts to render in the API response (this is mostly used at the theme level) + class: + type: string + description: Values that are appended to the `class` attribute of the category's parent/root element + imageClass: + type: string + enum: [auto, cover, contain] + description: The `background-position` of the category background image, if one is set + isSection: + type: number + totalPostCount: + type: number + description: The number of posts in the category + totalTopicCount: + type: number + description: The number of topics in the category \ No newline at end of file diff --git a/public/openapi/read.yaml b/public/openapi/read.yaml index 4a9c6d3dda..721e931ebf 100644 --- a/public/openapi/read.yaml +++ b/public/openapi/read.yaml @@ -61,310 +61,164 @@ paths: categories: type: array items: - type: object - properties: - cid: - type: number - description: A category identifier - name: - type: string - description: - type: string - icon: - type: string - slug: - type: string - topic_count: - type: number - description: The number of topics in the category - order: - type: number - bgColor: - type: string - link: - type: string - class: - type: string - numRecentReplies: - type: number - color: - type: string - post_count: - type: number - description: The number of posts in the category - descriptionParsed: - type: string - parentCid: - type: number - description: The category identifier for the category that is the immediate - ancestor of the current category - disabled: - type: number - isSection: - type: number - totalPostCount: - type: number - description: The number of posts in the category - totalTopicCount: - type: number - description: The number of topics in the category - tagWhitelist: - type: array - items: {} - unread-class: - type: string - children: - type: array - items: - type: object - properties: - cid: - type: number - description: A category identifier - name: - type: string - description: - type: string - icon: - type: string - slug: - type: string - topic_count: - type: number - description: The number of topics in the category - order: - type: number - bgColor: - type: string - link: - type: string - class: - type: string - numRecentReplies: - type: number - color: - type: string - post_count: - type: number - description: The number of posts in the category - parentCid: - type: number - description: The category identifier for the category that is the immediate - ancestor of the current category - disabled: - type: number - isSection: - type: number - totalPostCount: - type: number - description: The number of posts in the category - totalTopicCount: - type: number - description: The number of topics in the category - descriptionParsed: - type: string - tagWhitelist: - type: array - items: {} - unread-class: - type: string - children: - type: array - items: {} - parent: + allOf: + - $ref: components/schemas/CategoryObject.yaml#/CategoryObject + - type: object + properties: + children: + type: array + items: + allOf: + - $ref: components/schemas/CategoryObject.yaml#/CategoryObject + - type: object + properties: + tagWhitelist: + type: array + items: {} + unread-class: + type: string + children: + type: array + items: {} + parent: + $ref: components/schemas/CategoryObject.yaml#/CategoryObject + posts: + type: array + items: + type: object + properties: + pid: + type: number + timestamp: + type: number + content: + type: string + timestampISO: + type: string + description: An ISO 8601 formatted date string (complementing `timestamp`) + user: + type: object + properties: + uid: + type: number + description: A user identifier + username: + type: string + description: A friendly name for a given user account + userslug: + type: string + description: An URL-safe variant of the username (i.e. lower-cased, spaces + removed, etc.) + picture: + nullable: true + type: string + icon:text: + type: string + description: A single-letter representation of a username. This is used in the + auto-generated icon given to + users without an avatar + icon:bgColor: + type: string + description: A six-character hexadecimal colour code assigned to the user. This + value is used in conjunction + with `icon:text` for the user's + auto-generated icon + example: "#f44336" + index: + type: number + cid: + type: number + description: A category identifier + parentCid: + type: number + description: The category identifier for the category that is the immediate + ancestor of the current category + topic: + type: object + properties: + slug: + type: string + title: + type: string + imageClass: + type: string + timesClicked: + type: number + posts: + type: array + items: type: object properties: - link: - type: string - class: - type: string - icon: - type: string - description: - type: string - order: + pid: type: number - topic_count: + timestamp: type: number - description: The number of topics in the category - name: + content: type: string + timestampISO: + type: string + description: An ISO 8601 formatted date string (complementing `timestamp`) + user: + type: object + properties: + uid: + type: number + description: A user identifier + username: + type: string + description: A friendly name for a given user account + userslug: + type: string + description: An URL-safe variant of the username (i.e. lower-cased, spaces + removed, etc.) + picture: + nullable: true + type: string + icon:text: + type: string + description: A single-letter representation of a username. This is used in the + auto-generated icon given to users + without an avatar + icon:bgColor: + type: string + description: A six-character hexadecimal colour code assigned to the user. This + value is used in conjunction with + `icon:text` for the user's + auto-generated icon + example: "#f44336" + index: + type: number cid: type: number description: A category identifier - post_count: - type: number - description: The number of posts in the category - numRecentReplies: - type: number - bgColor: - type: string - slug: - type: string - color: - type: string - disabled: - type: number - descriptionParsed: - type: string - isSection: - type: number parentCid: type: number description: The category identifier for the category that is the immediate ancestor of the current category - totalPostCount: - type: number - description: The number of posts in the category - totalTopicCount: - type: number - description: The number of topics in the category - tagWhitelist: - type: array - items: {} - unread-class: - type: string - imageClass: - type: string - posts: - type: array - items: - type: object - properties: - pid: - type: number - timestamp: - type: number - content: - type: string - timestampISO: - type: string - description: An ISO 8601 formatted date string (complementing `timestamp`) - user: - type: object - properties: - uid: - type: number - description: A user identifier - username: - type: string - description: A friendly name for a given user account - userslug: - type: string - description: An URL-safe variant of the username (i.e. lower-cased, spaces - removed, etc.) - picture: - nullable: true - type: string - icon:text: - type: string - description: A single-letter representation of a username. This is used in the - auto-generated icon given to - users without an avatar - icon:bgColor: - type: string - description: A six-character hexadecimal colour code assigned to the user. This - value is used in conjunction - with `icon:text` for the user's - auto-generated icon - example: "#f44336" - index: - type: number - cid: - type: number - description: A category identifier - parentCid: - type: number - description: The category identifier for the category that is the immediate - ancestor of the current category - topic: - type: object - properties: - slug: - type: string - title: - type: string - imageClass: - type: string - timesClicked: - type: number - posts: - type: array - items: - type: object - properties: - pid: - type: number - timestamp: - type: number - content: - type: string - timestampISO: - type: string - description: An ISO 8601 formatted date string (complementing `timestamp`) - user: - type: object - properties: - uid: - type: number - description: A user identifier - username: - type: string - description: A friendly name for a given user account - userslug: - type: string - description: An URL-safe variant of the username (i.e. lower-cased, spaces - removed, etc.) - picture: - nullable: true - type: string - icon:text: - type: string - description: A single-letter representation of a username. This is used in the - auto-generated icon given to users - without an avatar - icon:bgColor: - type: string - description: A six-character hexadecimal colour code assigned to the user. This - value is used in conjunction with - `icon:text` for the user's - auto-generated icon - example: "#f44336" - index: - type: number - cid: - type: number - description: A category identifier - parentCid: - type: number - description: The category identifier for the category that is the immediate - ancestor of the current category - topic: - type: object - properties: - slug: - type: string - title: - type: string - teaser: - type: object - properties: - url: - type: string - timestampISO: - type: string - description: An ISO 8601 formatted date string (complementing `timestamp`) - pid: - type: number - topic: + topic: + type: object + properties: + slug: + type: string + title: + type: string + teaser: type: object properties: - slug: + url: type: string - title: + timestampISO: type: string - imageClass: - type: string + description: An ISO 8601 formatted date string (complementing `timestamp`) + pid: + type: number + topic: + type: object + properties: + slug: + type: string + title: + type: string topics: type: array items: @@ -3832,6 +3686,7 @@ paths: application/json: schema: allOf: + - $ref: components/schemas/CategoryObject.yaml#/CategoryObject - type: object properties: tid: @@ -4041,54 +3896,6 @@ paths: type: boolean display_post_menu: type: boolean - category: - type: object - properties: - link: - type: string - class: - type: string - icon: - type: string - description: - type: string - order: - type: number - topic_count: - type: number - description: The number of topics in the category - name: - type: string - cid: - type: number - description: A category identifier - post_count: - type: number - description: The number of posts in the category - numRecentReplies: - type: number - bgColor: - type: string - slug: - type: string - color: - type: string - disabled: - type: number - descriptionParsed: - type: string - isSection: - type: number - parentCid: - type: number - description: The category identifier for the category that is the immediate - ancestor of the current category - totalPostCount: - type: number - description: The number of posts in the category - totalTopicCount: - type: number - description: The number of topics in the category tagWhitelist: type: array items: {} @@ -4226,6 +4033,7 @@ paths: application/json: schema: allOf: + - $ref: components/schemas/CategoryObject.yaml#/CategoryObject - type: object properties: tid: @@ -4491,54 +4299,6 @@ paths: username: type: string description: A friendly name for a given user account - category: - type: object - properties: - link: - type: string - class: - type: string - icon: - type: string - description: - type: string - order: - type: number - topic_count: - type: number - description: The number of topics in the category - name: - type: string - cid: - type: number - description: A category identifier - post_count: - type: number - description: The number of posts in the category - numRecentReplies: - type: number - bgColor: - type: string - slug: - type: string - color: - type: string - disabled: - type: number - descriptionParsed: - type: string - isSection: - type: number - parentCid: - type: number - description: The category identifier for the category that is the immediate - ancestor of the current category - totalPostCount: - type: number - description: The number of posts in the category - totalTopicCount: - type: number - description: The number of topics in the category tagWhitelist: type: array items: {} @@ -4988,186 +4748,138 @@ paths: posts: type: array items: - type: object - properties: - id: - type: string - uid: - type: number - description: A user identifier - type: - type: string - data: - type: object + allOf: + - type: object properties: - title: + id: type: string - content: - type: string - thumb: - type: string - cid: - oneOf: - - type: number - - type: string - tags: - type: array - items: {} uid: type: number description: A user identifier - req: + type: + type: string + data: type: object properties: + title: + type: string + content: + type: string + thumb: + type: string + cid: + oneOf: + - type: number + - type: string + tags: + type: array + items: {} uid: type: number description: A user identifier - ip: - type: string - host: - type: string - protocol: - type: string - secure: - type: boolean - url: - type: string - path: - type: string - headers: + req: type: object properties: - x-real-ip: - type: string - x-forwarded-for: - type: string - x-forwarded-proto: + uid: + type: number + description: A user identifier + ip: type: string host: type: string - x-nginx-proxy: + protocol: type: string - connection: + secure: + type: boolean + url: type: string - accept: + path: type: string - user-agent: - type: string - sec-fetch-site: - type: string - sec-fetch-mode: - type: string - referer: - type: string - accept-encoding: - type: string - accept-language: - type: string - cookie: - type: string - timestamp: - type: number - fromQueue: - type: boolean - timestampISO: - type: string - description: An ISO 8601 formatted date string (complementing `timestamp`) - rawContent: - type: string - tid: - type: number - description: A topic identifier - toPid: - nullable: true - user: - type: object - properties: - username: - type: string - description: A friendly name for a given user account - userslug: - type: string - description: An URL-safe variant of the username (i.e. lower-cased, spaces - removed, etc.) - picture: - nullable: true - type: string - uid: - type: number - description: A user identifier - icon:text: - type: string - description: A single-letter representation of a username. This is used in the - auto-generated icon given to users without - an avatar - icon:bgColor: - type: string - description: A six-character hexadecimal colour code assigned to the user. This - value is used in conjunction with - `icon:text` for the user's auto-generated - icon - example: "#f44336" - topic: - type: object - properties: - cid: - oneOf: - - type: number - - type: string - title: - type: string - titleRaw: - type: string - category: - type: object - properties: - cid: - type: number - description: A category identifier - name: - type: string - description: - type: string - icon: - type: string - bgColor: - type: string - color: - type: string - slug: - type: string - parentCid: - type: number - description: The category identifier for the category that is the immediate - ancestor of the current category - topic_count: - type: number - description: The number of topics in the category - post_count: - type: number - description: The number of posts in the category - disabled: - type: number - order: - type: number - link: - type: string - numRecentReplies: - type: number - class: - type: string - imageClass: - type: string - descriptionParsed: - type: string - isSection: - type: number - totalPostCount: - type: number - description: The number of posts in the category - totalTopicCount: - type: number - description: The number of topics in the category + headers: + type: object + properties: + x-real-ip: + type: string + x-forwarded-for: + type: string + x-forwarded-proto: + type: string + host: + type: string + x-nginx-proxy: + type: string + connection: + type: string + accept: + type: string + user-agent: + type: string + sec-fetch-site: + type: string + sec-fetch-mode: + type: string + referer: + type: string + accept-encoding: + type: string + accept-language: + type: string + cookie: + type: string + timestamp: + type: number + fromQueue: + type: boolean + timestampISO: + type: string + description: An ISO 8601 formatted date string (complementing `timestamp`) + rawContent: + type: string + tid: + type: number + description: A topic identifier + toPid: + nullable: true + user: + type: object + properties: + username: + type: string + description: A friendly name for a given user account + userslug: + type: string + description: An URL-safe variant of the username (i.e. lower-cased, spaces + removed, etc.) + picture: + nullable: true + type: string + uid: + type: number + description: A user identifier + icon:text: + type: string + description: A single-letter representation of a username. This is used in the + auto-generated icon given to users without + an avatar + icon:bgColor: + type: string + description: A six-character hexadecimal colour code assigned to the user. This + value is used in conjunction with + `icon:text` for the user's auto-generated + icon + example: "#f44336" + topic: + type: object + properties: + cid: + oneOf: + - type: number + - type: string + title: + type: string + titleRaw: + type: string + - $ref: components/schemas/CategoryObject.yaml#/CategoryObject - $ref: components/schemas/Pagination.yaml#/Pagination - $ref: components/schemas/CommonProps.yaml#/CommonProps /api/ip-blacklist: