You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MIGRATION.md
+4-14Lines changed: 4 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ v2 is a ground-up rewrite with four fundamental shifts:
15
15
16
16
1.**Protocol-based design** -- `BaseCloudEvent` is a `Protocol`, not a base class. Events expose explicit getter methods instead of dict-like access.
17
17
2.**Explicit serialization** -- Implicit JSON handling with marshaller callbacks is replaced by a `Format` protocol. `JSONFormat` is the built-in implementation; you can write your own.
18
-
3.**No auto-generated attributes** -- v1 auto-generated`id` (UUID), `time` (UTC now), and `specversion` ("1.0") if omitted. v2 requires all required attributes to be provided explicitly.
18
+
3.**Same auto-generated attributes** -- Like v1, v2 auto-generates`id` (UUID4), `time` (UTC now), and `specversion` (`"1.0"` or `"0.3"`) if omitted. Only `type` and `source` are strictly required.
19
19
4.**Strict validation** -- Events are validated at construction time. Extension attribute names must be 1-20 lowercase alphanumeric characters. `time` must be a timezone-aware `datetime`.
20
20
21
21
## Creating Events
@@ -35,18 +35,11 @@ event = CloudEvent(
35
35
**v2:**
36
36
37
37
```python
38
-
import uuid
39
38
from cloudevents.core.v1.event import CloudEvent
40
39
41
-
#All required attributes must be explicit
40
+
#id, specversion, and time are auto-generated (just like v1)
0 commit comments