mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-02 20:59:56 +01:00
feat(openapi): merging openapi-test branch into master
This commit is contained in:
@@ -14,8 +14,12 @@ CommonProps:
|
|||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
|
description: The path to the template, which acts as a unique name
|
||||||
|
example: admin/settings/general
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
type: object
|
description: There will be one additional property added to all routes here. It is a boolean value whose key is the path to the current template. It is used on the client-side to verify the current page inside of a conditional (e.g. `if (ajaxify.data.template.topic)` to ensure a script is run only on the topic page)
|
||||||
|
type: boolean
|
||||||
|
enum: [true]
|
||||||
url:
|
url:
|
||||||
type: string
|
type: string
|
||||||
description: Base url of the current page, does not include query params
|
description: Base url of the current page, does not include query params
|
||||||
|
|||||||
75
public/openapi/components/schemas/GroupObject.yaml
Normal file
75
public/openapi/components/schemas/GroupObject.yaml
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
GroupObject:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
description: The group name
|
||||||
|
slug:
|
||||||
|
type: string
|
||||||
|
description: URL-safe slug of the group name
|
||||||
|
createtime:
|
||||||
|
type: number
|
||||||
|
description: UNIX timestamp of the group's creation
|
||||||
|
userTitle:
|
||||||
|
type: number
|
||||||
|
description: Label text for the user badge
|
||||||
|
userTitleEnabled:
|
||||||
|
type: boolean
|
||||||
|
description:
|
||||||
|
type: string
|
||||||
|
description: The group description
|
||||||
|
memberCount:
|
||||||
|
type: number
|
||||||
|
hidden:
|
||||||
|
type: number
|
||||||
|
system:
|
||||||
|
type: number
|
||||||
|
private:
|
||||||
|
type: number
|
||||||
|
disableJoinRequests:
|
||||||
|
type: number
|
||||||
|
disableLeave:
|
||||||
|
type: number
|
||||||
|
nameEncoded:
|
||||||
|
type: string
|
||||||
|
displayName:
|
||||||
|
type: string
|
||||||
|
description: A custom override of the group's name, a friendly name
|
||||||
|
labelColor:
|
||||||
|
type: string
|
||||||
|
description: A six-character hexadecimal colour code
|
||||||
|
textColor:
|
||||||
|
type: string
|
||||||
|
description: A six-character hexadecimal colour code
|
||||||
|
icon:
|
||||||
|
type: string
|
||||||
|
description: A FontAwesome icon string
|
||||||
|
createtimeISO:
|
||||||
|
type: string
|
||||||
|
description: "`createtime` rendered as an ISO 8601 format"
|
||||||
|
cover:thumb:url:
|
||||||
|
type: string
|
||||||
|
cover:url:
|
||||||
|
type: string
|
||||||
|
cover:position:
|
||||||
|
type: string
|
||||||
|
descriptionParsed:
|
||||||
|
type: string
|
||||||
|
members:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: UserObject.yaml#/UserObjectSlim
|
||||||
|
membersNextStart:
|
||||||
|
type: number
|
||||||
|
pending:
|
||||||
|
type: array
|
||||||
|
invited:
|
||||||
|
type: array
|
||||||
|
isMember:
|
||||||
|
type: boolean
|
||||||
|
isPending:
|
||||||
|
type: boolean
|
||||||
|
isInvited:
|
||||||
|
type: boolean
|
||||||
|
isOwner:
|
||||||
|
type: boolean
|
||||||
@@ -391,4 +391,85 @@ UserObjectFull:
|
|||||||
username:disableEdit:
|
username:disableEdit:
|
||||||
type: number
|
type: number
|
||||||
email:disableEdit:
|
email:disableEdit:
|
||||||
type: number
|
type: number
|
||||||
|
UserObjectSlim:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
uid:
|
||||||
|
type: number
|
||||||
|
description: A user identifier
|
||||||
|
example: 1
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
description: A friendly name for a given user account
|
||||||
|
example: Dragon Fruit
|
||||||
|
userslug:
|
||||||
|
type: string
|
||||||
|
description: An URL-safe variant of the username (i.e. lower-cased, spaces removed, etc.)
|
||||||
|
example: dragon-fruit
|
||||||
|
picture:
|
||||||
|
type: string
|
||||||
|
description: A URL pointing to a picture to be used as the user's avatar
|
||||||
|
example: 'https://images.unsplash.com/photo-1560070094-e1f2ddec4337?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=256&h=256&q=80'
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- online
|
||||||
|
- offline
|
||||||
|
- dnd
|
||||||
|
- away
|
||||||
|
example: online
|
||||||
|
postcount:
|
||||||
|
type: number
|
||||||
|
example: 1000
|
||||||
|
reputation:
|
||||||
|
type: number
|
||||||
|
description: The user's reputation score on the forum. Out-of-the-box, users gain/lose reputation points based on upvotes/downvotes, though plugins can alter the logic and criterion for awarding reputation points
|
||||||
|
example: 100
|
||||||
|
'email:confirmed':
|
||||||
|
type: number
|
||||||
|
description: Whether the user has confirmed their email address or not
|
||||||
|
example: 1
|
||||||
|
lastonline:
|
||||||
|
type: number
|
||||||
|
description: A UNIX timestamp representing the moment the user was last recorded online on this site
|
||||||
|
example: 1585337827953
|
||||||
|
flags:
|
||||||
|
type: number
|
||||||
|
example: 0
|
||||||
|
banned:
|
||||||
|
type: number
|
||||||
|
description: A Boolean representing whether a user is banned or not
|
||||||
|
example: 0
|
||||||
|
'banned:expire':
|
||||||
|
type: number
|
||||||
|
description: A UNIX timestamp representing the moment the ban will be lifted
|
||||||
|
example: 1585337827953
|
||||||
|
joindate:
|
||||||
|
type: number
|
||||||
|
description: A UNIX timestamp representing the moment the user's account was created
|
||||||
|
example: 1585337827953
|
||||||
|
'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
|
||||||
|
example: D
|
||||||
|
'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: '#9c27b0'
|
||||||
|
joindateISO:
|
||||||
|
type: string
|
||||||
|
example: '2020-03-27T20:30:36.590Z'
|
||||||
|
lastonlineISO:
|
||||||
|
type: string
|
||||||
|
example: '2020-03-27T20:30:36.590Z'
|
||||||
|
banned_until:
|
||||||
|
type: number
|
||||||
|
description: A UNIX timestamp representing the moment a ban will be lifted
|
||||||
|
example: 0
|
||||||
|
banned_until_readable:
|
||||||
|
type: string
|
||||||
|
description: An ISO 8601 formatted date string representing the moment a ban will be lifted, or the words "Not Banned"
|
||||||
|
example: Not Banned
|
||||||
|
administrator:
|
||||||
|
type: boolean
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
22
test/api.js
Normal file
22
test/api.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('assert');
|
||||||
|
const path = require('path');
|
||||||
|
const SwaggerParser = require('@apidevtools/swagger-parser');
|
||||||
|
|
||||||
|
describe('Read API', () => {
|
||||||
|
let readApi;
|
||||||
|
|
||||||
|
it('should pass OpenAPI v3 validation', async () => {
|
||||||
|
const apiPath = path.resolve(__dirname, '../public/openapi/read.yaml');
|
||||||
|
try {
|
||||||
|
readApi = await SwaggerParser.validate(apiPath);
|
||||||
|
} catch (e) {
|
||||||
|
assert.ifError(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Write API', () => {
|
||||||
|
let writeApi;
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user