From fc10a9026c381dfe3a1bde42374ea4bf9a34af5d Mon Sep 17 00:00:00 2001 From: tamaina Date: Wed, 10 May 2023 14:37:01 +0000 Subject: [PATCH] wip --- packages/misskey-js/src/schemas/clip.ts | 53 ++++++++++++------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/packages/misskey-js/src/schemas/clip.ts b/packages/misskey-js/src/schemas/clip.ts index 7310e59013..4930d2bb34 100644 --- a/packages/misskey-js/src/schemas/clip.ts +++ b/packages/misskey-js/src/schemas/clip.ts @@ -1,51 +1,50 @@ +import type { JSONSchema7Definition } from 'schema-type'; + export const packedClipSchema = { + $id: 'https://misskey-hub.net/api/schemas/Clip', + 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', }, lastClippedAt: { - type: 'string', - optional: false, nullable: true, - format: 'date-time', - }, - userId: { - type: 'string', - optional: false, nullable: false, - format: 'id', - }, - user: { - type: 'object', - ref: 'UserLite', - optional: false, nullable: false, + oneOf: [{ + type: 'string', + format: 'date-time', + }, { + type: 'null', + }], }, + userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' }, name: { type: 'string', - optional: false, nullable: false, }, description: { - type: 'string', - optional: false, nullable: true, + type: ['string', 'null'], }, isPublic: { type: 'boolean', - optional: false, nullable: false, }, isFavorited: { type: 'boolean', - optional: true, nullable: false, }, favoritedCount: { type: 'number', - optional: false, nullable: false, }, }, -} as const; + required: [ + 'id', + 'createdAt', + 'lastClippedAt', + 'userId', + 'user', + 'name', + 'description', + 'isPublic', + 'favoritedCount', + ], +} as const satisfies JSONSchema7Definition;