server: improve API validation for creating apps

Resolves a FIXME comment.
This commit is contained in:
Johann150 2022-11-05 10:43:34 +01:00
parent 6f65326b32
commit 489eea0c67
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -2,6 +2,7 @@ import { Apps } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
import { unique } from '@/prelude/array.js';
import { secureRndstr } from '@/misc/secure-rndstr.js';
import { kinds } from '@/misc/api-permissions.js';
import define from '../../define.js';
export const meta = {
@ -21,10 +22,14 @@ export const paramDef = {
properties: {
name: { type: 'string' },
description: { type: 'string' },
permission: { type: 'array', uniqueItems: true, items: {
permission: {
type: 'array',
uniqueItems: true,
items: {
type: 'string',
// FIXME: add enum of possible permissions
} },
enum: kinds,
},
},
callbackUrl: { type: 'string', nullable: true },
},
required: ['name', 'description', 'permission'],