📐 Notification schemas
Notification schemas validate route paths, shared pagination, and the batch-read anchor body.
Inventory
| Export | Request location | Contract |
|---|---|---|
updateNotificationToReadSchema | Path | Required string notification ID. |
findNotificationsSchema | Path, Query | Required identity ID plus pagination. |
updateNotificationToReadBatchSchema | Path, body | Identity ID and strict read-anchor body. |
Shared parameter definitions
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'},
},
];
Details
updateNotificationToReadSchema
Definition
Used by route: updateNotificationToReadRoute. Used by feature: updateNotificationToReadFeature.
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| Path | notificationId | string | Yes | No format or pattern. |
View complete source
export const updateNotificationToReadSchema = withSchema({
parameters: [{...notificationIdPathParameter}],
});
findNotificationsSchema
Definition
Used by route: findNotificationsRoute. Used by feature: findNotificationsFeature. It has no body.
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| Path | identityId | string | Yes | No format or pattern. |
| Query | page | integer | No | Minimum 1, maximum 1000. |
| Query | limit | integer | No | Minimum 1, maximum 50. |
View complete source
export const findNotificationsSchema = withSchema({
parameters: [
{
in: 'path',
name: 'identityId',
required: true,
schema: {
type: 'string',
},
},
...paginationQueryParametersSchema,
],
});
updateNotificationToReadBatchSchema
Definition
Used by route: updateNotificationToReadBatchRoute. Used by feature: updateNotificationToReadBatchFeature. The body is required and strict (additionalProperties: false).
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| Path | identityId | string | Yes | Shared identity path parameter; no format or pattern. |
| Body | lastReadNotificationId | string | Yes | Required application/json property; no additional body properties. |
View complete source
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,
},
});