refactor: add TopicObjectSlim common schema

v1.18.x
Julian Lam 4 years ago
parent c8554b78b9
commit 22715d5413

@ -13,8 +13,7 @@ TopicObject:
description: A category identifier description: A category identifier
mainPid: mainPid:
type: number type: number
description: The post id of the first post in this topic (also called the description: The post id of the first post in this topic (also called the "original post")
"original post")
title: title:
type: string type: string
slug: slug:
@ -55,6 +54,7 @@ TopicObject:
description: An ISO 8601 formatted date string (complementing `timestamp`) description: An ISO 8601 formatted date string (complementing `timestamp`)
lastposttimeISO: lastposttimeISO:
type: string type: string
description: An ISO 8601 formatted date string (complementing `lastposttime`)
votes: votes:
type: number type: number
category: category:
@ -230,5 +230,65 @@ TopicObject:
description: A topic identifier description: A topic identifier
thumb: thumb:
type: string type: string
pinExpiry:
type: number
description: A UNIX timestamp indicating when a pinned topic will no longer be pinned (i.e. the pin has expired)
pinExpiryISO:
type: string
description: "`pinExpiry` rendered as an ISO 8601 format"
required: required:
- tid - tid
TopicObjectSlim:
description: The output of a call to `Topics.getTopicField`, these properties are always present no matter the fields passed in
type: object
properties:
tid:
type: number
description: A topic identifier
uid:
type: number
description: A user identifier
cid:
type: number
description: A category identifier
mainPid:
type: number
description: The post id of the first post in this topic (also called the "original post")
postcount:
type: number
viewcount:
type: number
postercount:
type: number
deleted:
type: number
deleterUid:
type: number
locked:
type: number
pinned:
type: number
description: Whether or not this particular topic is pinned to the top of the
category
timestamp:
type: number
timestampISO:
type: string
description: An ISO 8601 formatted date string (complementing `timestamp`)
lastposttime:
type: number
lastposttimeISO:
type: string
description: An ISO 8601 formatted date string (complementing `lastposttime`)
pinExpiry:
type: number
description: A UNIX timestamp indicating when a pinned topic will no longer be pinned (i.e. the pin has expired)
pinExpiryISO:
type: string
description: "`pinExpiry` rendered as an ISO 8601 format"
upvotes:
type: number
downvotes:
type: number
votes:
type: number

@ -15,50 +15,16 @@ get:
content: content:
application/json: application/json:
schema: schema:
type: object allOf:
properties: - $ref: ../../../components/schemas/TopicObject.yaml#/TopicObjectSlim
tid: - type: object
type: number properties:
uid: teaserPid:
type: number type: number
cid: nullable: true
type: number title:
mainPid: type: string
type: number slug:
teaserPid: type: string
type: number titleRaw:
nullable: true type: string
title:
type: string
slug:
type: string
timestamp:
type: number
lastposttime:
type: number
postercount:
type: number
postcount:
type: number
viewcount:
type: number
deleted:
type: number
locked:
type: number
pinned:
type: number
upvotes:
type: number
downvotes:
type: number
deleterUid:
type: number
titleRaw:
type: string
timestampISO:
type: string
lastposttimeISO:
type: string
votes:
type: number

@ -30,62 +30,18 @@ get:
application/json: application/json:
schema: schema:
allOf: allOf:
- $ref: ../../components/schemas/TopicObject.yaml#/TopicObjectSlim
- type: object - type: object
properties: properties:
tid:
type: number
description: A topic identifier
uid:
type: number
description: A user identifier
cid:
type: number
description: A category identifier
title: title:
type: string type: string
slug: slug:
type: string type: string
timestamp:
type: number
lastposttime:
type: number
postcount:
type: number
viewcount:
type: number
postercount:
type: number
description: The number of unique users who made a post in this topic
mainPid:
type: number
description: The post id of the first post in this topic (also called the
"original post")
teaserPid: teaserPid:
type: number type: number
nullable: true nullable: true
upvotes:
type: number
downvotes:
type: number
deleted:
type: number
locked:
type: number
pinned:
type: number
description: Whether or not this particular topic is pinned to the top of the
category
deleterUid:
type: number
titleRaw: titleRaw:
type: string type: string
timestampISO:
type: string
description: An ISO 8601 formatted date string (complementing `timestamp`)
lastposttimeISO:
type: string
votes:
type: number
tags: tags:
type: array type: array
items: items:

@ -22,162 +22,42 @@ get:
topics: topics:
type: array type: array
items: items:
type: object allOf:
properties: - $ref: ../components/schemas/TopicObject.yaml#/TopicObjectSlim
tid: - type: object
type: number
description: A topic identifier
uid:
type: number
description: A user identifier
cid:
type: number
description: A category identifier
mainPid:
type: number
description: The post id of the first post in this topic (also called the
"original post")
title:
type: string
slug:
type: string
timestamp:
type: number
lastposttime:
type: number
postcount:
type: number
viewcount:
type: number
postercount:
type: number
teaserPid:
type: number
nullable: true
upvotes:
type: number
downvotes:
type: number
deleterUid:
type: number
deleted:
type: number
locked:
type: number
pinned:
type: number
description: Whether or not this particular topic is pinned to the top of the
category
titleRaw:
type: string
timestampISO:
type: string
description: An ISO 8601 formatted date string (complementing `timestamp`)
lastposttimeISO:
type: string
votes:
type: number
category:
type: object
properties: properties:
cid: title:
type: number
description: A category identifier
name:
type: string type: string
slug: slug:
type: string type: string
icon: teaserPid:
type: string
backgroundImage:
nullable: true
imageClass:
nullable: true
type: string
bgColor:
type: string
color:
type: string
disabled:
type: number type: number
user:
type: object
properties:
uid:
type: number
description: A user identifier
username:
type: string
description: A friendly name for a given user account
displayname:
type: string
description: This is either username or fullname depending on forum and user settings
fullname:
type: string
userslug:
type: string
description: An URL-safe variant of the username (i.e. lower-cased, spaces
removed, etc.)
reputation:
type: number
postcount:
type: number
picture:
nullable: true nullable: true
titleRaw:
type: string type: string
signature: category:
nullable: true type: object
type: string properties:
banned: cid:
type: number type: number
status: description: A category identifier
type: string name:
icon:text: type: string
type: string slug:
description: A single-letter representation of a username. This is used in the type: string
auto-generated icon given to users without icon:
an avatar type: string
icon:bgColor: backgroundImage:
type: string nullable: true
description: A six-character hexadecimal colour code assigned to the user. This imageClass:
value is used in conjunction with nullable: true
`icon:text` for the user's auto-generated type: string
icon bgColor:
example: "#f44336" type: string
banned_until_readable: color:
type: string type: string
required: disabled:
- uid type: number
- username
- userslug
- reputation
- postcount
- picture
- signature
- banned
- status
- icon:text
- icon:bgColor
- banned_until_readable
teaser:
type: object
nullable: true
properties:
pid:
type: number
uid:
type: number
description: A user identifier
timestamp:
type: number
tid:
type: number
description: A topic identifier
content:
type: string
timestampISO:
type: string
description: An ISO 8601 formatted date string (complementing `timestamp`)
user: user:
type: object type: object
properties: properties:
@ -187,47 +67,125 @@ get:
username: username:
type: string type: string
description: A friendly name for a given user account description: A friendly name for a given user account
displayname:
type: string
description: This is either username or fullname depending on forum and user settings
fullname:
type: string
userslug: userslug:
type: string type: string
description: An URL-safe variant of the username (i.e. lower-cased, spaces description: An URL-safe variant of the username (i.e. lower-cased, spaces
removed, etc.) removed, etc.)
reputation:
type: number
postcount:
type: number
picture: picture:
nullable: true nullable: true
type: string type: string
signature:
nullable: true
type: string
banned:
type: number
status:
type: string
icon:text: icon:text:
type: string type: string
description: A single-letter representation of a username. This is used in the description: A single-letter representation of a username. This is used in the
auto-generated icon given to users auto-generated icon given to users without
without an avatar an avatar
icon:bgColor: icon:bgColor:
type: string type: string
description: A six-character hexadecimal colour code assigned to the user. This description: A six-character hexadecimal colour code assigned to the user. This
value is used in conjunction with value is used in conjunction with
`icon:text` for the user's `icon:text` for the user's auto-generated
auto-generated icon icon
example: "#f44336" example: "#f44336"
banned_until_readable:
type: string
required:
- uid
- username
- userslug
- reputation
- postcount
- picture
- signature
- banned
- status
- icon:text
- icon:bgColor
- banned_until_readable
teaser:
type: object
nullable: true
properties:
pid:
type: number
uid:
type: number
description: A user identifier
timestamp:
type: number
tid:
type: number
description: A topic identifier
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
tags:
type: array
items:
$ref: ../components/schemas/TagObject.yaml#/TagObject
isOwner:
type: boolean
ignored:
type: boolean
unread:
type: boolean
bookmark:
nullable: true
unreplied:
type: boolean
icons:
type: array
items:
type: string
index: index:
type: number type: number
tags:
type: array
items:
$ref: ../components/schemas/TagObject.yaml#/TagObject
isOwner:
type: boolean
ignored:
type: boolean
unread:
type: boolean
bookmark:
nullable: true
unreplied:
type: boolean
icons:
type: array
items:
type: string
index:
type: number
topicCount: topicCount:
type: number type: number
title: title:

Loading…
Cancel
Save