📐 通知スキーマ
通知スキーマは、ルートパス、共通のページネーション、および一括既読のアンカー本文を検証します。
一覧
| エクスポート | リクエストの場所 | 契約 |
|---|---|---|
updateNotificationToReadSchema | パス | 必須の文字列通知 ID。 |
findNotificationsSchema | パス、クエリ | 必須のアイデンティティ ID とページネーション。 |
updateNotificationToReadBatchSchema | パス、本文 | アイデンティティ ID と厳格な既読アンカー本文。 |
共通のパラメーター定義
const notificationIdPathParameter: OpenAPIParameter = {
in: 'path',
name: 'notificationId',
required: true,
schema: {
type: 'string',
},
};
export const identityIdPathParameter: OpenAPIParameter = {
in: 'path',
name: 'identityId',
required: true,
schema: {
type: 'string',
},
};
export const paginationQueryParametersSchema: OpenAPIParameter[] = [
{
in: 'query',
name: 'page',
required: false,
schema: {maximum: 1000, minimum: 1, type: 'integer'},
},
{
in: 'query',
name: 'limit',
required: false,
schema: {maximum: 50, minimum: 1, type: 'integer'},
},
];
詳細
updateNotificationToReadSchema
定義
ルートでの使用: updateNotificationToReadRoute。機能での使用: updateNotificationToReadFeature。
| 場所 | フィールド | 型 | 必須 | 制約 |
|---|---|---|---|---|
| パス | notificationId | 文字列 | はい | 形式またはパターンなし。 |
完全なソースを表示
export const updateNotificationToReadSchema = withSchema({
parameters: [{...notificationIdPathParameter}],
});
findNotificationsSchema
定義
ルートでの使用: findNotificationsRoute。機能での使用: findNotificationsFeature。本文はありません。
| 場所 | フィールド | 型 | 必須 | 制約 |
|---|---|---|---|---|
| パス | identityId | 文字列 | はい | 形式またはパターンなし。 |
| クエリ | page | 整数 | いいえ | 最小値 1、最大値 1000。 |
| クエリ | limit | 整数 | いいえ | 最小値 1、最大値 50。 |
完全なソースを表示
export const findNotificationsSchema = withSchema({
parameters: [
{
in: 'path',
name: 'identityId',
required: true,
schema: {
type: 'string',
},
},
...paginationQueryParametersSchema,
],
});
updateNotificationToReadBatchSchema
定義
ルートでの使用: updateNotificationToReadBatchRoute。機能での使用: updateNotificationToReadBatchFeature。本文は必須かつ厳格です(additionalProperties: false)。
| 場所 | フィールド | 型 | 必須 | 制約 |
|---|---|---|---|---|
| パス | identityId | 文字列 | はい | 共通のアイデンティティパスパラメーター。形式またはパターンなし。 |
| 本文 | lastReadNotificationId | 文字列 | はい | 必須の application/json プロパティ。追加の本文プロパティは不可。 |
完全なソースを表示
export const updateNotificationToReadBatchSchema = withSchema({
parameters: [
{
...identityIdPathParameter,
},
],
requestBody: {
content: {
'application/json': {
schema: {
$schema: 'http://json-schema.org/draft-07/schema#',
additionalProperties: false,
properties: {
lastReadNotificationId: {type: 'string'},
},
required: ['lastReadNotificationId'],
type: 'object',
},
},
},
required: true,
},
});