Skip to content

Fix CloudEvent model to support extension attributes #14

@bvandewe

Description

@bvandewe

https://github.com/cloudevents/spec/blob/main/cloudevents/spec.md#extension-context-attributes

"...A CloudEvent MAY include any number of additional context attributes with distinct names, known as "extension attributes". Extension attributes MUST follow the same naming convention and use the same type system as standard attributes. Extension attributes have no defined meaning in this specification, they allow external systems to attach metadata to an event, much like HTTP custom headers."

But the framework currently rejects events like:

{
  "specversion": "1.0",
  "id": "4c668593-18c5-4b96-9ec1-f7d13b2b5ad4",
  "time": "2025-02-03T11:18:03.957400",
  "datacontenttype": "application/json",
  "type": "com.dummy.test.requested.v1",
  "source": "https://dummy-source.com",
  "subject": "some.interesting.concept.key_abcde12345",
  "data": {
    "foo": "bar"
  },
"origin": "gateway-infra",    <<<< EXTENSION ATTRIBUTE
"sequence": 123456,
}

with this error:


INFO:     127.0.0.6:54295 - "POST /events/pub HTTP/1.1" 500 Internal Server Error
2025-02-03 11:17:34,192 ERROR    root:37 An error occured while processing an incoming cloud event: CloudEvent.__init__() got an unexpected keyword argument 'origin'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions