Skip to content

Conversation

@afrittoli
Copy link
Member

Fixes: #60

Signed-off-by: Andrea Frittoli andrea.frittoli@gmail.com

@e-backmark-ericsson
Copy link
Contributor

I would prefer if we called it "customContent" instead of "data".

I believe that the intention is to provide a placeholder for any custom data that we in the spec call "content". This customContent could either be used for testing new content parameters in the protocol before proposing them to become standardized content parameters, or it could be used really as custom parameters for data that is not intended to be included in the procotol but rather remain specific to a certain use case.

@afrittoli
Copy link
Member Author

afrittoli commented Sep 2, 2022

I would prefer if we called it "customContent" instead of "data".

I have a preference for short and simple names, and I don't mind to convey the idea that CDEvents can be used as an envelop to transport extra data too. But customContent would work too.

I believe that the intention is to provide a placeholder for any custom data that we in the spec call "content".

My intention is to provide a placeholder for any data that the sender would like to put in there.
It could be used to transport a non-CDEvent content over a CDEvent channel, if the content is associated with the CDEvent message type.

This customContent could either be used for testing new content parameters in the protocol before proposing them to become standardized content parameters, or it could be used really as custom parameters for data that is not intended to be included in the procotol but rather remain specific to a certain use case.

Yes, definitely fields that are not yet in the spec could be transported via this field, until a standard name is specified for them. This is what I intend to do for a POC I'm working on, because not all required fields are in the spec yet.
I receive a webhook from Gitea, and covert it to a CDEvent. I plan to use this new field to host the entire original message from Gitea, so that the receiver may consume content from there.

Add a new field. Organise the spec document so that it's clear
which are the three root elements of a CDEvent and how the spec
document itself is structured.

Fixes: cdevents#60

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
@afrittoli
Copy link
Member Author

Fixed linter issues.

@e-backmark-ericsson
Copy link
Contributor

I would prefer if we called it "customContent" instead of "data".

I have a preference for short and simple names, and I don't mind to convey the idea that CDEvents can be used as an envelop to transport extra data too. But customContent would work too.

I believe it is good to prefix the field with "custom", so that it is clear that the data put in there is not standardized by the protocol.

I believe that the intention is to provide a placeholder for any custom data that we in the spec call "content".

My intention is to provide a placeholder for any data that the sender would like to put in there. It could be used to transport a non-CDEvent content over a CDEvent channel, if the content is associated with the CDEvent message type.

Well, I'm not sure about that "CDEvents channel". What would that mean? To me it is still a "CloudEvents channel".

And I believe that, in accordance with our current structure, the parameters that identifies the subject for each event type lies on top level of the subject object, and any additional data is in the "contents" sub object in there. Therefore, I don't think it makes sense to add any custom data to the top level of the subject, but only to the contents sub object. Or? Would it still be a valid CDEvent that any consumer can understand if there are additional top level subject identity parameters? Anyway, I might miss some use case there, so adding the custom data on top level of the event would work for me as well.

If we keep this custom data on the top level I'd prefer if we call it "customData". If we declare it under the subject, on same level as "content" I'd prefer if it was called "customContent".

I don't really like the term "third-party" in this case. Third-party to whom? Probably not to the producer of the event. It is just that the service/system that the producer is executing or monitoring contains more info than what the spec declares, so from the producer's perspective it is rather "additional data" instead of "third-party data".

@afrittoli
Copy link
Member Author

I would prefer if we called it "customContent" instead of "data".

I have a preference for short and simple names, and I don't mind to convey the idea that CDEvents can be used as an envelop to transport extra data too. But customContent would work too.

I believe it is good to prefix the field with "custom", so that it is clear that the data put in there is not standardized by the protocol.

I believe that the intention is to provide a placeholder for any custom data that we in the spec call "content".

My intention is to provide a placeholder for any data that the sender would like to put in there. It could be used to transport a non-CDEvent content over a CDEvent channel, if the content is associated with the CDEvent message type.

Well, I'm not sure about that "CDEvents channel". What would that mean? To me it is still a "CloudEvents channel".

And I believe that, in accordance with our current structure, the parameters that identifies the subject for each event type lies on top level of the subject object, and any additional data is in the "contents" sub object in there. Therefore, I don't think it makes sense to add any custom data to the top level of the subject, but only to the contents sub object. Or? Would it still be a valid CDEvent that any consumer can understand if there are additional top level subject identity parameters? Anyway, I might miss some use case there, so adding the custom data on top level of the event would work for me as well.

Yeah, the proposal is to add it top level, since the data may not be specific to the subject only.
I believe it matches what we discussed in the WG.

If we keep this custom data on the top level I'd prefer if we call it "customData". If we declare it under the subject, on same level as "content" I'd prefer if it was called "customContent".

customData sounds good, I will update the PR

I don't really like the term "third-party" in this case. Third-party to whom? Probably not to the producer of the event. It is just that the service/system that the producer is executing or monitoring contains more info than what the spec declares, so from the producer's perspective it is rather "additional data" instead of "third-party data".

Yeah, third-party is a terrible choice of name, I will change it to additional data, thank you for the suggestion.

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
@afrittoli afrittoli changed the title Add support for third party data in the spec Add support for additional data in the spec Sep 5, 2022
afrittoli and others added 5 commits September 5, 2022 13:08
Co-authored-by: Emil Bäckmark <emil.backmark@ericsson.com>
Co-authored-by: Emil Bäckmark <emil.backmark@ericsson.com>
Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
Copy link
Contributor

@e-backmark-ericsson e-backmark-ericsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there :)

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
spec.md Outdated
- '{"mydata1": "myvalue1"}'
- 'VGhlIHZvY2FidWxhcnkgZGVmaW5lcyAqZXZlbnQgdHlwZXMqLCB3aGljaCBhcmUgbWFkZSBvZiAqc3ViamVjdHMqCg=='

#### customDataEncoding
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realised that this should be "customDataContentType" instead.
The encoding (base64 or plain text) is decided based on the content-type and the binding format.
However the encoding alone does not give enough information to the consuming side to be able to parse the "customData".

I will rename this to "customDataContentType" and say that it is modelled after https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#datacontenttype
I will need to add a section to the CloudEvent binding to describe that the "application/json" format will be rendered as json, and any other format will be base64 encoded.

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
spec.md Outdated

#### customData

- Type: [`String`][typesystem]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The customData value doesn't need to be string, as long as the content-type is application/json.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good point, shall I use "object" here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the type, since we don't really constraint the type of custom data, we only have requirements about the encoding depending on the content type

Co-authored-by: Emil Bäckmark <emil.backmark@ericsson.com>
afrittoli and others added 3 commits September 6, 2022 09:18
Co-authored-by: Emil Bäckmark <emil.backmark@ericsson.com>
Co-authored-by: Emil Bäckmark <emil.backmark@ericsson.com>
Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
Copy link
Contributor

@e-backmark-ericsson e-backmark-ericsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy now :)

afrittoli added a commit to afrittoli/cdevents-sdk-go that referenced this pull request Sep 6, 2022
Add custom data to the SDK as described in cdevents/spec#63
Go objects can be passed directly, and the SDK will attempt
to marshal them as json.

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
afrittoli added a commit to afrittoli/cdevents-sdk-go that referenced this pull request Sep 6, 2022
Add custom data to the SDK as described in cdevents/spec#63
Go objects can be passed directly, and the SDK will attempt
to marshal them as json.

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
afrittoli added a commit to afrittoli/cdevents-sdk-go that referenced this pull request Sep 6, 2022
Add custom data to the SDK as described in cdevents/spec#63
Go objects can be passed directly, and the SDK will attempt
to marshal them as json.

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
@afrittoli afrittoli merged commit 856bba6 into cdevents:main Sep 6, 2022
afrittoli added a commit to cdevents/sdk-go that referenced this pull request Sep 6, 2022
Add custom data to the SDK as described in cdevents/spec#63
Go objects can be passed directly, and the SDK will attempt
to marshal them as json.

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
@afrittoli afrittoli linked an issue Mar 13, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a field to the spec to host data Payload and Versioning

2 participants