Skip to content

Commit db261af

Browse files
CCM-11886: Fix event tests
1 parent eabc28d commit db261af

File tree

5 files changed

+21
-24
lines changed

5 files changed

+21
-24
lines changed

packages/event-schemas/schemas/TemplateCompleted/v1.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"id": {
66
"description": "Unique ID for this event",
77
"type": "string",
8-
"format": "uuid",
9-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
8+
"maxLength": 1000
109
},
1110
"time": {
1211
"description": "Time the event was generated",
@@ -36,7 +35,7 @@
3635
"description": "Unique identifier for the item in the event data",
3736
"type": "string",
3837
"format": "uuid",
39-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
38+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
4039
},
4140
"dataschema": {
4241
"type": "string",
@@ -113,7 +112,7 @@
113112
"description": "Unique identifier for the template",
114113
"type": "string",
115114
"format": "uuid",
116-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
115+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
117116
},
118117
"clientId": {
119118
"description": "The client that owns the template",
@@ -200,7 +199,7 @@
200199
"description": "Unique identifier for the template",
201200
"type": "string",
202201
"format": "uuid",
203-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
202+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
204203
},
205204
"clientId": {
206205
"description": "The client that owns the template",
@@ -281,7 +280,7 @@
281280
"description": "Unique identifier for the template",
282281
"type": "string",
283282
"format": "uuid",
284-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
283+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
285284
},
286285
"clientId": {
287286
"description": "The client that owns the template",
@@ -436,7 +435,7 @@
436435
"description": "Unique identifier for the template",
437436
"type": "string",
438437
"format": "uuid",
439-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
438+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
440439
},
441440
"clientId": {
442441
"description": "The client that owns the template",

packages/event-schemas/schemas/TemplateDeleted/v1.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"id": {
66
"description": "Unique ID for this event",
77
"type": "string",
8-
"format": "uuid",
9-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
8+
"maxLength": 1000
109
},
1110
"time": {
1211
"description": "Time the event was generated",
@@ -36,7 +35,7 @@
3635
"description": "Unique identifier for the item in the event data",
3736
"type": "string",
3837
"format": "uuid",
39-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
38+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
4039
},
4140
"dataschema": {
4241
"type": "string",
@@ -113,7 +112,7 @@
113112
"description": "Unique identifier for the template",
114113
"type": "string",
115114
"format": "uuid",
116-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
115+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
117116
},
118117
"clientId": {
119118
"description": "The client that owns the template",
@@ -200,7 +199,7 @@
200199
"description": "Unique identifier for the template",
201200
"type": "string",
202201
"format": "uuid",
203-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
202+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
204203
},
205204
"clientId": {
206205
"description": "The client that owns the template",
@@ -281,7 +280,7 @@
281280
"description": "Unique identifier for the template",
282281
"type": "string",
283282
"format": "uuid",
284-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
283+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
285284
},
286285
"clientId": {
287286
"description": "The client that owns the template",
@@ -436,7 +435,7 @@
436435
"description": "Unique identifier for the template",
437436
"type": "string",
438437
"format": "uuid",
439-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
438+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
440439
},
441440
"clientId": {
442441
"description": "The client that owns the template",

packages/event-schemas/schemas/TemplateDrafted/v1.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"id": {
66
"description": "Unique ID for this event",
77
"type": "string",
8-
"format": "uuid",
9-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
8+
"maxLength": 1000
109
},
1110
"time": {
1211
"description": "Time the event was generated",
@@ -36,7 +35,7 @@
3635
"description": "Unique identifier for the item in the event data",
3736
"type": "string",
3837
"format": "uuid",
39-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
38+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
4039
},
4140
"dataschema": {
4241
"type": "string",
@@ -120,7 +119,7 @@
120119
"description": "Unique identifier for the template",
121120
"type": "string",
122121
"format": "uuid",
123-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
122+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
124123
},
125124
"clientId": {
126125
"description": "The client that owns the template",
@@ -207,7 +206,7 @@
207206
"description": "Unique identifier for the template",
208207
"type": "string",
209208
"format": "uuid",
210-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
209+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
211210
},
212211
"clientId": {
213212
"description": "The client that owns the template",
@@ -288,7 +287,7 @@
288287
"description": "Unique identifier for the template",
289288
"type": "string",
290289
"format": "uuid",
291-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
290+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
292291
},
293292
"clientId": {
294293
"description": "The client that owns the template",
@@ -443,7 +442,7 @@
443442
"description": "Unique identifier for the template",
444443
"type": "string",
445444
"format": "uuid",
446-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
445+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
447446
},
448447
"clientId": {
449448
"description": "The client that owns the template",

packages/event-schemas/src/event-envelope.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { z } from 'zod';
55
// https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
66
// https://nhsd-confluence.digital.nhs.uk/x/pjIxOQ
77
const $CloudEvent = z.object({
8-
id: z.uuidv4().meta({
8+
id: z.string().max(1_000).meta({
99
description: 'Unique ID for this event',
1010
}),
1111
time: z.iso.datetime().meta({
@@ -23,7 +23,7 @@ const $CloudEvent = z.object({
2323
datacontenttype: z.literal('application/json').meta({
2424
description: 'Always application/json',
2525
}),
26-
subject: z.uuidv4().meta({
26+
subject: z.uuid().meta({
2727
description: 'Unique identifier for the item in the event data',
2828
}),
2929
dataschema: z.url().meta({

packages/event-schemas/src/template.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const $TemplateEventV1BaseData = z.object({
5353
owner: z.string().meta({
5454
description: 'The client or user that owns the template',
5555
}),
56-
id: z.uuidv4().meta({
56+
id: z.uuid().meta({
5757
description: 'Unique identifier for the template',
5858
}),
5959
clientId: z.string().max(1000).optional().meta({

0 commit comments

Comments
 (0)