From 00b1fd2ee356f673f53a4190ee2d2b44b0712a27 Mon Sep 17 00:00:00 2001 From: tamaina Date: Wed, 10 May 2023 15:07:37 +0000 Subject: [PATCH] wip --- packages/misskey-js/src/schemas/following.ts | 44 +++++--------- .../misskey-js/src/schemas/gallery-post.ts | 58 +++++++------------ 2 files changed, 37 insertions(+), 65 deletions(-) diff --git a/packages/misskey-js/src/schemas/following.ts b/packages/misskey-js/src/schemas/following.ts index 2bcffbfc4..74149290b 100644 --- a/packages/misskey-js/src/schemas/following.ts +++ b/packages/misskey-js/src/schemas/following.ts @@ -1,36 +1,24 @@ +import type { JSONSchema7Definition } from 'schema-type'; + export const packedFollowingSchema = { + $id: 'https://misskey-hub.net/api/schemas/Following', + type: 'object', properties: { - id: { - type: 'string', - optional: false, nullable: false, - format: 'id', - example: 'xxxxxxxxxx', - }, + id: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, createdAt: { type: 'string', - optional: false, nullable: false, format: 'date-time', }, - followeeId: { - type: 'string', - optional: false, nullable: false, - format: 'id', - }, - followee: { - type: 'object', - optional: true, nullable: false, - ref: 'UserDetailed', - }, - followerId: { - type: 'string', - optional: false, nullable: false, - format: 'id', - }, - follower: { - type: 'object', - optional: true, nullable: false, - ref: 'UserDetailed', - }, + followeeId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + followee: { $ref: 'https://misskey-hub.net/api/schemas/UserDetailed' }, + followerId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + follower: { $ref: 'https://misskey-hub.net/api/schemas/UserDetailed' }, }, -} as const; + required: [ + 'id', + 'createdAt', + 'followeeId', + 'followerId', + ], +} as const satisfies JSONSchema7Definition; diff --git a/packages/misskey-js/src/schemas/gallery-post.ts b/packages/misskey-js/src/schemas/gallery-post.ts index fc503d4a6..277403a30 100644 --- a/packages/misskey-js/src/schemas/gallery-post.ts +++ b/packages/misskey-js/src/schemas/gallery-post.ts @@ -1,69 +1,53 @@ +import type { JSONSchema7Definition } from 'schema-type'; + export const packedGalleryPostSchema = { + $id: 'https://misskey-hub.net/api/schemas/GalleryPost', + type: 'object', properties: { - id: { - type: 'string', - optional: false, nullable: false, - format: 'id', - example: 'xxxxxxxxxx', - }, + id: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, createdAt: { type: 'string', - optional: false, nullable: false, format: 'date-time', }, updatedAt: { type: 'string', - optional: false, nullable: false, format: 'date-time', }, title: { type: 'string', - optional: false, nullable: false, }, description: { - type: 'string', - optional: false, nullable: true, - }, - userId: { - type: 'string', - optional: false, nullable: false, - format: 'id', - }, - user: { - type: 'object', - ref: 'UserLite', - optional: false, nullable: false, + type: ['string', 'null'], }, + userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, fileIds: { type: 'array', - optional: true, nullable: false, - items: { - type: 'string', - optional: false, nullable: false, - format: 'id', - }, + items: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, }, files: { type: 'array', - optional: true, nullable: false, - items: { - type: 'object', - optional: false, nullable: false, - ref: 'DriveFile', - }, + items: { $ref: 'https://misskey-hub.net/api/schemas/DriveFile' }, }, tags: { type: 'array', - optional: true, nullable: false, items: { type: 'string', - optional: false, nullable: false, }, }, isSensitive: { type: 'boolean', - optional: false, nullable: false, }, }, -} as const; + required: [ + 'id', + 'createdAt', + 'updatedAt', + 'title', + 'description', + 'userId', + 'user', + 'isSensitive', + ], +} as const satisfies JSONSchema7Definition;