Skip to content

Needs clarification: interoperability of extensions #508

@alanconway

Description

@alanconway

This is not a spec bug,downgrading to a doc issue. See the explanation at #508 (comment)

Original text:

The current definition of extension attributes makes interoperability essentially impossible:

"This specification places no restriction on the type or semantics of the extension attributes. Each definition of an extensions SHOULD fully define all aspects of the attribute - e.g. its name, semantic meaning and possible values or even to indicate that it places no restrictions on its values."

There is no way for a general purpose cloudevents library to represent such an extension unless it has been customized to be aware of it. There is no way for a transport binding implementation to decode or encode such an extensions unless it has been so customized. There is no way for a generic event bridge to even pass-through such extension values unless it is aware of them. I'm trying to fix cloudevents/sdk-go and the cloudevents AMQP transport to deal with extensions and AFAIK it's impossible except for int, bool and string valued extensions.

I suggest that extension attributes should be constrained to use the same type system as normal context attributes.

Even that is problematic for the JSON binding, as there's no way to distinguish time or binary values from strings. For JSON I suggest those extensions be encoded as a JSON object with a type tag:
{
"anInt": 1,
"aString": "foo",
"aTime": { "time": "1969-03-21T0:00:00Z"},
"aBinary": { "binary": "base64encodedstuff" }
}

I think that would be sufficient to round-trip extension value safely thru any binding that supports the cloudevents type system.

There is also the issue of URI and URI-reference, I think it's OK to encode those as strings in JSON since they are so closely allied to strings, and any endpoint that knows what the extension means will be capable of using a string. It's not 100% faithful to the CE type system but probably workable.
.

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