diff --git a/packages/misskey-js/src/schemas/app.ts b/packages/misskey-js/src/schemas/app.ts index c80dc81c3..be6c0296d 100644 --- a/packages/misskey-js/src/schemas/app.ts +++ b/packages/misskey-js/src/schemas/app.ts @@ -1,33 +1,34 @@ +import type { JSONSchema7Definition } from 'schema-type'; + export const packedAppSchema = { + $id: 'https://misskey-hub.net/api/schemas/App', + type: 'object', properties: { - id: { - type: 'string', - optional: false, nullable: false, - }, + id: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, name: { type: 'string', - optional: false, nullable: false, }, callbackUrl: { - type: 'string', - optional: false, nullable: true, + type: ['string', 'null'], }, permission: { type: 'array', - optional: false, nullable: false, items: { type: 'string', - optional: false, nullable: false, }, }, secret: { type: 'string', - optional: true, nullable: false, }, isAuthorized: { type: 'boolean', - optional: true, nullable: false, }, }, -} as const; + required: [ + 'id', + 'name', + 'callbackUrl', + 'permission', + ], +} as const satisfies JSONSchema7Definition; diff --git a/packages/misskey-js/src/schemas/blocking.ts b/packages/misskey-js/src/schemas/blocking.ts index 553232242..8c21d1e6f 100644 --- a/packages/misskey-js/src/schemas/blocking.ts +++ b/packages/misskey-js/src/schemas/blocking.ts @@ -1,26 +1,22 @@ +import type { JSONSchema7Definition } from 'schema-type'; + export const packedBlockingSchema = { + $id: 'https://misskey-hub.net/api/schemas/Blocking', + 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', }, - blockeeId: { - type: 'string', - optional: false, nullable: false, - format: 'id', - }, - blockee: { - type: 'object', - optional: false, nullable: false, - ref: 'UserDetailed', - }, + blockeeId: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + blockee: { $ref: 'https://misskey-hub.net/api/schemas/UserDetailed' }, }, -} as const; + required: [ + 'id', + 'createdAt', + 'blockeeId', + 'blockee', + ], +} as const satisfies JSONSchema7Definition; diff --git a/packages/misskey-js/src/schemas/channel.ts b/packages/misskey-js/src/schemas/channel.ts index fd61a70c0..1d13293be 100644 --- a/packages/misskey-js/src/schemas/channel.ts +++ b/packages/misskey-js/src/schemas/channel.ts @@ -1,71 +1,81 @@ +import type { JSONSchema7Definition } from 'schema-type'; + export const packedChannelSchema = { + $id: 'https://misskey-hub.net/api/schemas/Channel', + 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', }, lastNotedAt: { - type: 'string', - optional: false, nullable: true, - format: 'date-time', + oneOf: [{ + type: 'string', + format: 'date-time', + }, { + type: 'null', + }], }, name: { type: 'string', - optional: false, nullable: false, }, description: { - type: 'string', - nullable: true, optional: false, + type: ['string', 'null'], }, bannerUrl: { - type: 'string', - format: 'url', - nullable: true, optional: false, + oneOf: [{ + type: 'string', + format: 'url', + }, { + type: 'null', + }], }, isArchived: { type: 'boolean', - optional: false, nullable: false, }, notesCount: { type: 'number', - nullable: false, optional: false, }, usersCount: { type: 'number', - nullable: false, optional: false, }, isFollowing: { type: 'boolean', - optional: true, nullable: false, }, isFavorited: { type: 'boolean', - optional: true, nullable: false, }, userId: { - type: 'string', - nullable: true, optional: false, - format: 'id', + oneOf: [{ + $ref: 'https://misskey-hub.net/api/schemas/Id', + }, { + type: 'null', + }], }, pinnedNoteIds: { type: 'array', - nullable: false, optional: false, items: { - type: 'string', - format: 'id', + $ref: 'https://misskey-hub.net/api/schemas/Id', }, }, color: { type: 'string', - optional: false, nullable: false, }, }, -} as const; + required: [ + 'id', + 'createdAt', + 'lastNotedAt', + 'name', + 'description', + 'bannerUrl', + 'isArchived', + 'notesCount', + 'usersCount', + 'userId', + 'pinnedNoteIds', + 'color', + ], +} as const satisfies JSONSchema7Definition;