This commit is contained in:
tamaina 2023-05-29 16:26:16 +00:00
parent 78558eb666
commit 07bbadbbdc
5 changed files with 117 additions and 91 deletions

View file

@ -0,0 +1,86 @@
import type { JSONSchema7Definition } from 'schema-type';
export const ServerInfoSchema = {
$id: 'https://misskey-hub.net/api/schemas/ServerInfo',
type: 'object',
properties: {
machine: {
type: 'string',
},
cpu: {
type: 'object',
properties: {
model: { type: 'string' },
cores: { type: 'number' },
},
required: ['model', 'cores'],
},
mem: {
type: 'object',
properties: {
total: { type: 'number', format: 'bytes' },
},
required: ['total'],
},
fs: {
type: 'object',
properties: {
total: { type: 'number', format: 'bytes' },
used: { type: 'number', format: 'bytes' },
},
},
},
required: [
'machine',
'cpu',
'mem',
'fs',
],
} as const satisfies JSONSchema7Definition;
export const ServerInfoAdminSchema = {
$id: 'https://misskey-hub.net/api/schemas/ServerInfoAdmin',
allOf: [
{ $ref: 'https://misskey-hub.net/api/schemas/ServerInfo' },
{
type: 'object',
properties: {
os: {
type: 'string',
enum: [
// NodeJS.Platform
'aix',
'android',
'darwin',
'freebsd',
'haiku',
'linux',
'openbsd',
'sunos',
'win32',
'cygwin',
'netbsd',
]
},
node: { type: 'string', examples: ['v14.17.0'] },
psql: { type: 'string' },
redis: { type: 'string' },
net: {
type: 'object',
properties: {
interface: { type: 'string', examples: ['eth0'] },
},
required: ['interface'],
},
},
required: [
'os',
'node',
'psql',
'net',
],
},
],
} as const satisfies JSONSchema7Definition;