Skip to content

Commit b066e55

Browse files
committed
CCM-12616: Updated base CloudEvent model to match latest schemas
1 parent 5b7ea7a commit b066e55

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

utils/event-publisher-py/event_publisher/__tests__/test_models.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ class TestCloudEvent:
99
@pytest.fixture
1010
def valid_event(self):
1111
return {
12-
'profileversion': '1.0.0',
13-
'profilepublished': '2025-10',
1412
'id': '550e8400-e29b-41d4-a716-446655440001',
1513
'specversion': '1.0',
1614
'source': '/nhs/england/notify/production/primary/data-plane/digitalletters/mesh',

utils/event-publisher-py/event_publisher/models.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44

55
class CloudEvent(BaseModel):
66
# Required fields - NHS Notify CloudEvents profile
7-
profileversion: Literal['1.0.0'] = Field(
8-
default='1.0.0',
9-
description='NHS Notify CloudEvents profile semantic version'
10-
)
11-
profilepublished: Literal['2025-10'] = Field(
12-
default='2025-10',
13-
description='NHS Notify CloudEvents profile publication date'
14-
)
157
specversion: Literal['1.0'] = Field(
168
default='1.0',
179
description='CloudEvents specification version'
@@ -50,23 +42,19 @@ class CloudEvent(BaseModel):
5042
...,
5143
description='W3C Trace Context traceparent header value'
5244
)
53-
dataschema: str = Field(
54-
...,
55-
description='Canonical URI of the event data schema'
56-
)
5745
data: dict[str, Any] = Field(
5846
...,
5947
description='Digital letters payload'
6048
)
6149

6250
# Optional fields
63-
datacontenttype: Optional[Literal['application/json']] = Field(
51+
dataschema: Optional[str] = Field(
6452
None,
65-
description='Media type for the data field'
53+
description='Canonical URI of the event data schema'
6654
)
67-
dataschemaversion: Optional[str] = Field(
55+
datacontenttype: Optional[Literal['application/json']] = Field(
6856
None,
69-
description='Version of the data schema'
57+
description='Media type for the data field'
7058
)
7159
severitytext: Optional[Literal['TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL']] = Field(
7260
None,
@@ -111,7 +99,7 @@ def validate_source(cls, v: str) -> str:
11199
raise ValueError('Source cannot be empty')
112100
import re
113101
# Must match NHS Notify CloudEvents pattern
114-
pattern = r'^/nhs/england/notify/(production|staging|development|uat)/(primary|secondary|dev-\d+)/(data-plane|control-plane)/digitalletters/mesh$'
102+
pattern = r'^/nhs/england/notify/(production|staging|development|uat)/(primary|secondary|dev-\d+)/data-plane/digitalletters/mesh$'
115103

116104
if not re.match(pattern, v):
117105
raise ValueError(

0 commit comments

Comments
 (0)