|
4 | 4 |
|
5 | 5 | class CloudEvent(BaseModel): |
6 | 6 | # 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 | | - ) |
15 | 7 | specversion: Literal['1.0'] = Field( |
16 | 8 | default='1.0', |
17 | 9 | description='CloudEvents specification version' |
@@ -50,23 +42,19 @@ class CloudEvent(BaseModel): |
50 | 42 | ..., |
51 | 43 | description='W3C Trace Context traceparent header value' |
52 | 44 | ) |
53 | | - dataschema: str = Field( |
54 | | - ..., |
55 | | - description='Canonical URI of the event data schema' |
56 | | - ) |
57 | 45 | data: dict[str, Any] = Field( |
58 | 46 | ..., |
59 | 47 | description='Digital letters payload' |
60 | 48 | ) |
61 | 49 |
|
62 | 50 | # Optional fields |
63 | | - datacontenttype: Optional[Literal['application/json']] = Field( |
| 51 | + dataschema: Optional[str] = Field( |
64 | 52 | None, |
65 | | - description='Media type for the data field' |
| 53 | + description='Canonical URI of the event data schema' |
66 | 54 | ) |
67 | | - dataschemaversion: Optional[str] = Field( |
| 55 | + datacontenttype: Optional[Literal['application/json']] = Field( |
68 | 56 | None, |
69 | | - description='Version of the data schema' |
| 57 | + description='Media type for the data field' |
70 | 58 | ) |
71 | 59 | severitytext: Optional[Literal['TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL']] = Field( |
72 | 60 | None, |
@@ -111,7 +99,7 @@ def validate_source(cls, v: str) -> str: |
111 | 99 | raise ValueError('Source cannot be empty') |
112 | 100 | import re |
113 | 101 | # 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$' |
115 | 103 |
|
116 | 104 | if not re.match(pattern, v): |
117 | 105 | raise ValueError( |
|
0 commit comments