This commit is contained in:
tamaina 2023-05-10 14:45:31 +00:00
parent fc10a9026c
commit 32e489e536
1 changed files with 65 additions and 50 deletions

View File

@ -1,107 +1,122 @@
import type { JSONSchema7Definition } from 'schema-type';
export const packedDriveFileSchema = { export const packedDriveFileSchema = {
$id: 'https://misskey-hub.net/api/schemas/DriveFile',
type: 'object', type: 'object',
properties: { properties: {
id: { id: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
type: 'string',
optional: false, nullable: false,
format: 'id',
example: 'xxxxxxxxxx',
},
createdAt: { createdAt: {
type: 'string', type: 'string',
optional: false, nullable: false,
format: 'date-time', format: 'date-time',
}, },
name: { name: {
type: 'string', type: 'string',
optional: false, nullable: false, examples: 'lenna.jpg',
example: 'lenna.jpg',
}, },
type: { type: {
type: 'string', type: 'string',
optional: false, nullable: false, examples: 'image/jpeg',
example: 'image/jpeg',
}, },
md5: { md5: {
type: 'string', type: 'string',
optional: false, nullable: false,
format: 'md5', format: 'md5',
example: '15eca7fba0480996e2245f5185bf39f2', examples: '15eca7fba0480996e2245f5185bf39f2',
}, },
size: { size: {
type: 'number', type: 'number',
optional: false, nullable: false, examples: 51469,
example: 51469,
}, },
isSensitive: { isSensitive: {
type: 'boolean', type: 'boolean',
optional: false, nullable: false,
}, },
blurhash: { blurhash: {
type: 'string', type: ['string', 'null'],
optional: false, nullable: true,
}, },
properties: { properties: {
type: 'object', type: 'object',
optional: false, nullable: false,
properties: { properties: {
width: { width: {
type: 'number', type: 'number',
optional: true, nullable: false, examples: 1280,
example: 1280,
}, },
height: { height: {
type: 'number', type: 'number',
optional: true, nullable: false, examples: 720,
example: 720,
}, },
orientation: { orientation: {
type: 'number', type: 'number',
optional: true, nullable: false, examples: 8,
example: 8,
}, },
avgColor: { avgColor: {
type: 'string', type: 'string',
optional: true, nullable: false, examples: 'rgb(40,65,87)',
example: 'rgb(40,65,87)',
}, },
}, },
required: [],
}, },
url: { url: {
type: 'string', oneOf: [{
optional: false, nullable: true, type: 'string',
format: 'url', format: 'url',
}, {
type: 'null',
}],
}, },
thumbnailUrl: { thumbnailUrl: {
type: 'string', oneOf: [{
optional: false, nullable: true, type: 'string',
format: 'url', format: 'url',
}, {
type: 'null',
}],
}, },
comment: { comment: {
type: 'string', type: ['string', 'null'],
optional: false, nullable: true,
}, },
folderId: { folderId: {
type: 'string', oneOf: [{
optional: false, nullable: true, $ref: 'https://misskey-hub.net/api/schemas/Id',
format: 'id', }, {
example: 'xxxxxxxxxx', type: 'null',
}],
}, },
folder: { folder: {
type: 'object', oneOf: [{
optional: true, nullable: true, $ref: 'https://misskey-hub.net/api/schemas/DriveFolder',
ref: 'DriveFolder', }, {
type: 'null',
}],
}, },
userId: { userId: {
type: 'string', oneOf: [{
optional: false, nullable: true, $ref: 'https://misskey-hub.net/api/schemas/Id',
format: 'id', }, {
example: 'xxxxxxxxxx', type: 'null',
}],
}, },
user: { user: {
type: 'object', oneOf: [{
optional: true, nullable: true, $ref: 'https://misskey-hub.net/api/schemas/UserLite',
ref: 'UserLite', }, {
type: 'null',
}],
}, },
}, },
} as const; required: [
'id',
'createdAt',
'name',
'type',
'md5',
'size',
'isSensitive',
'burlhash',
'properties',
'url',
'thumbnailUrl',
'comment',
'folderId',
'userId',
],
} as const satisfies JSONSchema7Definition;