forked from mirror/misskey
anyOf内にバリデーションを書いても最初の一つしかチェックされない
This commit is contained in:
parent
43cfb5092a
commit
c8111659e1
@ -103,18 +103,15 @@ export const paramDef = {
|
||||
replyId: { type: 'string', format: 'misskey:id', nullable: true },
|
||||
renoteId: { type: 'string', format: 'misskey:id', nullable: true },
|
||||
channelId: { type: 'string', format: 'misskey:id', nullable: true },
|
||||
|
||||
// anyOf内にバリデーションを書いても最初の一つしかチェックされない
|
||||
// See https://github.com/misskey-dev/misskey/pull/10082
|
||||
text: {
|
||||
type: 'string',
|
||||
minLength: 1,
|
||||
maxLength: MAX_NOTE_TEXT_LENGTH,
|
||||
nullable: false
|
||||
},
|
||||
anyOf: [
|
||||
{
|
||||
// (re)note with text, files and poll are optional
|
||||
properties: {
|
||||
text: { type: 'string', minLength: 1, maxLength: MAX_NOTE_TEXT_LENGTH, nullable: false },
|
||||
},
|
||||
required: ['text'],
|
||||
},
|
||||
{
|
||||
// (re)note with files, text and poll are optional
|
||||
properties: {
|
||||
fileIds: {
|
||||
type: 'array',
|
||||
uniqueItems: true,
|
||||
@ -122,27 +119,13 @@ export const paramDef = {
|
||||
maxItems: 16,
|
||||
items: { type: 'string', format: 'misskey:id' },
|
||||
},
|
||||
},
|
||||
required: ['fileIds'],
|
||||
},
|
||||
{
|
||||
// (re)note with files, text and poll are optional
|
||||
properties: {
|
||||
mediaIds: {
|
||||
deprecated: true,
|
||||
description: 'Use `fileIds` instead. If both are specified, this property is discarded.',
|
||||
type: 'array',
|
||||
uniqueItems: true,
|
||||
minItems: 1,
|
||||
maxItems: 16,
|
||||
items: { type: 'string', format: 'misskey:id' },
|
||||
},
|
||||
},
|
||||
required: ['mediaIds'],
|
||||
},
|
||||
{
|
||||
// (re)note with poll, text and files are optional
|
||||
properties: {
|
||||
poll: {
|
||||
type: 'object',
|
||||
nullable: true,
|
||||
@ -161,6 +144,30 @@ export const paramDef = {
|
||||
required: ['choices'],
|
||||
},
|
||||
},
|
||||
// (re)note with text, files and poll are optional
|
||||
anyOf: [
|
||||
{
|
||||
properties: {
|
||||
text: { type: 'string' },
|
||||
},
|
||||
required: ['text'],
|
||||
},
|
||||
{
|
||||
properties: {
|
||||
fileIds: { type: 'array' },
|
||||
},
|
||||
required: ['fileIds'],
|
||||
},
|
||||
{
|
||||
properties: {
|
||||
mediaIds: { type: 'array' },
|
||||
},
|
||||
required: ['mediaIds'],
|
||||
},
|
||||
{
|
||||
properties: {
|
||||
poll: { type: 'object' },
|
||||
},
|
||||
required: ['poll'],
|
||||
},
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user